|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [PATCH v4 24/26] tcg: Allocate a guard page after code_gen_buffer |
Date: | Thu, 1 Oct 2015 06:01:24 +1000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 10/01/2015 02:33 AM, Aurelien Jarno wrote:
On 2015-09-30 15:09, Richard Henderson wrote:This will catch any overflow of the buffer. Add a native win32 alternative for alloc_code_gen_buffer; remove the malloc alternative. Signed-off-by: Richard Henderson <address@hidden> --- translate-all.c | 210 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 119 insertions(+), 91 deletions(-)I havent reviewed the patch in details, but I wonder if that could really happen? Given the size of the code generation buffer (a few MB at least), I don't think it's a problem if we don't use it to the last kB, and thus we could keep some safe margin if needed.
I don't believe that it can happen at the moment, given the size of the current "safe margin". But the subject came up during review, and I thought we should indeed do something about it.
Also what happens if an overflow really happens? In softmmu mode a segmentation fault will happen. In user-mode I guess the fault will be forwarded to the guest process, so this will likely wrongly be interpreted as a bug in the guest code.
You're right. I had thought that we tested page_check_range on the given address in user-mode before passing it on to the guest.
In any case, that's how to fix the problem you indicate... r~
[Prev in Thread] | Current Thread | [Next in Thread] |