linux-user/aarch64: Fix SHADOW_STACK_SET_TOKEN
The token is not computed via TARGET_PAGE_SIZE, but via a fixed 12-bit field. Cc: qemu-stable@nongnu.org Fixes: ad1afe433fa ("linux-user/aarch64: Implement map_shadow_stack syscall") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4106 Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Helge Deller <deller@gmx.de>
Richard Henderson committed
Jul 29, 2026 at 12:17 UTC
8d0ac5933aa3476283c14680f165727268103fcd
1 file changed
+2
-1
linux-user/syscall.c
+2
-1
@@ -6900,7 +6900,8 @@ static abi_long do_map_shadow_stack(CPUArchState *env, abi_ulong addr,
6900
/* Leave an extra empty frame at top-of-stack. */
6901
cap_ptr -= 8;
6902
}
6903
- cap_val = (cap_ptr & TARGET_PAGE_MASK) | 1;
6903
+ /* Note the 12 bit field is unaffected by current page size. */
6904
+ cap_val = deposit64(cap_ptr, 0, 12, 1);
6905
if (put_user_u64(cap_val, cap_ptr)) {
6906
/* Allocation succeeded above. */
6907
g_assert_not_reached();