Skip to content

Commit 55e15b2

Browse files
James Morsegregkh
authored andcommitted
arm64: futex.h: Add missing PAN toggling
commit 811d61e384e24759372bb3f01772f3744b0a8327 upstream. futex.h's futex_atomic_cmpxchg_inatomic() does not use the __futex_atomic_op() macro and needs its own PAN toggling. This was missed when the feature was implemented. Fixes: 338d4f4 ("arm64: kernel: Add support for Privileged Access Never") Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Cc: Mian Yousaf Kaukab <yousaf.kaukab@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e29949e commit 55e15b2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/arm64/include/asm/futex.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
121121
return -EFAULT;
122122

123123
asm volatile("// futex_atomic_cmpxchg_inatomic\n"
124+
ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
124125
" prfm pstl1strm, %2\n"
125126
"1: ldxr %w1, %2\n"
126127
" sub %w3, %w1, %w4\n"
@@ -137,6 +138,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
137138
" .align 3\n"
138139
" .quad 1b, 4b, 2b, 4b\n"
139140
" .popsection\n"
141+
ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
140142
: "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp)
141143
: "r" (oldval), "r" (newval), "Ir" (-EFAULT)
142144
: "memory");

0 commit comments

Comments
 (0)