From nobody Mon Aug 15 17:11:13 2022 X-Original-To: soc-status@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M615v5mf7z4ZWGy for ; Mon, 15 Aug 2022 17:11:31 +0000 (UTC) (envelope-from kotty.0704@gmail.com) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M615t5Sw5z3yHV for ; Mon, 15 Aug 2022 17:11:30 +0000 (UTC) (envelope-from kotty.0704@gmail.com) Received: by mail-pl1-x62e.google.com with SMTP id x23so6869181pll.7 for ; Mon, 15 Aug 2022 10:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc; bh=a64oj17WC2v30nOtPk2y5xLuIyCuJsPnp2jXdo0Oprg=; b=A+efOIe4apStrS1qyi2SQkojoLl/P0x1AE0ANu3woysU7MMd3sAT5fhbnF97vvTjtT SL3kWBKpbXYfj+iYsXKtG/n51UZATMEBF5x41goD1stUK/SwYhuo615DovHhSp8QTz2u YvmiTMzuZ5JeeICB/ZAWA/8pQw+LTv3QRrJKBoqCUeGcCdHS02xwNmbeiwqhlm/mpxUD phtfx1oPsmTWU8WrgpQIc8s8NXCf6yzOHSZZLwhehpc0RxrHw856IMpxV/5s4obGg48h F7hcvSAOvv0jYkdO/G/Oo4lUDOCoSvYDDgYFNEh0g3tBIPeXkk6+7MAabmCDsVeh27lk GxCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=a64oj17WC2v30nOtPk2y5xLuIyCuJsPnp2jXdo0Oprg=; b=TwXFOCpKsAqoKQmxwLmpIDRh2INtOeaoLmyBUn+KzK8JC+/dOP1uwfauOiryOWIhpy qRnW6EjGH2xsqFoMf8yuOCgcAavkvaFygba/YBsgZpurEM6XWLsGOftMnvK1L/xDJof9 wufD8aTOeXU2YDuOp8LvuNJVdjHp6aRq7PKNlnR+7l0x969QJuH9BhRNSHrSBQP4tMYv 5XLx9NfvXpKC+G0MiXaN7FJuuaWO7Ei7Ih9B4k5sQZbKiwz34bmFo1z40m9bDUaXqWsM 2T0pc1vsObtRkvBvg8ZnfRwLz4nj/5iOFCluAgqEBb+byvoEamOAeirhKKhVxkona6NG VoaA== X-Gm-Message-State: ACgBeo3G7KvdSX/0lcWwQvuLwZNobZyh5vBXxJVt0XBAea+ziU8SN2fw 9o5qNh5OJ5agz9kTeeVbQB1H6RGXvRGs7uv6QxX6fjg7 X-Google-Smtp-Source: AA6agR5XzUL0VrmaHQs8i7R1L1FIAPr4bWhI3aVHk6RZzt+1iSbRpgfKGwMwISrOIbxA8hchGgPnRSbck1hs7EoqBD8= X-Received: by 2002:a17:902:da92:b0:16e:f4a4:9f93 with SMTP id j18-20020a170902da9200b0016ef4a49f93mr17842079plx.27.1660583489169; Mon, 15 Aug 2022 10:11:29 -0700 (PDT) List-Id: Summer of Code Status Reports and Discussion List-Archive: https://lists.freebsd.org/archives/soc-status List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-soc-status@freebsd.org X-BeenThere: soc-status@freebsd.org MIME-Version: 1.0 From: =?UTF-8?B?5LuK5LqV6Iiq5LiA?= Date: Tue, 16 Aug 2022 02:11:13 +0900 Message-ID: Subject: [GSoC22 Weekly Status report #8&9] Ran the Linux binary that just returns in the main func: Koichi Imai To: soc-status@freebsd.org Content-Type: multipart/alternative; boundary="000000000000fdeb1605e64ab8eb" X-Rspamd-Queue-Id: 4M615t5Sw5z3yHV X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=A+efOIe4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of kotty.0704@gmail.com designates 2607:f8b0:4864:20::62e as permitted sender) smtp.mailfrom=kotty.0704@gmail.com X-Spamd-Result: default: False [-3.93 / 15.00]; NEURAL_HAM_LONG(-1.00)[-0.997]; NEURAL_HAM_SHORT(-1.00)[-0.996]; NEURAL_HAM_MEDIUM(-0.94)[-0.942]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCPT_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62e:from]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[soc-status@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_NONE(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MLMMJ_DEST(0.00)[soc-status@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --000000000000fdeb1605e64ab8eb Content-Type: text/plain; charset="UTF-8" Hello, These two weeks I have made an effort to run the Linux binary that just returns in the main function successfully. There were mainly three bugs to fix. 1. The first one seems to be due to a bug in the kernel linker. Linuxulator is implemented as a kernel module for each architecture, and therefore I was just specifying the module in sys/modules/Makefile to let it know the existence of the module. However, it appears there is a bug resolving IFUNC references from modules. Thus, I added the files for Linuxulator at /sys/conf/files.powerpc to build it together with the kernel and that fixed the bug. 2. The second bug was because of the mismatch of the ELF ABI version. Since I was assuming the ELF ABI version 2, I was reusing the code of FreeBSD exec_setregs() for ABI version 2. However, the Linux binary created in my environment was that of the ELF ABI version 1, and therefore, there were some differences mainly with the handling of the entry points. I reused the exec_setregs_funcdesc() of FreeBSD to fix this. 3. I was mainly reusing the codes from FreeBSD for the process initialization. However, it doesn't initialize the r6 register which should hold the address of the auxiliary vector. (Actually, initializing with zero.) This didn't make the Linux binary run correctly so I rewrite the code to initialize properly. Due to this debugging, I was able to run the Linux binary that just returns in the main function successfully. I would like to check the functionality of syscalls that are realized with machine-independent codes and add DWARF annotations at the signal trampoline as a next step. Koichi --000000000000fdeb1605e64ab8eb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

These two weeks I have made an e= ffort to run the Linux binary=C2=A0that just returns in the main function s= uccessfully.

There were mainly three bugs to fix.<= /div>
1. The first one seems to be due to a bug in the kernel linker. L= inuxulator is implemented as a kernel module for each architecture, and the= refore I was just specifying the module in sys/modules/Makefile to let it k= now the existence of the module. However, it appears there is a bug resolvi= ng IFUNC references from modules. Thus, I added the files for Linuxulator a= t /sys/conf/files.powerpc to build it together with the kernel and that fix= ed the bug.

2. The second bug was because of the m= ismatch of the ELF ABI version. Since I was assuming the ELF ABI version 2,= I was reusing the code of FreeBSD exec_setregs() for ABI version 2. Howeve= r, the Linux binary created in my environment was that of the ELF ABI versi= on 1, and therefore, there were some differences mainly with the handling o= f the entry points. I reused the exec_setregs_funcdesc() of FreeBSD to fix = this.

3. I was mainly reusing the codes from FreeB= SD for the process initialization. However, it doesn't initialize the r= 6 register which should hold the address of the auxiliary vector. (Actually= , initializing with zero.) This didn't make the Linux binary run correc= tly so I rewrite the code to initialize=C2=A0properly.

=
Due to this debugging, I was able to run the Linux binary that just re= turns in the main function successfully. I would like to check the function= ality of syscalls that are realized with machine-independent codes and add = DWARF annotations at the signal trampoline as a next step.

Koichi


--000000000000fdeb1605e64ab8eb--