Skip to contentSkip to conversation

Patch "arm64: futex.h: Add missing PAN toggling" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Dec 13, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm64: futex.h: Add missing PAN toggling

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm64-futex.h-add-missing-pan-toggling.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 811d61e384e24759372bb3f01772f3744b0a8327 Mon Sep 17 00:00:00 2001

From: James Morse <[email protected]>
Date: Tue, 2 Feb 2016 15:53:59 +0000
Subject: arm64: futex.h: Add missing PAN toggling

From: James Morse <[email protected]>

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 338d4f49d6f ("arm64: kernel: Add support for Privileged Access Never")
Cc Mian Yousaf Kaukab <[email protected]>
---
 arch/arm64/include/asm/futex.h |    2 ++
 1 file changed, 2 insertions(+)
arch/arm64/include/asm/futex.h +2 -0
@@ -121,6 +121,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
 		return -EFAULT;
 
 	asm volatile("// futex_atomic_cmpxchg_inatomic\n"
+ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
 "	prfm	pstl1strm, %2\n"
 "1:	ldxr	%w1, %2\n"
 "	sub	%w3, %w1, %w4\n"
@@ -137,6 +138,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
 "	.align	3\n"
 "	.quad	1b, 4b, 2b, 4b\n"
 "	.popsection\n"
+ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
 	: "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp)
 	: "r" (oldval), "r" (newval), "Ir" (-EFAULT)
 	: "memory");

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/arm64-futex.h-add-missing-pan-toggling.patch