From patchwork Wed Mar 24 01:43:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 407786 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp19740jai; Tue, 23 Mar 2021 18:53:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoP1yh8qDx5sGeHUyjav3FJpJrLcyY0ZH+smUCIB2HsQ6qG9eEruey8NGJuPiLDtHHgVLa X-Received: by 2002:a02:aa92:: with SMTP id u18mr750551jai.119.1616550832793; Tue, 23 Mar 2021 18:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616550832; cv=none; d=google.com; s=arc-20160816; b=zhYjzqG1A+aeA3+9saYxxKU4Um97/49eNMmKcd5jqb4VXNLBDMN+PpJ4HGfgh/X0PF O84EY0a5fBkQ7B7DChME3DEvwXdgh4egBqaMHTENMO4pm/LI94lxTsSlGP9GkynNWb2p iaAoHaXmTYXWpDemmd2LCUJXWbuBubJrwFM99cUiZWuv+XU79U0pkSBqW2Kx5gkzIXpC 59KnhrbnySvQTKSAd4ixhHa90fY5VDtVwkF9Qx4b+6MbaaIxW5Akd0i1iKSbzwNGxWna e08P8eQ8k5Ngri3KpqT/qJwDON8I9zmBWkzEXwxBOks5tJbmp218OycWwYWByEfbaDnS KEOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=DsSc9dreF6wvzxcw7uDCKMSE3jEvXRT6fQS54ICyVMQ=; b=Rndv7rP5+g16jVP/4Wc1irOpsW6t6+Vlg8WkTpT2zSXC+cFZAfmqz2kby8VNnFMyCD SKXe5wJMrH/y4VBwnhr9K0ohRNJmmlUIIpkmDekr54D5arF+YnFJKjDb6GqdA46qpZqm yRbyPUTwgUmXIttMTuhEP7MGTHiGaGKa5jr8PA6sEG1fqQhi8Mxdz+Ewqehn6ACJStqV i/b90tS3pu5TpQAwkVzs+b6ukZMd8/myJ/YLUOdc1WfxTIbUDAFCSEhRTL+IOU/KBaUr acHC+HuubRYJqgnhtB3ziGsVKpllYG2o+x1QO1MmGGNCQG2IO+6KCxHvj9ew2vsvIPyL L7ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T5qC0n9b; 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 i13si675039ilm.103.2021.03.23.18.53.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Mar 2021 18:53:52 -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=T5qC0n9b; 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]:38486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOsiW-0004w3-7C for patch@linaro.org; Tue, 23 Mar 2021 21:53:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOsYl-0005xL-RW for qemu-devel@nongnu.org; Tue, 23 Mar 2021 21:43:49 -0400 Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]:42558) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOsYb-0005if-SX for qemu-devel@nongnu.org; Tue, 23 Mar 2021 21:43:45 -0400 Received: by mail-oo1-xc35.google.com with SMTP id h3-20020a4ae8c30000b02901b68b39e2d3so5430782ooe.9 for ; Tue, 23 Mar 2021 18:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DsSc9dreF6wvzxcw7uDCKMSE3jEvXRT6fQS54ICyVMQ=; b=T5qC0n9bxBGVWypiYHvESuCH1PHIqjSyxIF5fx4XGmlLmF5Jd8/iA+P+PF3zSyn5TA V9IId+sDI3JxGbrw/QyaN9XjINMc3c+uStWVndiZHx7BvA1Kq0svS8qawxS5DUoAOZiw ukhdp1jbCjQV9aQ2qLf1bibWF0r5gvyD7YqMucRDhIk7dFUQzbg90Og777y6L7P3iWKr M0yYWJqUvgXW5MjvpsJM+NPIApBuL6ADn5aXLvMLJk+5iLInJTlTd5geJAcfaA7Vvyrk y7XoHXPTvniw0nVDSRZBuSJ465WfhrHfyK5/yQCVHRyrub+gzS4panKUisI7kfsx1S1d jHPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DsSc9dreF6wvzxcw7uDCKMSE3jEvXRT6fQS54ICyVMQ=; b=Lia7KV9YyugDdC2W8B1LVXYLITbSsZSFKkbq6PzBDB2F1MGGlFmyztLUTie01/SRIW fRvJgc8FGgqX4Cj0T1JeC4YS2xX1qnE2yZYLydlSJOhkzlMB4GsFZEZBPOfH4/RExuWZ 8CmRi5GLj5yuJErye2k5+qalilNcbnOCNw86iy+8ogRnG00s+zqYzPJt0ZH2dkpwg528 SYNSTEjUguWgifAkRn1iz5CRtp6IerE02XYA+YDOJB7nULX5BxP0D5VfXv/kLDgVD8au wcqj0RkSAmrR3ZaJ/90VwVGZXlveXz7OQ1CoYh/CDrCzhRAz9lomeVkikv3jj0Co3ZP0 RPGQ== X-Gm-Message-State: AOAM531WZewlepSl3DRFn+MxaCq58GAiZYPcR6SZFsLvYa0ls0cIWjFO ni1EVfF8bhl/I+Eviz7zH98ctzpcxPKuueHp X-Received: by 2002:a4a:6b44:: with SMTP id h4mr701736oof.38.1616550215886; Tue, 23 Mar 2021 18:43:35 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id c9sm203601ooq.31.2021.03.23.18.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 18:43:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/5] tcg: Workaround macOS 11.2 mprotect bug Date: Tue, 23 Mar 2021 19:43:29 -0600 Message-Id: <20210324014332.6331-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324014332.6331-1-richard.henderson@linaro.org> References: <20210324014332.6331-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c35; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc35.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 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@linaro.org, Roman Bolshakov Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There's a change in mprotect() behaviour [1] in the latest macOS on M1 and it's not yet clear if it's going to be fixed by Apple. As a short-term fix, ignore failures setting up the guard pages. [1] https://gist.github.com/hikalium/75ae822466ee4da13cbbe486498a191f Signed-off-by: Richard Henderson Tested-by: Roman Bolshakov Reviewed-by: Roman Bolshakov Buglink: https://bugs.launchpad.net/qemu/+bug/1914849 Message-Id: <20210320165720.1813545-3-richard.henderson@linaro.org> --- tcg/tcg.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 88c9e6f8a4..1fbe0b686d 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -864,11 +864,15 @@ void tcg_region_init(void) */ for (i = 0; i < region.n; i++) { void *start, *end; - int rc; tcg_region_bounds(i, &start, &end); - rc = qemu_mprotect_none(end, page_size); - g_assert(!rc); + + /* + * macOS 11.2 has a bug (Apple Feedback FB8994773) in which mprotect + * rejects a permission change from RWX -> NONE. Guard pages are + * nice for bug detection but are not essential; ignore any failure. + */ + (void)qemu_mprotect_none(end, page_size); } tcg_region_trees_init();