From nobody Tue Feb 10 10:20:15 2026 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=1598194816; cv=none; d=zohomail.com; s=zohoarc; b=FCeFq3fcVZ9siejfu/1YP1MlPUU+7a+Djz9sp97d8lgQvchJN0HKN2y+aQPaYWv57m+hOcvr8HCmWKWysMxrP288BreKPaMcKOa+03hOo0M10gS0LRTsCpO1u/e136/ztR/o4vRRUaRO8SMEDJ1OrREmOIvtf021pLxrrc0A8wA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598194816; 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=wur1SFGp5xDijZMn7bJkUj1KQAmzkSNHK88wQEnF7jk=; b=SQIJ551DxF6iRPxmaBPyjSwu0nd7hgA+M2qukgJvRKBAu/PoSUT9TByn1jA65utjHcb8r9KIYh/WoxYXdcTOaymWHmNsCOZeT1tkgNO9VQi7deB3SeYPNq6Pt5LQF0SbyftF29pRJSlEwQAK6L0IaVH6LAUuu2e6+w8jNSl5HGc= 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 1598194816710251.9729152170711; Sun, 23 Aug 2020 08:00:16 -0700 (PDT) Received: from localhost ([::1]:38852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9rTj-0006XS-C5 for importer@patchew.org; Sun, 23 Aug 2020 11:00:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9rSr-0004r1-HD for qemu-devel@nongnu.org; Sun, 23 Aug 2020 10:59:21 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9rSp-0006dz-PQ for qemu-devel@nongnu.org; Sun, 23 Aug 2020 10:59:21 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MrgcU-1kxGiW1FZ6-00nljk; Sun, 23 Aug 2020 16:59:16 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/6] linux-user: Adjust guest page protection for the host Date: Sun, 23 Aug 2020 16:59:09 +0200 Message-Id: <20200823145912.1171738-4-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200823145912.1171738-1-laurent@vivier.eu> References: <20200823145912.1171738-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:uVSC+BN8iffnkVovJ5et5KG/MimAMbh6ytMx2N7MYhuKxwm2lXf pm5282ABPtW5oxmMgi8dvLGg1PHoCBh7R9znGic0L6LkcjmsD7cP0i998jpvA9vM43rDp8m JWTsw1dGeO4sD83jxN9m3iJJDSDodXoDjPEv0n3TLlAWSHCNjM7JDF0NozNvdcJNDr0kOi/ oDB4YsaeOXMh4iPgQObnA== X-UI-Out-Filterresults: notjunk:1;V03:K0:+930OTmX7ew=:8+r9hGeTbX+k/Jokb28Vju 1WkyEYFeX/sgS41Z8vCpUedbsFB67c5ffe27pzM/1R21p9TlBWPE5Zw5kTgu1lbW7mnUoG0Zr QZZrazNnfOdhYj9mK6cxXClavvpJuBWinxIyhAQMvNI1FFIQq0sGQKjGJpVA/ye5oVN5ga8X3 GLU/hQ2BpfXUU9twhnGgy5g7GVJ201N/JvjDCfK+oeGiVpknnfmbjO8s3IgiavRTzd5OF83bF q522eFKL8FljtGwr/NcceQhrVflAYd/SSBVt4RKgum7Q/Gs4LG7rGpwY4SN7BExSJMKyHptcN 2h+2GYrNXeJ0l6QdOhTYikltVlk0d/ePaTqaV9iw6FRkwOvttnuO733D8+fS4mGDsN9AKSjTu RaC/iKJQl8myWOCSu587DVMX+JnCfVBeP9mZipcelC/u4ZBYqQ/X9kP4+QeEri/n3J9UkqgDI dA1dKcWqke0siqB7SsKZgLGimX90e4r32lFTMBrhaIM1s9F2iKlM5g+w7qxG2TXKn1hLDA3R1 Vl0/OkYIbSO5NN/QZAcXTw1+dpxtt1m1+xQNeez/wsAdMXnBxeC5kP3g8RkoJDoyMsnjUXvUC bxqvgs0QNSgQx+0r6GTlJh6AgFvYlHz1BKw5Ixyn/3zGtcX4KxpfJ/BBGGirbvbtzBIW9F0b8 3dals+rooEVUAS7G5rLzuvynzXkDRTCmyl7fi4KMBCkBcYSbqCVOzYfXPWG05qjCDKrqsw9ET D96FpSUc2ufv0d0Y79al93nJgsuqPybMeYBqGl1e7/IbK6pnIXCMAOC4sdSQhRNWWjyq+Zhjr eYHeeakIbNpQYj1gIesn8TcMWo4e2BJJYKxFmb5yHMtCdYOKZAhsy8kEOSCyIpqIb4pC+m6 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.13; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/23 10:59:15 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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: Peter Maydell , Richard Henderson , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Executable guest pages are never directly executed by the host, but do need to be readable for translation. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Message-Id: <20200519185645.3915-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/mmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 46c7eeba9bd2..f2615634201d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -76,8 +76,12 @@ static int validate_prot_to_pageflags(int *host_prot, in= t prot) * don't bother transforming guest bit to host bit. Any other * target-specific prot bits will not be understood by the host * and will need to be encoded into page_flags for qemu emulation. + * + * Pages that are executable by the guest will never be executed + * by the host, but the host will need to be able to read them. */ - *host_prot =3D prot & (PROT_READ | PROT_WRITE | PROT_EXEC); + *host_prot =3D (prot & (PROT_READ | PROT_WRITE)) + | (prot & PROT_EXEC ? PROT_READ : 0); =20 return prot & ~valid ? 0 : page_flags; } --=20 2.26.2