From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615629178; cv=none; d=zohomail.com; s=zohoarc; b=ZBJJrsnDAc9qiRC7CAzi7L2ipaHOHmA3aQG6rtBKOGz9O5vRCVm6m/QrZIEwSyqPzYSn4AkLkQEL3wi9FBxI3PN2f5ahypcI44V63ODhYSvSXRkvePB2n8+yxin4OPCzfO8Zw/b920JzupsAk/ZM8JCSNLMObgLhF5+y68o8+NM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615629178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vHEPp9cTKgg7IhBU0b0nKduzIP/fWcsAn7vcxF6zIjw=; b=iDNpy0ua+4oxQfgc0d026lAI/O0QeUowf5t4J0Hn/ZZBgNFtup4b2+Ma6VIptVx6lqsXPFEfO9+tY3cegzB0TyWh0nzTXlbRkC/GMzFGeNAutkHdqI9vcdsbqOw0/sjSrN8n4aZ635cuhl6Xp56fZyDdMZPytFsyZNDEMlHfhz0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615629178748310.6560845912559; Sat, 13 Mar 2021 01:52:58 -0800 (PST) Received: from localhost ([::1]:52604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL0x7-0005CP-Nw for importer@patchew.org; Sat, 13 Mar 2021 04:52:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sQ-0007A4-1s for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:07 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:58929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sG-00075z-CK for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:05 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MJW18-1l1H4B1zce-00JsC6; Sat, 13 Mar 2021 10:47:51 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/5] linux-user: Fix executable page of /proc/self/maps Date: Sat, 13 Mar 2021 10:47:43 +0100 Message-Id: <20210313094747.2966948-2-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210313094747.2966948-1-laurent@vivier.eu> References: <20210313094747.2966948-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:58f61JmWhBGlKAKy+RjXaa97JGJB9HibKxZ2CCi0B/msB295f0z BjiLQRjYiVaYDHRFiZDtNJ7OJKn3SrWsX09Hmv+3xz5BFhRTvmMYbSNmZSNtVDueUvMkd3U DL0Evc1sD33ypugZkEbUhVkJSUshwQUo274bm87wRvdqa0qoHLsD0B1FOnhIozIEM31pr2i f4w7W4IDAxb/Yuwjnj5sA== X-UI-Out-Filterresults: notjunk:1;V03:K0:T93sL277CIg=:xpoCgX1RB8wm31btYbwGc3 /m9GXHtXd40EkxErUtK/upAAtK9V4B6awuLlj0sWYVpJc7dUQmytqQMq5Vmr2/q2n0fvHPvHr zIx/CkpRh2TPrWtojfbf1J+X7fhAqsEYhw56WVuLd6iHfivvcWuQQxcP4cZO9dNx13K6Anb6Z mm1V/yqmOpafySz832MrqWWLmKXiHNnCVLN+mBGWHRpVdB8dK3XRaI7Hsco8fgCV27QTFLgU1 r5N6KItNWUbONYeheYpPzXi+eCy7loC2I1mtDYDEjJlM0aG2tWSr0cYym+mJyfUnT++QLd/aN IKzCrGZ22wIVL5HnKnPt2Qh9ny+WW2CZdFJhVOOxeKpN1emsLShiOYuVLouhqypBsnsddkRMF uzO3u95DYPh59sgA01FFpa5hMgaGZ3KH5/wp8XNMBGGRKYXLc9TJWmARKZD6TPJIHWLjhW5ug JvtZ/saWHw== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Nicolas Surbayrole , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Nicolas Surbayrole The guest binary and libraries are not always map with the executable bit in the host process. The guest may read a /proc/self/maps with no executable address range. The perm fields should be based on the guest permission inside Qemu. Signed-off-by: Nicolas Surbayrole Reviewed-by: Richard Henderson Acked-by: Alex Benn=C3=A9e Message-Id: <20210308091959.986540-1-nsurbayrole@quarkslab.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9522f603aad6..1e508576c73e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7890,9 +7890,9 @@ static int open_self_maps(void *cpu_env, int fd) count =3D dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr " %c%c%c%c %08" PRIx64 " %s %"PRId64, h2g(min), h2g(max - 1) + 1, - e->is_read ? 'r' : '-', - e->is_write ? 'w' : '-', - e->is_exec ? 'x' : '-', + (flags & PAGE_READ) ? 'r' : '-', + (flags & PAGE_WRITE_ORG) ? 'w' : '-', + (flags & PAGE_EXEC) ? 'x' : '-', e->is_priv ? 'p' : '-', (uint64_t) e->offset, e->dev, e->inode); if (path) { --=20 2.29.2 From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615629101; cv=none; d=zohomail.com; s=zohoarc; b=DMGuJ/4bepe9wGFHb+YUQz+hXTLOODN1iZJAUF+eNp72By3gWtyEjZOvWe8e0OXmCr93lr5ZKodhTZeREAdFgzWrRezoYbjVAPW2Yyd5DJcOypum4hSOW7gPpi3cr+K9zSxAUT9bok6le66W+n20zs9XqF7kxQLO60Ecii1rM0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615629101; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oUYzJm1TYOf+NMr/S3d0jIXSjOOw2QE4BmJWRor56VM=; b=CWQEX8Vprf6BGkqKNM3WshWtZc5oR3y/xCohClWOAusqutMtotyjqPP3lMD0iTqkOHap/XN5fm3wjvIJhoASON5vg/MnQzf/KJbuyTy/b5xZ5Kfie0R9/YJdiwfVsh0Ow/AjZjflC5S2DXl/qcGLvDKfwuefzs4a9Z2Q7kdqfVE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615629101966700.2099950717006; Sat, 13 Mar 2021 01:51:41 -0800 (PST) Received: from localhost ([::1]:50494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL0vs-0003w5-Rg for importer@patchew.org; Sat, 13 Mar 2021 04:51:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sO-00079l-41 for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:05 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:53255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sG-00075F-7p for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:03 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MIxmm-1l1p1x3Rzm-00KQ9s; Sat, 13 Mar 2021 10:47:52 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/5] linux-user: manage binfmt-misc preserve-arg[0] flag Date: Sat, 13 Mar 2021 10:47:44 +0100 Message-Id: <20210313094747.2966948-3-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210313094747.2966948-1-laurent@vivier.eu> References: <20210313094747.2966948-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:mkx6O8zonY+ER/ILzpH+S33Zyi1sZKYSYXbvoeYT/8qP4uG1Hip KsKKS6jyfiR6VZXm2KypevkKoyMkEMkWqtpF6rgMbZOkLKt+h4C7vypPuK9GRAYlscEpFs6 8+2c7oTg9FXm81f8YT6IzKy6th1m0cUWBhloSkL0ecmiLcbuNMcjTz/6hlpKbkO2k/HqsVo tbo7e7jAqmWLHGMeFxRqA== X-UI-Out-Filterresults: notjunk:1;V03:K0:wDHJySUTVaE=:ntwzGflAGX+n0H9QzIU38b xLHka3dEWRS6L9TMMGTy7hoWYsZfOoBUiirIMppliaoTlX5lMMPXFC6ZkdhD3AWaXrRm0zvT3 Cq4onWpSpgVd5ndJ/9E2hu/S+ycHPp38odHk6XpJzWlUfRUHXv+4RSgBbYRiO9341X09p3CIc YoB37erWWzLZxmyHb7sj9M+5BCTkutz5hg949Xz9ScncqMq0x36/6+Msm8Fy3Q8HRQGnBFfpb rLAfOXk5K1WozgXPzzxOXCJWtDBtVdjgCT5ub5nh96rPJjlDk1dBTtbmsCzLTlQGBLPeXnl2T OPNLzlfdfElLdz1JewK9egVMevX8QpIpYUTdC301Q0GLOmw1tVvnaAA9GTZkZU2f4Pk9pz/EQ 6ek9KEEDGF/JV9Jk8v3Oe4JcC4Az8H2dVirfxy/QELvrC6XzQnO7PFYN5rafUFyw06g6IthO6 nBYzdihQDQ== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=217.72.192.75; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add --preserve-argv0 in qemu-binfmt-conf.sh to configure the preserve-argv0 flag. This patch allows to use new flag in AT_FLAGS to detect if preserve-argv0 is configured for this interpreter: argv[0] (the full pathname provided by binfmt-misc) is removed and replaced by argv[1] (the original argv[0] provided by binfmt-misc when 'P'/preserve-arg[0] is set) For instance with this patch and kernel support for AT_FLAGS: $ sudo chroot m68k-chroot sh -c 'echo $0' sh without this patch: $ sudo chroot m68k-chroot sh -c 'echo $0' /usr/bin/sh The new flag is available in kernel (v5.12) since: 2347961b11d4 ("binfmt_misc: pass binfmt_misc flags to the interpreter") This can be tested with something like: # cp ..../qemu-ppc /chroot/powerpc/jessie # qemu-binfmt-conf.sh --qemu-path / --systemd ppc --credential yes \ --persistent no --preserve-argv0 yes # systemctl restart systemd-binfmt.service # cat /proc/sys/fs/binfmt_misc/qemu-ppc enabled interpreter //qemu-ppc flags: POC offset 0 magic 7f454c4601020100000000000000000000020014 mask ffffffffffffff00fffffffffffffffffffeffff # chroot /chroot/powerpc/jessie sh -c 'echo $0' sh # qemu-binfmt-conf.sh --qemu-path / --systemd ppc --credential yes \ --persistent no --preserve-argv0 no # systemctl restart systemd-binfmt.service # cat /proc/sys/fs/binfmt_misc/qemu-ppc enabled interpreter //qemu-ppc flags: OC offset 0 magic 7f454c4601020100000000000000000000020014 mask ffffffffffffff00fffffffffffffffffffeffff # chroot /chroot/powerpc/jessie sh -c 'echo $0' /bin/sh Signed-off-by: Laurent Vivier Message-Id: <20210222105004.1642234-1-laurent@vivier.eu> --- linux-user/main.c | 24 ++++++++++++++++++++ scripts/qemu-binfmt-conf.sh | 44 +++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 4f4746dce825..f956afccab62 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -26,6 +26,7 @@ #include #include #include +#include =20 #include "qapi/error.h" #include "qemu.h" @@ -49,6 +50,11 @@ #include "cpu_loop-common.h" #include "crypto/init.h" =20 +#ifndef AT_FLAGS_PRESERVE_ARGV0 +#define AT_FLAGS_PRESERVE_ARGV0_BIT 0 +#define AT_FLAGS_PRESERVE_ARGV0 (1 << AT_FLAGS_PRESERVE_ARGV0_BIT) +#endif + char *exec_path; =20 int singlestep; @@ -632,6 +638,7 @@ int main(int argc, char **argv, char **envp) int execfd; int log_mask; unsigned long max_reserved_va; + bool preserve_argv0; =20 error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); @@ -688,6 +695,9 @@ int main(int argc, char **argv, char **envp) =20 init_qemu_uname_release(); =20 + /* + * Manage binfmt-misc open-binary flag + */ execfd =3D qemu_getauxval(AT_EXECFD); if (execfd =3D=3D 0) { execfd =3D open(exec_path, O_RDONLY); @@ -697,6 +707,20 @@ int main(int argc, char **argv, char **envp) } } =20 + /* + * get binfmt_misc flags + */ + preserve_argv0 =3D !!(qemu_getauxval(AT_FLAGS) & AT_FLAGS_PRESERVE_ARG= V0); + + /* + * Manage binfmt-misc preserve-arg[0] flag + * argv[optind] full path to the binary + * argv[optind + 1] original argv[0] + */ + if (optind + 1 < argc && preserve_argv0) { + optind++; + } + if (cpu_model =3D=3D NULL) { cpu_model =3D cpu_get_model(get_elf_eflags(execfd)); } diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 7b5d54b88741..573b5dc6acd7 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -178,25 +178,27 @@ usage() { Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU] [--help][--credential yes|no][--exportdir PATH] [--persistent yes|no][--qemu-suffix SUFFIX] + [--preserve-argv0 yes|no] =20 Configure binfmt_misc to use qemu interpreter =20 - --help: display this usage - --qemu-path: set path to qemu interpreter ($QEMU_PATH) - --qemu-suffix: add a suffix to the default interpreter name - --debian: don't write into /proc, - instead generate update-binfmts templates - --systemd: don't write into /proc, - instead generate file for systemd-binfmt.service - for the given CPU. If CPU is "ALL", generate a - file for all known cpus - --exportdir: define where to write configuration files - (default: $SYSTEMDDIR or $DEBIANDIR) - --credential: if yes, credential and security tokens are - calculated according to the binary to interpret - --persistent: if yes, the interpreter is loaded when binfmt is - configured and remains in memory. All future uses - are cloned from the open file. + --help: display this usage + --qemu-path: set path to qemu interpreter ($QEMU_PATH) + --qemu-suffix: add a suffix to the default interpreter name + --debian: don't write into /proc, + instead generate update-binfmts templates + --systemd: don't write into /proc, + instead generate file for systemd-binfmt.service + for the given CPU. If CPU is "ALL", generate a + file for all known cpus + --exportdir: define where to write configuration files + (default: $SYSTEMDDIR or $DEBIANDIR) + --credential: if yes, credential and security tokens are + calculated according to the binary to interpret + --persistent: if yes, the interpreter is loaded when binfmt is + configured and remains in memory. All future uses + are cloned from the open file. + --preserve-argv0 preserve argv[0] =20 To import templates with update-binfmts, use : =20 @@ -269,6 +271,9 @@ qemu_generate_register() { if [ "$PERSISTENT" =3D "yes" ] ; then flags=3D"${flags}F" fi + if [ "$PRESERVE_ARG0" =3D "yes" ] ; then + flags=3D"${flags}P" + fi =20 echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags" } @@ -330,9 +335,10 @@ DEBIANDIR=3D"/usr/share/binfmts" QEMU_PATH=3D/usr/local/bin CREDENTIAL=3Dno PERSISTENT=3Dno +PRESERVE_ARG0=3Dno QEMU_SUFFIX=3D"" =20 -options=3D$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-su= ffix:,exportdir:,help,credential:,persistent: -- "$@") +options=3D$(getopt -o ds:Q:S:e:hc:p:g: -l debian,systemd:,qemu-path:,qemu-= suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@") eval set -- "$options" =20 while true ; do @@ -388,6 +394,10 @@ while true ; do shift PERSISTENT=3D"$1" ;; + -g|--preserve-argv0) + shift + PRESERVE_ARG0=3D"$1" + ;; *) break ;; --=20 2.29.2 From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615628979; cv=none; d=zohomail.com; s=zohoarc; b=bdqUJ+NMT5aiDcRBkbcELM/JoFKjOoKE56Fg7EQCyWINJASaQk0qe4ndSXIG2ULcrgtDClAh1GPfeoeeWOn2OPRJrWjzyYxAxFqHyVzxpnYCihgWdjqjzHCirBozGfFv1Q69HPxHp26p7RQty3qjWicIeq7A2e3mSf3KIiVSPzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615628979; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RDTPxdtV1dtTypnE2PPgIpucLhBmoeLEKvDp22D20x4=; b=Ju1WCBTTLptJnEg2Mom6iheaBBmLS4stvjqwog8Bc7ghTEvMbplN0oZDyJbaQZGj35SKvSVW1rNeBep9Z0cT7Xlz4wK88xa/6uMXU1UNfIZ8d3hJkY4UWtpF1skryaP94nSjpsZdflncVaMCvN4xFlFUKVTgCLQYuErhR0SLwRM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615628979823152.54043746129673; Sat, 13 Mar 2021 01:49:39 -0800 (PST) Received: from localhost ([::1]:44606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL0tu-0000oH-PZ for importer@patchew.org; Sat, 13 Mar 2021 04:49:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sU-0007BR-3j for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:10 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:52201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sG-00075s-AZ for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:09 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M27ix-1lJ53x1Luj-002Tvz; Sat, 13 Mar 2021 10:47:52 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/5] linux-user/elfload: munmap proper address in pgd_find_hole_fallback Date: Sat, 13 Mar 2021 10:47:45 +0100 Message-Id: <20210313094747.2966948-4-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210313094747.2966948-1-laurent@vivier.eu> References: <20210313094747.2966948-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ARPqbZM7H4YlmUK/sMpbATnHDzHRqg7ulXMGpTkzgiXqmGdYIef ojC291BX4+K6K98BABMRZMb1ag+VUyyyySRJJF067SzF2LxiG8orxL1xSIjHZV4xoadLTy1 AuoJHr1iGQ0XwrB4fHeEb5i0N1PggruSNbS476ohOjOd5P0MCuJTkEZAtoAuS28SlJMUGg8 dSZePlqgopn8ZIHpEguiw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ajBkhAo/r94=:ff1BMVkCQbI/FbsUILc3+2 ofHpyx+MS7qTyOiPka5OArG4HawsFuL2gkFGk+qPB9m5ngcZHhOQqBqzYJY4PpKQ8hEQFaBCT 08ZSj0z38+z5l1CYie7wIuFHgfBsSBr1kUqmaQCybAfbX6YGr3bVEqIIYui2uioJVUwW6fgLq OQg4tL6WESmLXghlZUqtjMK8mp+qX7UdN4TZeJ4DuTkHurMzVScxCIFaFgKg0y1Lb0i3A7itw 9LiGyspjafUuq964CoggA15WF7gtkDRb3Ylqzdx5B06hl9SQFj3G98kXPWQR89Hspi7nj4n09 O5W6c1e0sdnVS7N0OLuakTcYjDUDltqrJANFVLP1jbc4bY5mjYIWruWgrFdOHwtBz9GS5LzCB MHo/3zMQrp318CGkpAH1sogpSeb4nnDrNFdJd2YdrF87eb625xCeKHLuZAI9dolGiehRWtg/j 4v0pskpi1w== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.17.24; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Vincent Fazio Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Vincent Fazio Previously, if the build host's libc did not define MAP_FIXED_NOREPLACE or if the running kernel didn't support that flag, it was possible for pgd_find_hole_fallback to munmap an incorrect address which could lead to SIGSEGV if the range happened to overlap with the mapped address of the QEMU binary. mmap(0x1000, 22261224, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE= , -1, 0) =3D 0x7f889d331000 munmap(0x1000, 22261224) =3D 0 --- SIGSEGV {si_signo=3DSIGSEGV, si_code=3DSEGV_MAPERR, si_addr=3D0x84b81= 7} --- ++ killed by SIGSEGV +++ Now, always munmap the address returned by mmap. Fixes: 2667e069e7b5 ("linux-user: don't use MAP_FIXED in pgd_find_hole_fall= back") Signed-off-by: Vincent Fazio Reviewed-by: Laurent Vivier Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210131061849.12615-1-vfazio@xes-inc.com> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 140a9716324d..174ee7bad677 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2209,7 +2209,7 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t gue= st_size, uintptr_t brk, void * mmap_start =3D mmap((void *) align_start, guest_size, PROT_NONE, flags, -1, 0); if (mmap_start !=3D MAP_FAILED) { - munmap((void *) align_start, guest_size); + munmap(mmap_start, guest_size); if (MAP_FIXED_NOREPLACE !=3D 0 || mmap_start =3D=3D (void *) align_start) { return (uintptr_t) mmap_start + offset; --=20 2.29.2 From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615628978; cv=none; d=zohomail.com; s=zohoarc; b=WbL1yL7HkrCF8NRmEVYgijF5eHes49n0vmLaVL3+XBu1Kq4u8UyZD1J+BGKAsOCRSfwfyLxWlDCgHQotKOJkaWJOOlvA7Li8mnMZxpco4qTKwlEo0pCtcmzQHMI4HP3u+rtOwjSDE83FN7qNIxI0FMhGd1+IJAonBshby3t9itM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615628978; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ulnooFUzFQuWWLyrV6rSf9sag52RwuBXICrkKFSmzB0=; b=QXGBkRsX3apO6dLdgBxlxSFSo8t8DqUliaSzMDJDrFGsHY5VeUsJR1kY316qVBisEoVIP0tlV4HaRyMbqCzpyYnS0oc8hyf5YpofetQ5YQ99MBqUM7glivqdqynDMl10OpbA4yuDgqz1y6FQYe+YHM+VQsLhW4pIIwFdfEQYrGo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615628978529554.8012627970736; Sat, 13 Mar 2021 01:49:38 -0800 (PST) Received: from localhost ([::1]:44418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL0ts-0000iU-Vl for importer@patchew.org; Sat, 13 Mar 2021 04:49:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sM-00079T-6d for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:03 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:58989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sG-00075u-86 for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:01 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MrPVJ-1m73Lr3H6N-00oWK9; Sat, 13 Mar 2021 10:47:52 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 4/5] linux-user/elfload: do not assume MAP_FIXED_NOREPLACE kernel support Date: Sat, 13 Mar 2021 10:47:46 +0100 Message-Id: <20210313094747.2966948-5-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210313094747.2966948-1-laurent@vivier.eu> References: <20210313094747.2966948-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:2/s7H0X2AzTU8XmqUkzKe38GLMhxVTEhegdlewSVChNIqK0fkTI otm+wHxNEpLJ/G+h5ROsRZdRlhzCofX5Fz9NdQoQtZcGFtwgMMyZ5c+ENsxnjEUbMGKkSon WNf3T8e3DzaB65/sIZA95cHXb1Q9bwMA25i9T4hkNb5UtibT9zplVAUEv2iNE5uqj7gd6Y0 urYM6gfCRxpHdsFVtNLvw== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z8/tCqKbGTQ=:gP2Zcj1g0opYWib7o01ZFz wzvn8aakwBQbVXXUy5c9bFWb2k+wLbZ7LG6oBKZ4gZGJH+omOjqeH9Aik6Zd+jx/GEYyZG7ET h4TuedRMpkIj7XqbKvSo3EiIAl+2mCnHSawGkk7uKHwqPSE50vTjYsjB6A8eHZRc2QUfBWxSL BfaXcnmPGxT2pNe5UXy41iblokjdsIGKwLUHATft2dE8HNmJRqA56cQUr63ssQC4ptNlj0vJL Fk1QRcyVs/luzkmZngLCD0sQUhIJlGNPaQhiOuAOq+y8koOECMznJKJ7wcmTYy50VaPzfKToA Gjo6VBlrqh2S4N7Om5VnfcS9XvSmDRM7ok0YrKnxPJtI0KZFQ9D5LToXiQcPoQp0SYjuaVgwu lPjQkeymUaMmTh6LrrJWhRSCXTR8m3NuSESebc6ZoZs5pCfzraI+ZV4PnLC4N3Fi/T7BIv2BK qyFKjpDRdA== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=217.72.192.74; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Vincent Fazio Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Vincent Fazio Previously, pgd_find_hole_fallback assumed that if the build host's libc had MAP_FIXED_NOREPLACE defined that the address returned by mmap would match the requested address. This is not a safe assumption for Linux kernels prior to 4.17 Now, we always compare mmap's resultant address with the requested address and no longer short-circuit based on MAP_FIXED_NOREPLACE. Fixes: 2667e069e7b5 ("linux-user: don't use MAP_FIXED in pgd_find_hole_fall= back") Signed-off-by: Vincent Fazio Reviewed-by: Laurent Vivier Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210131061930.14554-1-vfazio@xes-inc.com> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 174ee7bad677..e525901659d4 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2210,8 +2210,7 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t gue= st_size, uintptr_t brk, PROT_NONE, flags, -1, 0); if (mmap_start !=3D MAP_FAILED) { munmap(mmap_start, guest_size); - if (MAP_FIXED_NOREPLACE !=3D 0 || - mmap_start =3D=3D (void *) align_start) { + if (mmap_start =3D=3D (void *) align_start) { return (uintptr_t) mmap_start + offset; } } --=20 2.29.2 From nobody Sun May 19 01:15:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615628982; cv=none; d=zohomail.com; s=zohoarc; b=fngn/Sdu1RoPiqqKsTDovHD60QxZ8JLXW7JRX3sv9OFBJu6Rtm5EFVCRu8Tdm82p7FM2EEjoy1FJYRRPcDO5/kCYKpvTPTM8u9zEOOhjSQw6I1lFsYoRZ6GYx30Tp5Bm8xDU0v/6mqoe3gMP2oLoIeMdXvNMCdz1s+Ci5fhwi9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615628982; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=79K5xtT9it7CpTI9jDZarcYH0NZ6HkGx9gq+svWG3oc=; b=KDfDEFF644cw9o7y2XMJBWOJbziruIn8UN23MSh8kuonFGBf3xz3wRE69dp0CwAId9zOqRW8fGq37eyFoRG6Fdd0gdOuMLwBx+hl3p1g4CfYPLFN+Lkx/3OO+nV+zI1Xj/DsSroPQ5emsScegmLQzzgv6St9hKZzlAxqUE4lnVc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615628982636829.2014094826445; Sat, 13 Mar 2021 01:49:42 -0800 (PST) Received: from localhost ([::1]:44858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL0tx-0000yA-Im for importer@patchew.org; Sat, 13 Mar 2021 04:49:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sS-0007Ak-5h for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:09 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:39879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL0sG-00075v-Ct for qemu-devel@nongnu.org; Sat, 13 Mar 2021 04:48:07 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MadC8-1lsPgJ0oBO-00c5bI; Sat, 13 Mar 2021 10:47:53 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 5/5] linux-user/elfload: fix address calculation in fallback scenario Date: Sat, 13 Mar 2021 10:47:47 +0100 Message-Id: <20210313094747.2966948-6-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210313094747.2966948-1-laurent@vivier.eu> References: <20210313094747.2966948-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Ypx7//kkwQSt+PxxQ9JhdJGaZSLCEiDiUl2WnxSxR+hLLc33gA+ 0RLQam29jJrx5LLlSjoRaTBYpcb4Xdf+spy7KbIqFlGH6ZbttBo2le2duDrwG9c6/BtriDx cp6VwlpnNDKR9525BQffmBh90+uZ1ajyUa5T6b7aVa9J1+bfamyK1b/v1ynh22HGe0J46aW ZmhpACJKA2QRzHtxlaadg== X-UI-Out-Filterresults: notjunk:1;V03:K0:l5AvciM7xMA=:/kvJsT7CY/2u4c0Apr5L7a wmgfwXKXkGEzcIZe4Nh9/vAv3Ffyg7Q4i2al5RlPqehai3CSNy/Enhv9phxrtf+hIe9HuAKXk +rKVlH9TPjHGJ637BzPf6ODRVeJxFWoiChvNmt91xljtvMZw5SOUJFSkSmkqGX5M105xUTLnQ Hx/ptlPj80eKiraewcfbBw5p5XjC7TYQrw6y9fVSRfUQAAnYMZz0Tsqi7CsmzsAUuvaCEtNbR wMqX/bza6V0RASCcN0iWg+rAoooxwmDIRoNdL64VjvxjmT/LgHAx+2OMpMHFcQVSyNrGcQYHA VpcAbQEyavA+MsfWhmzp3kAl3GeMFlH6BQ85q/FAlsaT3mcoIJJkWdBGTNj92GOo8cfT0y1Uw t66h7CqVUnpWVw6Q8M5ulC6mqxV4VxRZxhaSjVSUlqPcixKgDfx/RN2GHBRsV0fgDjxWWDV0m CUgbFDJQWA== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Vincent Fazio Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vincent Fazio Previously, guest_loaddr was not taken into account when returning an address from pgb_find_hole when /proc/self/maps was unavailable which caused an improper guest_base address to be calculated. This could cause a SIGSEGV later in load_elf_image -> target_mmap for ET_EXEC type images since the mmap MAP_FIXED flag is specified which could clobber existing mappings at the address returnd by g2h(). mmap(0xd87000, 16846912, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESER= VE|0x100000, -1, 0) =3D 0xd87000 munmap(0xd87000, 16846912) =3D 0 write(2, "Locating guest address space @ 0"..., 40Locating guest address = space @ 0xd87000) =3D 40 mmap(0x1187000, 16850944, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|= MAP_NORESERVE, -1, 0) =3D 0x1187000 --- SIGSEGV {si_signo=3DSIGSEGV, si_code=3DSEGV_ACCERR, si_addr=3D0x21883= 10} --- +++ killed by SIGSEGV +++ Now, pgd_find_hole accounts for guest_loaddr in this scenario. Fixes: ad592e37dfcc ("linux-user: provide fallback pgd_find_hole for bare c= hroots") Signed-off-by: Vincent Fazio Reviewed-by: Laurent Vivier Message-Id: <20210131061948.15990-1-vfazio@xes-inc.com> [lv: updated it to check if ret =3D=3D -1] Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index e525901659d4..c6731013fde2 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2235,7 +2235,8 @@ static uintptr_t pgb_find_hole(uintptr_t guest_loaddr= , uintptr_t guest_size, brk =3D (uintptr_t)sbrk(0); =20 if (!maps) { - return pgd_find_hole_fallback(guest_size, brk, align, offset); + ret =3D pgd_find_hole_fallback(guest_size, brk, align, offset); + return ret =3D=3D -1 ? -1 : ret - guest_loaddr; } =20 /* The first hole is before the first map entry. */ --=20 2.29.2