[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 23/26] tcg: Do not set guard pages in the rx buffer
From: |
Richard Henderson |
Subject: |
[PATCH 23/26] tcg: Do not set guard pages in the rx buffer |
Date: |
Wed, 10 Mar 2021 18:21:53 -0600 |
We only need guard pages in the rw buffer to avoid buffer overruns.
Let the rx buffer keep large pages all the way through.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/region.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/tcg/region.c b/tcg/region.c
index 7640aac243..93d03076d1 100644
--- a/tcg/region.c
+++ b/tcg/region.c
@@ -803,7 +803,6 @@ void tcg_region_init(size_t tb_size, int splitwx, unsigned
max_cpus)
size_t page_size;
size_t region_size;
size_t i;
- uintptr_t splitwx_diff;
int have_prot;
have_prot = alloc_code_gen_buffer(size_code_gen_buffer(tb_size),
@@ -845,8 +844,7 @@ void tcg_region_init(size_t tb_size, int splitwx, unsigned
max_cpus)
/* init the region struct */
qemu_mutex_init(®ion.lock);
- /* set guard pages */
- splitwx_diff = tcg_splitwx_diff;
+ /* Set guard pages. No need to do this for the rx_buf, only the rw_buf. */
for (i = 0; i < region.n; i++) {
void *start, *end;
int rc;
@@ -854,10 +852,6 @@ void tcg_region_init(size_t tb_size, int splitwx, unsigned
max_cpus)
tcg_region_bounds(i, &start, &end);
rc = qemu_mprotect_none(end, page_size);
g_assert(!rc);
- if (splitwx_diff) {
- rc = qemu_mprotect_none(end + splitwx_diff, page_size);
- g_assert(!rc);
- }
}
tcg_region_trees_init();
--
2.25.1
- [PATCH 14/26] accel/tcg: Pass down max_cpus to tcg_init, (continued)
- [PATCH 14/26] accel/tcg: Pass down max_cpus to tcg_init, Richard Henderson, 2021/03/10
- [PATCH 10/26] accel/tcg: Move alloc_code_gen_buffer to tcg/region.c, Richard Henderson, 2021/03/10
- [PATCH 18/26] tcg: Tidy tcg_n_regions, Richard Henderson, 2021/03/10
- [PATCH 17/26] tcg: Replace region.end with region.total_size, Richard Henderson, 2021/03/10
- [PATCH 19/26] tcg: Tidy split_cross_256mb, Richard Henderson, 2021/03/10
- [PATCH 16/26] tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h, Richard Henderson, 2021/03/10
- [PATCH 13/26] accel/tcg: Merge tcg_exec_init into tcg_init_machine, Richard Henderson, 2021/03/10
- [PATCH 23/26] tcg: Do not set guard pages in the rx buffer,
Richard Henderson <=
- [PATCH 21/26] tcg: Return the map protection from alloc_code_gen_buffer, Richard Henderson, 2021/03/10
- [PATCH 20/26] tcg: Allocate code_gen_buffer into struct tcg_region_state, Richard Henderson, 2021/03/10
- [PATCH 22/26] tcg: Sink qemu_madvise call to common code, Richard Henderson, 2021/03/10
- [PATCH 15/26] tcg: Introduce tcg_max_ctxs, Richard Henderson, 2021/03/10
- [PATCH 25/26] tcg: Merge buffer protection and guard page protection, Richard Henderson, 2021/03/10
- [PATCH 24/26] util/osdep: Add qemu_mprotect_rw, Richard Henderson, 2021/03/10
- [PATCH 26/26] tcg: When allocating for !splitwx, begin with PROT_NONE, Richard Henderson, 2021/03/10
- Re: [PATCH 00/26] tcg: Workaround macOS 11.2 mprotect bug, no-reply, 2021/03/10