Skip to contentSkip to conversation

arm64: mte: fix prctl(PR_GET_TAGGED_ADDR_CTRL) if TCF0=NONE

PATCH Applied Peter Collingbourne 3 participants 3 messages Dec 3, 2020 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: mte: fix prctl(PR_GET_TAGGED_ADDR_CTRL) if TCF0=NONE

Previously we were always returning a tag inclusion mask of zero via PR_GET_TAGGED_ADDR_CTRL if TCF0 was set to NONE. Fix it by making the code for the NONE case match the others.

---
 arch/arm64/kernel/mte.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/mte.c +2 -1
index 52a0638ed967..ef15c8a2a49d 100644
@@ -189,7 +189,8 @@ long get_mte_ctrl(struct task_struct *task)
 
 	switch (task->thread.sctlr_tcf0) {
 	case SCTLR_EL1_TCF0_NONE:
-		return PR_MTE_TCF_NONE;
+		ret |= PR_MTE_TCF_NONE;
+		break;
 	case SCTLR_EL1_TCF0_SYNC:
 		ret |= PR_MTE_TCF_SYNC;
 		break;
Signature · 7 lines
2.29.2.454.gaff20da3a2-goog


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Peter Collingbourne

Previously we were always returning a tag inclusion mask of zero via PR_GET_TAGGED_ADDR_CTRL if TCF0 was set to NONE. Fix it by making the code for the NONE case match the others.

---
 arch/arm64/kernel/mte.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/mte.c +0 -0
index 52a0638ed967..ef15c8a2a49d 100644

arch/arm64/kernel/mte.c long get_mte_ctrl(struct task_struct *task) · line 196

Quoted 9 lines
arch/arm64/kernel/mte.c +2 -1
@@ -189,7 +189,8 @@ long get_mte_ctrl(struct task_struct *task)
 
 	switch (task->thread.sctlr_tcf0) {
 	case SCTLR_EL1_TCF0_NONE:
-		return PR_MTE_TCF_NONE;
+		ret |= PR_MTE_TCF_NONE;
+		break;
 	case SCTLR_EL1_TCF0_SYNC:
 		ret |= PR_MTE_TCF_SYNC;
 		break;

With a fixes tag:

Fixes af5ce95282dc ("arm64: mte: Allow user control of the generated random tags via prctl()")

Will, if you have another pull request for 5.10, please pick this up as well (it's an ABI fix so it would be nice to get it in the first release with MTE support). Otherwise I'll queue it at -rc1 and cc stable.

Thanks.

Signature · 6 lines
Catalin

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Applied
#2 lore raw
In reply to Peter Collingbourne
Quoted 3 lines · Peter Collingbourne

Previously we were always returning a tag inclusion mask of zero via PR_GET_TAGGED_ADDR_CTRL if TCF0 was set to NONE. Fix it by making the code for the NONE case match the others.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: mte: fix prctl(PR_GET_TAGGED_ADDR_CTRL) if TCF0=NONE

      https://git.kernel.org/arm64/c/929c1f3384d7

Cheers,

Signature · 10 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel