Re: [PATCH v3 16/41] accel/tcg: Support split-wx for darwin/iOS with vm_remap

2020-11-10 Thread Joelle van Dyne
FWIW, it's a syscall that's been around for as long as I can remember.
In macOS 11 they added a new mach_vm_remap but kept the old one for
compatibility so I don't think it's going away any time soon.

-j

On Tue, Nov 10, 2020 at 9:37 AM Alex Bennée  wrote:
>
>
> Richard Henderson  writes:
>
> > Cribbed from code posted by Joelle van Dyne ,
> > and rearranged to a cleaner structure.  Completely untested.
> >
> > Signed-off-by: Richard Henderson 
> > ---
> >  accel/tcg/translate-all.c | 65 +++
> >  1 file changed, 65 insertions(+)
> >
> > diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> > index 1931e65365..17df6c94fa 100644
> > --- a/accel/tcg/translate-all.c
> > +++ b/accel/tcg/translate-all.c
> > @@ -1166,9 +1166,71 @@ static bool 
> > alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp)
> >  }
> >  #endif /* CONFIG_POSIX */
> >
> > +#ifdef CONFIG_DARWIN
> > +#include 
> > +
> > +extern kern_return_t mach_vm_remap(vm_map_t target_task,
> > +   mach_vm_address_t *target_address,
> > +   mach_vm_size_t size,
> > +   mach_vm_offset_t mask,
> > +   int flags,
> > +   vm_map_t src_task,
> > +   mach_vm_address_t src_address,
> > +   boolean_t copy,
> > +   vm_prot_t *cur_protection,
> > +   vm_prot_t *max_protection,
> > +   vm_inherit_t inheritance);
>
> Our checkpatch really doesn't like the extern being dropped in here but
> having grepped the xnu source I'm not sure we have a choice. I'm curious
> how stable the function might be given it's not in a published header.
>
> --
> Alex Bennée



Re: [PATCH v3 16/41] accel/tcg: Support split-wx for darwin/iOS with vm_remap

2020-11-10 Thread Alex Bennée


Richard Henderson  writes:

> Cribbed from code posted by Joelle van Dyne ,
> and rearranged to a cleaner structure.  Completely untested.
>
> Signed-off-by: Richard Henderson 
> ---
>  accel/tcg/translate-all.c | 65 +++
>  1 file changed, 65 insertions(+)
>
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 1931e65365..17df6c94fa 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -1166,9 +1166,71 @@ static bool alloc_code_gen_buffer_splitwx_memfd(size_t 
> size, Error **errp)
>  }
>  #endif /* CONFIG_POSIX */
>  
> +#ifdef CONFIG_DARWIN
> +#include 
> +
> +extern kern_return_t mach_vm_remap(vm_map_t target_task,
> +   mach_vm_address_t *target_address,
> +   mach_vm_size_t size,
> +   mach_vm_offset_t mask,
> +   int flags,
> +   vm_map_t src_task,
> +   mach_vm_address_t src_address,
> +   boolean_t copy,
> +   vm_prot_t *cur_protection,
> +   vm_prot_t *max_protection,
> +   vm_inherit_t inheritance);

Our checkpatch really doesn't like the extern being dropped in here but
having grepped the xnu source I'm not sure we have a choice. I'm curious
how stable the function might be given it's not in a published header.

-- 
Alex Bennée



Re: [PATCH v3 16/41] accel/tcg: Support split-wx for darwin/iOS with vm_remap

2020-11-07 Thread Joelle van Dyne
On Thu, Nov 5, 2020 at 7:29 PM Richard Henderson
 wrote:
>
> Cribbed from code posted by Joelle van Dyne ,
> and rearranged to a cleaner structure.  Completely untested.
>
> Signed-off-by: Richard Henderson 

Reviewed-by: Joelle van Dyne