diff options
| author | Richard Henderson | 2021-03-20 17:57:20 +0100 |
|---|---|---|
| committer | Richard Henderson | 2021-03-24 02:36:36 +0100 |
| commit | c118881ee607dcac661b89893de07cbcbaeb304c (patch) | |
| tree | 92282f1f0f8f4b37b7e8d2ea79441041c784bb1d /tcg | |
| parent | tcg: Do not set guard pages on the rx portion of code_gen_buffer (diff) | |
| download | qemu-c118881ee607dcac661b89893de07cbcbaeb304c.tar.gz qemu-c118881ee607dcac661b89893de07cbcbaeb304c.tar.xz qemu-c118881ee607dcac661b89893de07cbcbaeb304c.zip | |
tcg: Workaround macOS 11.2 mprotect bug
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>
Diffstat (limited to 'tcg')
| -rw-r--r-- | tcg/tcg.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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(); |
