From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Roman Bolshakov <r.bolshakov@yadro.com>
Subject: [PULL 2/5] tcg: Workaround macOS 11.2 mprotect bug
Date: Tue, 23 Mar 2021 19:43:29 -0600 [thread overview]
Message-ID: <20210324014332.6331-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210324014332.6331-1-richard.henderson@linaro.org>
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 <richard.henderson@linaro.org>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
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(-)
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();
--
2.25.1
next prev parent reply other threads:[~2021-03-24 1:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 1:43 [PULL 0/5] tcg patch queue for 6.0 Richard Henderson
2021-03-24 1:43 ` [PULL 1/5] tcg: Do not set guard pages on the rx portion of code_gen_buffer Richard Henderson
2021-03-24 1:43 ` Richard Henderson [this message]
2021-03-24 1:43 ` [PULL 3/5] exec: Rename exec-vary.c as page-vary.c Richard Henderson
2021-03-24 1:43 ` [PULL 4/5] exec: Extract 'page-vary.h' header Richard Henderson
2021-03-24 1:43 ` [PULL 5/5] exec: Build page-vary-common.c with -fno-lto Richard Henderson
2021-03-24 13:22 ` [PULL 0/5] tcg patch queue for 6.0 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210324014332.6331-3-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).