On 6/20/22 20:56, gaosong wrote:
This is missing lock_user/unlock_user somewhere.
You can't use the double-underscore __get/__put_user without having done that.

My understanding is that the struct exctx need lock_user_struct/unlock_user_struct,  then we can use __get/__put the struct extctx.

No, extctx does not exist in target memory. It is purely local to the signal implementation as a way of tracking the layout.

This is why I suggested statically allocating the extra
pieces of the signal frame *on write*.  You obviously
cannot rely on the signal frame being identical on
signal return -- the guest is allowed to create any valid
context to give to rt_sigreturn.

I don’t know if my understanding is correct,

we can put the exctx or target_fpu_context into target_rt_sigframe, like this:
struct target_rt_sigframe {
     struct target_siginfo rs_info;
     struct target_ucontext rs_uc;
     struct extctx_layout rs_ext;
};

No.

You need to look at what the code in setup_extcontext does.
It allocates two sctx_info and one fpu_context on the stack.
Thus the structure would look like

struct target_rt_sigframe {
    struct target_siginfo rs_info;
    struct target_ucontext rs_uc;
    struct sctx_info rs_fpu_info QEMU_ALIGNED(16);
    struct target_fp_context rs_fpu;
    struct sctx_info rs_end_info QEMU_ALIGNED(16);
};


r~

Reply via email to