[PATCH] linux-user/aarch64: Add padding before __kernel_rt_sigreturn

Richard Henderson posted 1 patch 9 months, 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240202034427.504686-1-richard.henderson@linaro.org
Maintainers: Laurent Vivier <laurent@vivier.eu>
There is a newer version of this series
linux-user/aarch64/vdso-be.so | Bin 3216 -> 3224 bytes
linux-user/aarch64/vdso-le.so | Bin 3216 -> 3224 bytes
linux-user/aarch64/vdso.S     |   4 ++++
3 files changed, 4 insertions(+)
[PATCH] linux-user/aarch64: Add padding before __kernel_rt_sigreturn
Posted by Richard Henderson 9 months, 4 weeks ago
Without this padding, an unwind through the signal handler
will pick up the unwind info for the preceding syscall.

This fixes gcc's 30_threads/thread/native_handle/cancel.cc.

Cc: qemu-stable@nongnu.org
Fixes: ee95fae075c6 ("linux-user/aarch64: Add vdso")
Resolves: https://linaro.atlassian.net/browse/GNU-974
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/aarch64/vdso-be.so | Bin 3216 -> 3224 bytes
 linux-user/aarch64/vdso-le.so | Bin 3216 -> 3224 bytes
 linux-user/aarch64/vdso.S     |   4 ++++
 3 files changed, 4 insertions(+)

