diff mbox series

[v9,1/5] linux-user/aarch64: Reset btype for signals

Message ID 20200520172800.8499-2-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user: User support for AArch64 BTI | expand

Commit Message

Richard Henderson May 20, 2020, 5:27 p.m. UTC
The kernel sets btype for the signal handler as if for a call.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 linux-user/aarch64/signal.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Peter Maydell July 6, 2020, 11:02 a.m. UTC | #1
On Wed, 20 May 2020 at 18:28, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> The kernel sets btype for the signal handler as if for a call.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  linux-user/aarch64/signal.c | 10 ++++++++--

>  1 file changed, 8 insertions(+), 2 deletions(-)

>

> diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c

> index cd521ee42d..2c596a7088 100644

> --- a/linux-user/aarch64/signal.c

> +++ b/linux-user/aarch64/signal.c

> @@ -506,10 +506,16 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,

>              + offsetof(struct target_rt_frame_record, tramp);

>      }

>      env->xregs[0] = usig;

> -    env->xregs[31] = frame_addr;

>      env->xregs[29] = frame_addr + fr_ofs;

> -    env->pc = ka->_sa_handler;

>      env->xregs[30] = return_addr;

> +    env->xregs[31] = frame_addr;

> +    env->pc = ka->_sa_handler;

> +

> +    /* Invoke the signal handler as if by indirect call.  */

> +    if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {

> +        env->btype = 2;

> +    }

> +


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
diff mbox series

Patch

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index cd521ee42d..2c596a7088 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -506,10 +506,16 @@  static void target_setup_frame(int usig, struct target_sigaction *ka,
             + offsetof(struct target_rt_frame_record, tramp);
     }
     env->xregs[0] = usig;
-    env->xregs[31] = frame_addr;
     env->xregs[29] = frame_addr + fr_ofs;
-    env->pc = ka->_sa_handler;
     env->xregs[30] = return_addr;
+    env->xregs[31] = frame_addr;
+    env->pc = ka->_sa_handler;
+
+    /* Invoke the signal handler as if by indirect call.  */
+    if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
+        env->btype = 2;
+    }
+
     if (info) {
         tswap_siginfo(&frame->info, info);
         env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info);