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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91385C433E0 for ; Mon, 8 Mar 2021 10:48:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1349651DD for ; Mon, 8 Mar 2021 10:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1349651DD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJDR3-0003sv-Og for qemu-devel@archiver.kernel.org; Mon, 08 Mar 2021 05:48:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJDPt-0002wE-IP for qemu-devel@nongnu.org; Mon, 08 Mar 2021 05:47:13 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:36099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJDPr-0005Fp-Oi for qemu-devel@nongnu.org; Mon, 08 Mar 2021 05:47:13 -0500 Received: from [192.168.100.1] ([82.252.159.174]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.119]) with ESMTPSA (Nemesis) id 1M6lxY-1lOCIM0apq-008LIk; Mon, 08 Mar 2021 11:47:08 +0100 Subject: Re: [PATCH v2] linux-user: Fix executable page of /proc/self/maps To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Nicolas Surbayrole References: <20210308091959.986540-1-nsurbayrole@quarkslab.com> From: Laurent Vivier Message-ID: Date: Mon, 8 Mar 2021 11:47:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210308091959.986540-1-nsurbayrole@quarkslab.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:DxgknW6ICzZRefs+QN2KB1BasHlJlNYV469/oZL5luu/X0goVkb oVnQBSG/eY0afta61AC+LEfQusEzG+/+1+t1jW7nqOapd30ZcLNzBq7xyNLgbYkXat/WTlK bPSdHweyEq7BsTs1ucFJVsiWeN55uqvPpaLp/dLG8pDDgrHPpHK0tpg4SnMoqqm46dO9y9S rpqATc3upqHMatIRvZZmw== X-UI-Out-Filterresults: notjunk:1;V03:K0:3shL5TqXon0=:Bvzhb7VndCqEvKEH76LvfW KQNEPz9tVSaWbK7i1/s9UXKWGHn7/3ZeAsH+jgYPQLsm++lYwyE2Vb8Vuaglx45fURDxkowgm n9IXEWXkdzKRZgHLxgFhVaMtVpBea0X29CsxoJOxNwHQJqB5+VxT7DMtBvIqiVNWnsQ+2pMhi DqaBPL22cYbaFQRipoNVaNbef/Jb8wMbGK8gRTQEvgeYSotwQRQbuB6jhaBn69h/xheJjRGTC 79CbwpYP5DKCgCWQlpUK/RtQYNzPQM6YUW4Z0wbLRdQD3Cwlq2BP82y5TTInpzssy3sldi/rY RClTZ3rqicQBDP1pit5hGixFKfBr3Cb7ph3BCm4mhWizY8ZEsL2i9jwAjeDJTNFR1CupZtOsT 5MtliHVUb5wd11OKQAUBZCfJkhXYmAh1lMYA/1lI7ydvry4RUXn3D516hrXI1F+rYnhYjky/r 3W9ipinAug== 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, NICE_REPLY_A=-0.001, 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Le 08/03/2021 à 10:19, Nicolas Surbayrole a écrit : > 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 > --- > 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 389ec09764..0bbb2ff9c7 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -7888,9 +7888,9 @@ static int open_self_maps(void *cpu_env, int fd) > count = 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) { > It looks good. Alex, you wrote this code, any comment? Should we move this directly in read_self_maps() to have the guest values in MapInfo? Thanks, Laurent