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 00727C64EC4 for ; Tue, 28 Feb 2023 22:49:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8764F6B0075; Tue, 28 Feb 2023 17:49:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 826846B0078; Tue, 28 Feb 2023 17:49:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C7B66B007B; Tue, 28 Feb 2023 17:49:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5ECC66B0075 for ; Tue, 28 Feb 2023 17:49:16 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3767AAAF97 for ; Tue, 28 Feb 2023 22:49:16 +0000 (UTC) X-FDA: 80518193112.27.9AE090E Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by imf08.hostedemail.com (Postfix) with ESMTP id 8FCD5160006 for ; Tue, 28 Feb 2023 22:49:13 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CxicGeeo; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b=nNSuDReh; spf=pass (imf08.hostedemail.com: domain of "prvs=416532d1e=damien.lemoal@opensource.wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=416532d1e=damien.lemoal@opensource.wdc.com"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677624554; 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=UWo06qO96GzyktWP6ttc6kpgcFxBf0NLGGq3kwFspm8=; b=djZQC0wpZVsDtXIUf0c1H28J+1sPA/2Q+ALhklf4o6yzZ4wTpkeLwL+xTIsGGYNK96RLHj FtVzhQOocuw3+UUmgpW0wyYBawvEnIfrp/srBuiFTIsci3AOHjxjGQi9raEwXpGZ8IDUOt ilPBR+WjcgAv4GaBiroV8fCVNUkIgDQ= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CxicGeeo; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b=nNSuDReh; spf=pass (imf08.hostedemail.com: domain of "prvs=416532d1e=damien.lemoal@opensource.wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=416532d1e=damien.lemoal@opensource.wdc.com"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677624554; a=rsa-sha256; cv=none; b=VnLkXPIXGpitaD8CwYDSogHdTKwo24nzHEtNKO4iKmTfQ9y2VC3Xq6rsbkp8bARRqwS0GH hP45mrzKgal/JdT8GFzuykLZJcBv0tob2OZeV/kCTb4dOkMSjKK0Cw7R4DtWRupzoeRGNm FYUYOY7CGkqyg8s+blVHRkm85t+T+OA= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1677624553; x=1709160553; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Vy8BS1FuQ/PhAs7eaiMqD6ABWjKT7b+2fZNPoZ13nRU=; b=CxicGeeo6VlNNtJBO1R/NsUwnNUhD63Tw3n+9Xl4z6qe7DO3tSr4JEGM q/wB/8o8QS35KiLk2Oo9mI1hJ4c2QW/t/G/mVdmBvTdOl8E69DNJnQA1v FujRzgPo0dzBPeAT915K7G75fIOjIoxlfI5Ee/4ExDSiJwhQmWrankZNc NEOR2yRmyAr2CkF68plsXu6CgNx1TKCNnIjhgNCy6kL0YR3IB7jiYyRbW krnRQ/Z8W9JOwXCCyS8qtKVZI8qIL9qli0uK9yCd2hmEUMp/SxC/nvo2Z bCjj+DD6ZgSal2ueVNQobKfA8XbC8QToQ216K3plm2knw4Gu9i2lSZLX/ w==; X-IronPort-AV: E=Sophos;i="5.98,223,1673884800"; d="scan'208";a="224470107" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 01 Mar 2023 06:49:09 +0800 IronPort-SDR: hoSLxtzADX64i+gda5MOUdVkl8Mgbm1r8jJDSxqgigTr7YVyHZN3AxO+QrA/ipny7Xm7bGgSre ZdfdHWjDpA0Eg6w0H0hKs9Cupue5DnlVn8GzD5XnCY/670KSQN26/reWSUc676vzNiMFONhZl2 dAxp9H120uUbH3B1h2BA/4dR6CnnkVBD1kV1oMOyEqKQgW0AIBKLpCeXL6gjBNcuRgEQdKZVr6 eB/M/ivpIQ57lCufgt7gTHke5jCj4NNpaVoTlcowagIqJ+neKMhRbC9gAfEUpWbrJqP5Ig1BdC e7Q= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 28 Feb 2023 14:05:59 -0800 IronPort-SDR: eR1BSZGUSACBJMcZoB/YHlnPZNVoO7ix41+vuInUcKRhAeWT6pwbk+3icrYnzJ++Cmix91ot0V NWdruCgNpoprcgv9DJg1a71crdANwAjszn9pLERaHmW5AiDMyn+TTN5qs+1vOvnTeGG5FSeXsp otGuLyj5Xib+InvvBYJeqMN8xp25rLfOvCF0xTGHd8og4bl1eh1SY13vH9vq7Fil6cTxT5HoHH hmlI1VSGSLdXZBO9A57RM3LqM54haXNCNGeKkGPGfOtOPzDU0QudN4CsSrddZ/vB1VmE8WgY9T rrA= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 28 Feb 2023 14:49:09 -0800 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 4PRCGX6D9Yz1RvTp for ; Tue, 28 Feb 2023 14:49:08 -0800 (PST) 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= 1677624548; x=1680216549; bh=Vy8BS1FuQ/PhAs7eaiMqD6ABWjKT7b+2fZN PoZ13nRU=; b=nNSuDRehF9NyWIUnmI4m07iYXddB/xgLe80TA1tPm62D0oXt4RJ us8sBSemat7k5pviO1lhW+duKe9Zedu3bh03ySY3v+0Zxu2ivUdFWahT55NcbpzT zKbn3NPYI6vX2h4bMk0pzlbjPFuRkyq+c6osZzHOSg8xoMvUhnDStQxsJsl5afLZ CcbRd+fOiTTj+onBmRcCkCcLBrLDWmbcMIIpSJ3XGWvJZA5bySbuavDPXCGDffkY VTTSceKu2ks0Ul0gLNSCpHaMZck1WXtVnjeZVnPqxsGpAyk3r80WjwEOZ38l+ZW7 3ZU1GEOZDzdd3lM6SsYwWPl4ASsc/4zhF2Q== 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 7dK5wYgkzskY for ; Tue, 28 Feb 2023 14:49:08 -0800 (PST) Received: from [10.225.163.47] (unknown [10.225.163.47]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4PRCGW1cbgz1RvLy; Tue, 28 Feb 2023 14:49:07 -0800 (PST) Message-ID: <3719a4f0-1a5a-4661-a6d7-5d4f67d7b7e8@opensource.wdc.com> Date: Wed, 1 Mar 2023 07:49:05 +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, Niklas Cassel 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: 7bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ysscoq8nqzky86si7ssqghwt4uwhikqj X-Rspamd-Queue-Id: 8FCD5160006 X-HE-Tag: 1677624553-27170 X-HE-Meta: U2FsdGVkX196DYZsJKgYm0oXidP4fVZ0D8tKaOvMjBWOKuR8hCI5G08dOmV+fkd7ltBMeIsbce3CTesWkacU9seigADoBxGPwma3QYL17hEco2B70w11+ThNwrGCuDYyHXHA/1x2b89ZdV8sE5vBNVbFJGO+VGS4V/6I1sQ+P6Gfw8hl4EAJ/0efxsxmfU2Ma6uod83VwbIgqQP0E8tAKc5IOZGGG8p2939b14TLmX1MTcquCxbMs9McOTKQxekYmlhEeZK4l1q3QfUzF+fvWoaCZqZODeI/RZgv8e3wLmQIUlrH5dkozr3evfwfd6AuxDrRfo54zpCG5Y0rLplA6XYfe1u5Cgj5SjRQh6wQ8vhtS/UfGHimc0jd4wTNxeJ8hKf07xNDREOg8a80m520XBcKh2wgb21aFihbBay6LwIIqjKljXBk3nD2UyE3mHkMBSgCN1UKldWSwX/lpy3B0O2iCISsQ3alXz5n6vvGFUNS0JCRwS6z6QSySCrWpqBij8mWOqx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NYlVSIog3ODETYCvEn0TIWSaryCUARSbVkjYy6NFgJ9bKj8zT7Zw== 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/1/23 06: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 when >> 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-bit >> ELF files. >> >> Secondly some changes are required to enable and compile the ELF-FDPIC >> 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/gregungerer/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 >> --- >> >> arch/riscv/include/asm/elf.h | 11 +++++++++- >> arch/riscv/include/asm/mmu.h | 4 +++ >> arch/riscv/include/uapi/asm/ptrace.h | 5 ++++ >> fs/Kconfig.binfmt | 2 - >> fs/binfmt_elf_fdpic.c | 38 +++++++++++++++++------------------ >> include/linux/elf-fdpic.h | 14 +++++++++++- >> include/uapi/linux/elf-fdpic.h | 15 +++++++++++++ >> 7 files changed, 67 insertions(+), 22 deletions(-) > > Adding Damien, as IIRC he's had some hacked up userspace bits for the > K210. 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 doing > builds now). +Niklas Niklas, didn't you add a nommu qemu build for buildroot ? Can't find the config though... > > Given that it's the second week of the merge window and this is a bunch > of new uABI it seems best to hold off until the next cycle. I poked > around and don't see anything wrong, but I'll try and take a more > detailed look after the merge window. Does any riscv compiler support nommu fdpic now ? When doing the work on the k210, there was no support at all, hence the statically linked user binaries used (no shared text for libraries). -- Damien Le Moal Western Digital Research