From patchwork Fri Aug 12 18:07:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 596813 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1777820maz; Fri, 12 Aug 2022 11:09:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5GE23MrNwZ57/ENarVUEaZXX0mWEebKObyN1Yx17HRjXjXrdckTmABPvi/VyaGQv3wfh6B X-Received: by 2002:ac8:7fc5:0:b0:343:681d:c3fb with SMTP id b5-20020ac87fc5000000b00343681dc3fbmr4678414qtk.157.1660327795258; Fri, 12 Aug 2022 11:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660327795; cv=none; d=google.com; s=arc-20160816; b=vdZ0HX+7SkHQLKDM/M+82p29XwDelMfkAKeLnrjomgbQuusB0UdIeUXm9WRmYQ21OE SoxPIlyFDLm9C9lEITd3ZC/J/V29ip7lhKGBh3Tn89fKpaxudSp4irLw7nd/DO2lC+ql YcM3zCUAu54eUy/DWrXGxo2vajto6pjYBVrvB/8UaZ/rAAYT2BBvKY5CCebkNn8V4iOt er/Eb/YWUv2My65rZqMHL5JgmP0BiA1bHujrSRGQT41FSOnM6zuvORNWz9SeybVUlssD 2lAQf21RpoLK3a0eIGkQvQut+zC0YJv455Gw9vZslGQafW+lZ/Pqby1hNEPW/9vTr8g5 4J7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ztH2KdOZugDOiuPkZQawXgA4F56Gwh34Y3mDIuElS7Y=; b=mR+DqBBgP/u7Mt/B03gyjP1uAt/GXxfoVrlzsIh0QcO3k1b9wbfV1jJMdPrtIspBbq ywccgmNCb4B68vXQcdxiEUYgvnixjoqMPNSjNA7wApkHswOi4BFOnc8MCXRWTeV8VXgI sxr//gr4IhtdXSmnnd3A9QZsBt46dtYE6GcukZl4cRfdOG3xG9sjdcQaqgmpfKxD1NT1 s04QhKdhwO4q+29pt2pAV5KGQqACdI4IbT3+RMPJRZ0ljldGL6a2oJ2/mDtjZaUZZaA/ v4Tbdt2DpVVxdfzK+T64yO81zTmXurXpbrvNLzwfJ7lfZZxd4dvb/byCK5kTo7H4h7Az pAkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXDwF3AV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b4-20020a05622a020400b0034305c36317si2004905qtx.419.2022.08.12.11.09.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Aug 2022 11:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XXDwF3AV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMZ6Y-0003Rl-Rd for patch@linaro.org; Fri, 12 Aug 2022 14:09:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMZ4u-0003QE-RO for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:13 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:41976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMZ4t-0006Va-8W for qemu-devel@nongnu.org; Fri, 12 Aug 2022 14:08:12 -0400 Received: by mail-pj1-x102f.google.com with SMTP id t2-20020a17090a4e4200b001f21572f3a4so1618336pjl.0 for ; Fri, 12 Aug 2022 11:08:10 -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=ztH2KdOZugDOiuPkZQawXgA4F56Gwh34Y3mDIuElS7Y=; b=XXDwF3AVpMkv2acj3kyGy1RnPg84VCWAWGHvrqC6qvu9DnJISxEvpc7OKYin+mayR4 5Xh55GAKHxNLFCJj1a4Rq4Kepyi9N4ttsz68TX38P2GP1Hq1A3NXbnWzsN236Uw8xkMm e1sDS1RFcCNlrDHFL/gwZjEc2E81eWz7XV5JbiG7yy3lhrwXKcqe+Th/lN8jCfjFFtoK mV+Jvrttj3BvjFC8AHLuq81dSttBHw2WJ14O2PGSMN3Hu4FC/Jjy2Xcaka0x04EfOmWf 1us2x7yLxkLv0yEyrwhEnfCauqdW6tJFol1XgMF61DRxWL0FoEPSaWO4kXRZ6lxzouNk Ir2g== 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=ztH2KdOZugDOiuPkZQawXgA4F56Gwh34Y3mDIuElS7Y=; b=CtmfhCT+DKFD5KkOMLPRfsZZ5d+ZA2BOqgDdhcY/1bukGqT8UsJRFPBIDTP3MfXuSP 7fFm4IqhQnL4mrHLGShE3yQPFDYKpBiR3RDIlvhz7pAHXvnFHesJF8THHkI3gK5zJqdt PmtagARqZrNisUoQbzU4TIGEvKqoF3eREMzR9KxAlfM5ncyofEoolMTQL3vzKpNXv1t2 0qe3I/jBOsi0jCI+VW1jpsvOoJ9gz7xu64VlhOvTLvbElGxfbKgyMth/nDko6iK/n8v+ T2VbEPuv0VIWD/z2wQpJX3X66Df7Sypf9vD3uUBqiXr/7cX70ByOCNJwX48Mdqpd0xtu 984w== X-Gm-Message-State: ACgBeo16dnDjuE6s6DFZOU9YVh6SqjCagmZVI9g+NsGGr9NYCZYzgY+w ykwd0GWvX8htNan45AVzioyy/Tukx8KfTg== X-Received: by 2002:a17:902:c1c4:b0:171:38ab:e761 with SMTP id c4-20020a170902c1c400b0017138abe761mr5345086plc.65.1660327689639; Fri, 12 Aug 2022 11:08:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 11:08:08 -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 01/21] linux-user/arm: Mark the commpage executable Date: Fri, 12 Aug 2022 11:07:46 -0700 Message-Id: <20220812180806.2128593-2-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We're about to start validating PAGE_EXEC, which means that we've got to mark the commpage executable. We had been placing the commpage outside of reserved_va, which was incorrect and lead to an abort. Signed-off-by: Richard Henderson --- linux-user/arm/target_cpu.h | 4 ++-- linux-user/elfload.c | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index 709d19bc9e..89ba274cfc 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -34,9 +34,9 @@ static inline unsigned long arm_max_reserved_va(CPUState *cs) } else { /* * We need to be able to map the commpage. - * See validate_guest_space in linux-user/elfload.c. + * See init_guest_commpage in linux-user/elfload.c. */ - return 0xffff0000ul; + return 0xfffffffful; } } #define MAX_RESERVED_VA arm_max_reserved_va diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ce902dbd56..3e3dc02499 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -398,7 +398,8 @@ enum { static bool init_guest_commpage(void) { - void *want = g2h_untagged(HI_COMMPAGE & -qemu_host_page_size); + abi_ptr commpage = HI_COMMPAGE & -qemu_host_page_size; + void *want = g2h_untagged(commpage); void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); @@ -417,6 +418,9 @@ static bool init_guest_commpage(void) perror("Protecting guest commpage"); exit(EXIT_FAILURE); } + + page_set_flags(commpage, commpage + qemu_host_page_size, + PAGE_READ | PAGE_EXEC | PAGE_VALID); return true; }