diff --git a/linux-user/aarch64/vdso-be.so b/linux-user/aarch64/vdso-be.so
index 6084f3d1a701316004894fcdd739c4e1e0463b68..808206ade824b09d786f6cc34f7cddf80b63130e 100755
GIT binary patch
delta 121
zcmbOrIYV-SKI4pu2Kk&{7{Gw#%fuBAMC1c?^>~k}v|avdxNjSSLfftVb3bgJ!|2S&
z_-6A1CJrVZc?IUH8G;R$7#SF@Om<{a*v!K!&BXX-vIe^~TWO|cva$K*Om;sOMw`hy
ZxXl@VO#Z-a&zLdUfXALuXmSCM0s#EKC)of1

delta 116
zcmbOsIYDxQKI4Rm2Kk&H7{Gw#!^9O2L>8U?-5V_M@!kH(Sx4vJn|*ujLPgija~Pc&
z8DDIEz{J5c`3;N8W)W6tCdL<&4cM*OEF8_<v%@zRviq?xT1-B`ZO-^%@(*r%#)Qch
RJocPi5ThAdCO2?N002V6C;<Qf

diff --git a/linux-user/aarch64/vdso-le.so b/linux-user/aarch64/vdso-le.so
index 947d534ec1899740edbd6921da6bc6e70e2ecd09..941aaf29931193300de1f62097867c282a7e0c74 100755
GIT binary patch
delta 129
zcmbOrIYV-S2IGv0n)#exSQx<I%fyAxMZTVBQ(04AP_*V|Vxp|@=@;x8zb9;-!)U|E
z_-6A>CVnO!c?IUH8G;R$7#SF@Om<{a*v!K!!o>JyvLd?^n`3BUW_royOm=q`Mw`hS
dxy>1WOn%92&zLb;lgFM@hy!9z%j7~Xc>tTxDQW-!

delta 108
zcmbOsIYDxQ2IGW@n)#d`SQx<I!^DNpMK&+G&+g_}w9WI@dn@@euKVesZ-h6`VYFdn
ze6jf^6F<}BH!LcfMOa0c7+*}*WOrgKEO1Fl%G+GX?#{w!F?lDqIpc@PAGz%r6DAw-
M*fVlXF62=M06owo?*IS*

diff --git a/linux-user/aarch64/vdso.S b/linux-user/aarch64/vdso.S
index 34d3a9ebd2..a0ac1487b0 100644
--- a/linux-user/aarch64/vdso.S
+++ b/linux-user/aarch64/vdso.S
@@ -63,7 +63,11 @@ vdso_syscall __kernel_clock_getres, __NR_clock_getres
  * For now, elide the unwind info for __kernel_rt_sigreturn and rely on
  * the libgcc fallback routine as we have always done.  This requires
  * that the code sequence used be exact.
+ *
+ * Add a nop as a spacer to ensure that unwind does not pick up the
+ * unwind info from the preceding syscall.
  */
+	nop
 __kernel_rt_sigreturn:
 	/* No BTI C insn here -- we arrive via RET. */
 	mov	x8, #__NR_rt_sigreturn
-- 
2.34.1
Re: [PATCH] linux-user/aarch64: Add padding before __kernel_rt_sigreturn
Posted by Alex Bennée 9 months, 3 weeks ago
Richard Henderson <richard.henderson@linaro.org> writes:

> Without this padding, an unwind through the signal handler
> will pick up the unwind info for the preceding syscall.
>
> This fixes gcc's 30_threads/thread/native_handle/cancel.cc.
>
> Cc: qemu-stable@nongnu.org
> Fixes: ee95fae075c6 ("linux-user/aarch64: Add vdso")
> Resolves: https://linaro.atlassian.net/browse/GNU-974
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/aarch64/vdso-be.so | Bin 3216 -> 3224 bytes
>  linux-user/aarch64/vdso-le.so | Bin 3216 -> 3224 bytes
>  linux-user/aarch64/vdso.S     |   4 ++++
>  3 files changed, 4 insertions(+)
>
> diff --git a/linux-user/aarch64/vdso-be.so b/linux-user/aarch64/vdso-be.so
> index 6084f3d1a701316004894fcdd739c4e1e0463b68..808206ade824b09d786f6cc34f7cddf80b63130e 100755
> GIT binary patch
> delta 121
> zcmbOrIYV-SKI4pu2Kk&{7{Gw#%fuBAMC1c?^>~k}v|avdxNjSSLfftVb3bgJ!|2S&
> z_-6A1CJrVZc?IUH8G;R$7#SF@Om<{a*v!K!&BXX-vIe^~TWO|cva$K*Om;sOMw`hy
> ZxXl@VO#Z-a&zLdUfXALuXmSCM0s#EKC)of1
>
> delta 116
> zcmbOsIYDxQKI4Rm2Kk&H7{Gw#!^9O2L>8U?-5V_M@!kH(Sx4vJn|*ujLPgija~Pc&
> z8DDIEz{J5c`3;N8W)W6tCdL<&4cM*OEF8_<v%@zRviq?xT1-B`ZO-^%@(*r%#)Qch
> RJocPi5ThAdCO2?N002V6C;<Qf
>
> diff --git a/linux-user/aarch64/vdso-le.so b/linux-user/aarch64/vdso-le.so
> index 947d534ec1899740edbd6921da6bc6e70e2ecd09..941aaf29931193300de1f62097867c282a7e0c74 100755
> GIT binary patch
> delta 129
> zcmbOrIYV-S2IGv0n)#exSQx<I%fyAxMZTVBQ(04AP_*V|Vxp|@=@;x8zb9;-!)U|E
> z_-6A>CVnO!c?IUH8G;R$7#SF@Om<{a*v!K!!o>JyvLd?^n`3BUW_royOm=q`Mw`hS
> dxy>1WOn%92&zLb;lgFM@hy!9z%j7~Xc>tTxDQW-!
>
> delta 108
> zcmbOsIYDxQ2IGW@n)#d`SQx<I!^DNpMK&+G&+g_}w9WI@dn@@euKVesZ-h6`VYFdn
> ze6jf^6F<}BH!LcfMOa0c7+*}*WOrgKEO1Fl%G+GX?#{w!F?lDqIpc@PAGz%r6DAw-
> M*fVlXF62=M06owo?*IS*
>
> diff --git a/linux-user/aarch64/vdso.S b/linux-user/aarch64/vdso.S
> index 34d3a9ebd2..a0ac1487b0 100644
> --- a/linux-user/aarch64/vdso.S
> +++ b/linux-user/aarch64/vdso.S
> @@ -63,7 +63,11 @@ vdso_syscall __kernel_clock_getres, __NR_clock_getres
>   * For now, elide the unwind info for __kernel_rt_sigreturn and rely on
>   * the libgcc fallback routine as we have always done.  This requires
>   * that the code sequence used be exact.
> + *
> + * Add a nop as a spacer to ensure that unwind does not pick up the
> + * unwind info from the preceding syscall.
>   */
> +	nop
>  __kernel_rt_sigreturn:
>  	/* No BTI C insn here -- we arrive via RET. */
>  	mov	x8, #__NR_rt_sigreturn

You could have gone the whole hog and done:

  nop	// Mysterious NOP

like the kernel does ;-)

Anyway:

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

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro