From nobody Tue Feb 10 12:59:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1660328322; cv=none; d=zohomail.com; s=zohoarc; b=Uo/57mL4Xz1T1VE8Ikt9nd3iAfVzcz3tgiVxxGA8bSZJ3WuvNLwyn4kBTaHO2EipOhh05+nwijYeHEcE5MwD8RnChAeZo7Qs6F0a0Ib6AF1ty14qiyeOVFc70AvuruMZ6XgB1UI5xXeNZrMdMKqTxEreCCe60tASEslwF7t6MKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660328322; 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=HeLIyzSnBSgTsEjpLE+UrcJkbFayKBL07Hhi/YlkyKA=; b=SVGrlOpwRCX+W4BTT7x1eimN7KgL2NwXmodKdqYnw9r2k4QpAqGjl+2YM+y+0HlHQ38Q2PRTrL3oDTRKjNlC73RGXNrZGqWVtZXxNWJc3dvVArd90Y+rYZhyt4xMFHz24rlPhK4FLwJMSt1EzFIFICwGxAl++aZP1HJ4TtWodU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166032832242434.08781003416823; Fri, 12 Aug 2022 11:18:42 -0700 (PDT) Received: from localhost ([::1]:59272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMZF2-00058m-Bt for importer@patchew.org; Fri, 12 Aug 2022 14:18:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMZ4x-0003RM-1i for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:15 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:37672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMZ4v-0006WN-8u for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:14 -0400 Received: by mail-pg1-x52c.google.com with SMTP id bh13so1414904pgb.4 for ; Fri, 12 Aug 2022 11:08:12 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:a7aa:1d1d:c857:5500]) by smtp.gmail.com with ESMTPSA id h9-20020a056a00000900b0052dee21fecdsm1914761pfk.77.2022.08.12.11.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 11:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=HeLIyzSnBSgTsEjpLE+UrcJkbFayKBL07Hhi/YlkyKA=; b=uC0WdfQSkZGvDUH/GE8ArB1y+XK1PPiBkRLst/StY2kalmAgWz/MYIhpND8ieqHAJl mZJglurOWj0TNxfjFHCQybPLzSK/BtSOi7M3wCSvIVG4HL/vtKingkH9l1tuJxG1MW+t qF6nX/DChwFagiIMRVUzrJHe+p4oS8nZWHBN7Ts+zCWtrvze45cmFBrDbCkf3Orw5OuH gdTX6IZXZTPufRvWUiMBTPN2R4rRiob55CJDy/HpFO3+M/lWwaL7hwC1Ck0WTAvthI3X xISlf32DwnoyfOEnC9Esi9rAXstvsQ0oibgTWph84ABMUdSpG4hZhg8/WJFn+Aj5HwLI SjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=HeLIyzSnBSgTsEjpLE+UrcJkbFayKBL07Hhi/YlkyKA=; b=WnmqC7U1fdohCc9SkSaIS3dpiRSh/C72970h2TwEuwH8fCx9Up0AnIaUeZZ9UmcLOI HtdltfVLpwSerxEQf1hTuSaTai3SH0tz+7GutFr6ux226iKzuXXxfMp7RiqKVckurnQT kTNqfsrnyKczG3n1VIadqs409NkGIVsj/a+HOAlcnmtW/Yoqp2OYNnKMskKFVUXrp9Kq 1gJRhLjAOHmawRxTlOBBXkqeNbI5yE6ZYJyd2ejxe+0Elj7haFcLJGMy5wTIaqx0IWf8 lCqHYPiZwCjqg3xojGVFK97yR2exX2abAKr7HOOBRqHTcLN25AbphPRZbe59+lBkoOqU nw9w== X-Gm-Message-State: ACgBeo3cWNAFgbS3jCul2frHXThj0HUpHU2zvTryc02LOw6JMK41cwjY Ir2dEHva56y+VyHV1IxBkM06ZMfmB1fHTg== X-Google-Smtp-Source: AA6agR6BD7H0okDJg8iOFGOfEdtsC7pHB2BYOofWQCuIG82YELI/wKi1MmjcNFHBebxDPBinlQS+NQ== X-Received: by 2002:a05:6a00:1705:b0:52f:6028:5c33 with SMTP id h5-20020a056a00170500b0052f60285c33mr5042351pfc.29.1660327691936; Fri, 12 Aug 2022 11:08:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, iii@linux.ibm.com, alex.bennee@linaro.org Subject: [PATCH for-7.2 03/21] linux-user/x86_64: Allocate vsyscall page as a commpage Date: Fri, 12 Aug 2022 11:07:48 -0700 Message-Id: <20220812180806.2128593-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220812180806.2128593-1-richard.henderson@linaro.org> References: <20220812180806.2128593-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1660328322986100001 Content-Type: text/plain; charset="utf-8" We're about to start validating PAGE_EXEC, which means that we've got to the vsyscall page executable. We had been special casing this entirely within translate. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 29d910c4cc..e315155dad 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -195,6 +195,27 @@ static void elf_core_copy_regs(target_elf_gregset_t *r= egs, const CPUX86State *en (*regs)[26] =3D tswapreg(env->segs[R_GS].selector & 0xffff); } =20 +#define HI_COMMPAGE TARGET_VSYSCALL_PAGE + +static bool init_guest_commpage(void) +{ + /* + * The vsyscall page is at a high negative address aka kernel space, + * which means that we cannot actually allocate it with target_mmap. + * We still should be able to use page_set_flags, unless the user + * has specified -R reserved_va, which would trigger an assert(). + */ + if (reserved_va !=3D 0 && + TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE >=3D reserved_va) { + error_report("Cannot allocate vsyscall page"); + exit(EXIT_FAILURE); + } + page_set_flags(TARGET_VSYSCALL_PAGE, + TARGET_VSYSCALL_PAGE + TARGET_PAGE_SIZE, + PAGE_EXEC | PAGE_VALID); + return true; +} + #else =20 #define ELF_START_MMAP 0x80000000 --=20 2.34.1