qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd()
@ 2022-06-24 15:02 Shaobo Song
  2022-06-25 16:32 ` Alex Bennée
  2022-06-26 10:49 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Shaobo Song @ 2022-06-24 15:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson, Shaobo Song

 This fixes a bug in POSIX-compliant environments. Since we had allocated 
 a buffer named 'tcg-jit' with read-write access protections we need a int 
 type to combine these access flags and return it, whereas we had inexplicably 
 return a bool type. It may cause an unnecessary protection change in 
 tcg_region_init().

Signed-off-by: Shaobo Song <shnusongshaobo@gmail.com>
---
 tcg/region.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/region.c b/tcg/region.c
index 71ea81d671..88d6bb273f 100644
--- a/tcg/region.c
+++ b/tcg/region.c
@@ -548,7 +548,7 @@ static int alloc_code_gen_buffer_anon(size_t size, int prot,
 #ifdef CONFIG_POSIX
 #include "qemu/memfd.h"
 
-static bool alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp)
+static int alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp)
 {
     void *buf_rw = NULL, *buf_rx = MAP_FAILED;
     int fd = -1;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd()
  2022-06-24 15:02 [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd() Shaobo Song
@ 2022-06-25 16:32 ` Alex Bennée
  2022-06-26 10:49 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2022-06-25 16:32 UTC (permalink / raw)
  To: Shaobo Song; +Cc: richard.henderson, qemu-devel


Shaobo Song <shnusongshaobo@gmail.com> writes:

>  This fixes a bug in POSIX-compliant environments. Since we had allocated 
>  a buffer named 'tcg-jit' with read-write access protections we need a int 
>  type to combine these access flags and return it, whereas we had inexplicably 
>  return a bool type. It may cause an unnecessary protection change in 
>  tcg_region_init().
>
> Signed-off-by: Shaobo Song <shnusongshaobo@gmail.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd()
  2022-06-24 15:02 [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd() Shaobo Song
  2022-06-25 16:32 ` Alex Bennée
@ 2022-06-26 10:49 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-06-26 10:49 UTC (permalink / raw)
  To: Shaobo Song, qemu-devel

On 6/24/22 20:32, Shaobo Song wrote:
>   This fixes a bug in POSIX-compliant environments. Since we had allocated
>   a buffer named 'tcg-jit' with read-write access protections we need a int
>   type to combine these access flags and return it, whereas we had inexplicably
>   return a bool type. It may cause an unnecessary protection change in
>   tcg_region_init().
> 
> Signed-off-by: Shaobo Song <shnusongshaobo@gmail.com>
> ---
>   tcg/region.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tcg/region.c b/tcg/region.c
> index 71ea81d671..88d6bb273f 100644
> --- a/tcg/region.c
> +++ b/tcg/region.c
> @@ -548,7 +548,7 @@ static int alloc_code_gen_buffer_anon(size_t size, int prot,
>   #ifdef CONFIG_POSIX
>   #include "qemu/memfd.h"
>   
> -static bool alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp)
> +static int alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp)
>   {
>       void *buf_rw = NULL, *buf_rx = MAP_FAILED;
>       int fd = -1;

Thanks, queued to tcg-next.


r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-26 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24 15:02 [PATCH] tcg: Fix returned type in alloc_code_gen_buffer_splitwx_memfd() Shaobo Song
2022-06-25 16:32 ` Alex Bennée
2022-06-26 10:49 ` Richard Henderson

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).