From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8A25C61DA4 for ; Wed, 15 Mar 2023 04:12:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 706DB8E0002; Wed, 15 Mar 2023 00:12:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6902A8E0001; Wed, 15 Mar 2023 00:12:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E1B28E0002; Wed, 15 Mar 2023 00:12:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 394B28E0001 for ; Wed, 15 Mar 2023 00:12:59 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 05FC21A0EDD for ; Wed, 15 Mar 2023 04:12:59 +0000 (UTC) X-FDA: 80569812078.12.3D43F81 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by imf03.hostedemail.com (Postfix) with ESMTP id 3393620003 for ; Wed, 15 Mar 2023 04:12:55 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=k3E48FGt; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b="FBbk/eB6"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com; spf=pass (imf03.hostedemail.com: domain of "prvs=4318cbe24=damien.lemoal@opensource.wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=4318cbe24=damien.lemoal@opensource.wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678853576; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mVcKkw6E3B3aAaOuIUogVnvYXDz7FEWHTsKTsrb+l34=; b=ueXhlglLG8t+UE0sqy758pQl7K6PeagbMxMnrjqHGh1LlRatn3tgJRpbrcDrgcCeEQ7PtL DgtT2bolT4E11o9+5/asIslVIqaNyNP+vfvwOFswSPbNiS/u2iOd7L5dlEnEffzVtJgtLw P6lDjgvMKSUM996MJwpO4QICdVHJf8A= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=k3E48FGt; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b="FBbk/eB6"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com; spf=pass (imf03.hostedemail.com: domain of "prvs=4318cbe24=damien.lemoal@opensource.wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=4318cbe24=damien.lemoal@opensource.wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678853576; a=rsa-sha256; cv=none; b=0LleMVUaz5deNLkQLwCqayqkMNcwXiC5TAWwlvJVSwMOiPMxBk8L7ij+VdqTnYdX3WaOs2 JNUHPVpt6ECqIFRK2h+7LQuazQ22I4FkYYKTqI4aCUmiuPPuyty32TU1Aq8RAk3XYBvvZC K71+eQ3AJCg/7AV426+cmqiIN/xmhNo= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1678853576; x=1710389576; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=9yzCmVnJ2ADFgpoYjZxap/HmlSXife7MeskouNF4fAo=; b=k3E48FGtSd5cpeTgYlBiyarAEvxgtO4MwCoJcQrNTtXeccmKpoTWPGQ6 3cbhlkllPY6o36lJYN2iArWxIc6oUamDtpzLi83ZCC+ezEzTov5kkS9Db OPExzR5IQ0ZBpuoecYuJIptLkKb4en0oZRajZ1MmHXX69fFln9tVXsAuy j7Zkf4qYqe3oX1irwMreMUlTjEU8Av2I/jIHrM7bZtv1smYPRQvARemTO Df+ht7fSgcBeEeVf4ZQL7b3Mulo8S0hi87lIAZaMTOGW2GXkfilWZaHyg uqNB8BiLOr6IhsVGboKTwm1b2iAO9rNNf+j5OGtcWFMF1yhoT78UKPM2i g==; X-IronPort-AV: E=Sophos;i="5.98,261,1673884800"; d="scan'208";a="225444207" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Mar 2023 12:12:54 +0800 IronPort-SDR: R1MYM3q0ztvX/sdZOrgVg04/KJyL+0MB50oGOEX5GKSe0jydqBJA6pxynne9mGdtwjI3LOvw55 2aAOtaDsFaKaEhcODn9W9i/czYAJ6GWyzGffZd28YYGzKzRk2XqV1CYZmrx9RqXhTmSUCO5uwb fbpn/iVTPOOUsnR0ZOUO/Zd35kTaBQQ1As+YZybVYlNV9JMES6iNzF0eMxDXaCv2c/LT+0xocC tahA3kXFWD0dM/4xz4B6L8hA970xp4/Y0z2ffXatSR0jKMlrq+clCO8rT1N+ZlI2Ud+AtONbKi T9E= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Mar 2023 20:29:21 -0700 IronPort-SDR: n+6jEyjAvPFpIzUM5QFUMvK2IOXvsDBofyMoyfcQ3N9hmqqR3aNYajmBjfm+eP/dihBEDZ//ml dvknjSOCNKAnJ6cRtawELSVLW4Rtw6HVY8vy2utwGG7ETfWqNO+ItCWEFK+b6dM0BZ7oBcZMxm uadIa+3BJkndscHRxO6fnq6vFlcfM5zNkue0zM+ZrJlYslGkUB+7s/W98N1y9eB0E6lphH6NXY KnPAdJdS1gthL4igZCzx5WvoLtZNyA6EdZ/eXg78/XxFpjcYdcqsXyqaRKO4KdqVX/J4URrAEe 9ns= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Mar 2023 21:12:54 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4Pbxnf2pKZz1RtVt for ; Tue, 14 Mar 2023 21:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1678853573; x=1681445574; bh=9yzCmVnJ2ADFgpoYjZxap/HmlSXife7Mesk ouNF4fAo=; b=FBbk/eB6Leir1m8WJTARQJodRW25c5yVCiZrI8NcVcF7O2J1xMt C8BfqepJRN9OKXEvrVw3gGRmYljk51KsV+dWSqDLFzKD/jkB20gLQF4XxVtdlWQB rsoqP06MOheGOynGW3yA8fqrQmDvWczDM0GISt9QOcyuTWcG0I/cyNzZuhykoH5r dTVP1o6PWAqvuM0rJqAlWOa/JpFmZrOLVNpKmkblsZeNX6+phBQ67pEhVeRth/Jm WG6+6aR8pkY1MTHCmZ6P1WmpNPmBuxI9EHDg9a74LqMZtjg15+CZl1a7AxihsqzP fBgrdlVGQEMkmYhOWkLYiEeabP3QFh21CNw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IaniCJTiYYBP for ; Tue, 14 Mar 2023 21:12:53 -0700 (PDT) Received: from [10.225.163.84] (unknown [10.225.163.84]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Pbxnc2Dq3z1RtVm; Tue, 14 Mar 2023 21:12:52 -0700 (PDT) Message-ID: <9521f4da-1451-293e-ce0a-08b9edad2298@opensource.wdc.com> Date: Wed, 15 Mar 2023 13:12:50 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 0/2] riscv: support ELF format binaries in nommu mode Content-Language: en-US To: Palmer Dabbelt , gerg@kernel.org, macro@orcam.me.uk Cc: linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: Damien Le Moal Organization: Western Digital Research In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 3393620003 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: epmbbhbwatf9etnq353sdaztaah7gguj X-HE-Tag: 1678853575-970060 X-HE-Meta: U2FsdGVkX18ePacLu1O+C8QvMzkWRA8x7b4P8F++v9mQbCcvf7CIzzmL4XNnb6mE29oo+l86yWs0D2uTGM1Bu4uytzFEP01H+KoYqngTvNCF6s1so1Ih+NLtO7e7fdW4xusbZV2pBrFdfANJXHGml4So6zR7r2Snc39bQLApmoPXachlmWIe+W7JF82xlWqyXd8tt77QLV0VvSISZrM7dt4W6tvSoqAIgsVYGCHpARRnLhDsDlXoBQAYh8SOELFgD719kvwUGImD/LbVn6H3cn+wXHjcJikqUxjps/3NG1SuOp0wlMk9f4xhrYkuTTbpstiJWKPR8l7QI5TsvHKIDbV/aHjUAiOCqR+B5oivZgkROARZ2ZizhCj2OXij6lCaFPRIA5z8fr97y3NPhhO9ml4vhk5wevkr70K2k3S1QmcXGOAcsIwXx/zDeg977Kmk55If7dLk8978R/0FqX6kHfWvnDOiUusOmxwtTgbK307rSecu9Y8beYMmHEE1Ojk9vvd2S3UbIIKcNsXTtVTFPFu54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2WL2E5GrOu+PPf/M5gTg25hXpttnRt4GQoGLgF1b4fZXCkeGolourStqPNA5SFGgcuRHx0HBm2/Hju+fLbXsQN1IGGI9sJ0og== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 3/15/23 12:58, Palmer Dabbelt wrote: > On Tue, 28 Feb 2023 16:20:35 PST (-0800), gerg@kernel.org wrote: >> Hi Palmer, >> >> On 1/3/23 07:52, Palmer Dabbelt wrote: >>> On Tue, 28 Feb 2023 05:51:24 PST (-0800), gerg@kernel.org wrote: >>>> The following changes add the ability to run ELF format binaries whe= n >>>> running RISC-V in nommu mode. That support is actually part of the >>>> ELF-FDPIC loader, so these changes are all about making that work on >>>> RISC-V. >>>> >>>> The first issue to deal with is making the ELF-FDPIC loader capable = of >>>> handling 64-bit ELF files. As coded right now it only supports 32-bi= t >>>> ELF files. >>>> >>>> Secondly some changes are required to enable and compile the ELF-FDP= IC >>>> loader on RISC-V and to pass the ELF-FDPIC mapping addresses through= to >>>> user space when execing the new program. >>>> >>>> These changes have not been used to run actual ELF-FDPIC binaries. >>>> It is used to load and run normal ELF - compiled -pie format. Though= the >>>> underlying changes are expected to work with full ELF-FDPIC binaries= if >>>> or when that is supported on RISC-V in gcc. >>>> >>>> To avoid needing changes to the C-library (tested with uClibc-ng >>>> currently) there is a simple runtime dynamic loader (interpreter) >>>> available to do the final relocations, https://github.com/gregungere= r/uldso. >>>> The nice thing about doing it this way is that the same program >>>> binary can also be loaded with the usual ELF loader in MMU linux. >>>> >>>> The motivation here is to provide an easy to use alternative to the >>>> flat format binaries normally used for RISC-V nommu based systems. >>>> >>>> Signed-off-by: Greg Ungerer >>>> --- >>>> >>>> =C2=A0arch/riscv/include/asm/elf.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 |=C2=A0=C2=A0 11 +++++++++- >>>> =C2=A0arch/riscv/include/asm/mmu.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0 4 +++ >>>> =C2=A0arch/riscv/include/uapi/asm/ptrace.h |=C2=A0=C2=A0=C2=A0 5 +++= + >>>> =C2=A0fs/Kconfig.binfmt=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2= =A0=C2=A0=C2=A0 2 - >>>> =C2=A0fs/binfmt_elf_fdpic.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 38 +++++++= ++++++++++------------------ >>>> =C2=A0include/linux/elf-fdpic.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 14 +++++++++++- >>>> =C2=A0include/uapi/linux/elf-fdpic.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0=C2=A0 15 +++++++++++++ >>>> =C2=A07 files changed, 67 insertions(+), 22 deletions(-) >>> >>> Adding Damien, as IIRC he's had some hacked up userspace bits for the= K210.=C2=A0 I'm yet to get anything running, but it'd be great if we get= this to a point where I can actually boot test this on QEMU (I'm just do= ing builds now). >> >> This is a simple script I user to generate a working QEMU example: >> >> https://raw.githubusercontent.com/gregungerer/simple-linux/master/b= uild-riscvnommu-linux-uclibc-elf.sh >> >> It does reference some configs here https://github.com/gregungerer/sim= ple-linux/tree/master/configs >> and this posted patchset as https://github.com/gregungerer/simple-linu= x/tree/master/patches (this is >> just these 2 patches combined as a single patch). >> >> >>> Given that it's the second week of the merge window and this is a bun= ch of new uABI it seems best to hold off until the next cycle.=C2=A0 I po= ked around and don't see anything wrong, but I'll try and take a more det= ailed look after the merge window. >> >> Oh, yeah, no hurry. >=20 > Maciej and Damien: I'm fine taking this, but not in any rush. I'd=20 > rather get the uABI right if things are still in flight, but if we're=20 > all just waiting for something to get merged first then I'm fine with=20 > that being Linux. I did not try Gerg script with the k210. No time right now. But if it works with QEMU, should be fine. >=20 >> >> Regards >> Greg --=20 Damien Le Moal Western Digital Research