Skip to contentSkip to conversation

x86/entry: A couple of small fixes

PATCH Applied Thomas Gleixner 4 participants 9 messages Jul 8, 2020 – Jul 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover x86/entry: A couple of small fixes

- Syzbot reported a missing local_irq_disable() in exc_alignment_check()
- A missing noinstr annotation
- Make a function static which is not longer used from ASM code

Thanks,

tglx

#1 lore raw

PATCH 1/3 x86/traps: Disable interrupts in exc_aligment_check()

exc_alignment_check() fails to disable interrupts before returning to the entry code.

Fixes ca4c6a9858c2 ("x86/traps: Make interrupt enable/disable symmetric in C code")
Reported-by [email protected]
---
 arch/x86/kernel/traps.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/traps.c +2 -0
@@ -303,6 +303,8 @@ DEFINE_IDTENTRY_ERRORCODE(exc_alignment_
 
 	do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs,
 		error_code, BUS_ADRALN, NULL);
+
+	local_irq_disable();
 }
 
 #ifdef CONFIG_VMAP_STACK
#2 lore raw

[tip: x86/urgent] x86/traps: Disable interrupts in exc_aligment_check()

The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     bce9b042ec73e8662b8119d4ca47e7c78b20d0bf
Gitweb:        https://git.kernel.org/tip/bce9b042ec73e8662b8119d4ca47e7c78b20d0bf
Author:        Thomas Gleixner <[email protected]>
AuthorDate:    Wed, 08 Jul 2020 21:28:05 +02:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 09 Jul 2020 11:18:29 +02:00

x86/traps: Disable interrupts in exc_aligment_check()

exc_alignment_check() fails to disable interrupts before returning to the entry code.

Fixes ca4c6a9858c2 ("x86/traps: Make interrupt enable/disable symmetric in C code")
Reported-by [email protected]
---
 arch/x86/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/traps.c +2 -0
index 6ed8cc5..4f3a509 100644
@@ -299,6 +299,8 @@ DEFINE_IDTENTRY_ERRORCODE(exc_alignment_check)
 
 	do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs,
 		error_code, BUS_ADRALN, NULL);
+
+	local_irq_disable();
 }
 
 #ifdef CONFIG_VMAP_STACK
#3 lore raw

PATCH 2/3 x86/entry: Mark check_user_regs() noinstr

In reply to Thomas Gleixner

It's called from the non-instrumentable section.

Fixes c9c26150e61d ("x86/entry: Assert that syscalls are on the right stack")
---
 arch/x86/entry/common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/common.c +1 -1
@@ -46,7 +46,7 @@
 #include <trace/events/syscalls.h>
 
 /* Check that the stack and regs on entry from user mode are sane. */
-static void check_user_regs(struct pt_regs *regs)
+static noinstr void check_user_regs(struct pt_regs *regs)
 {
 	if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) {
 		/*
#4 lore raw

[tip: x86/urgent] x86/entry: Mark check_user_regs() noinstr

The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     006e1ced516d2bfd9db63a32b5dba3c2abf43b04
Gitweb:        https://git.kernel.org/tip/006e1ced516d2bfd9db63a32b5dba3c2abf43b04
Author:        Thomas Gleixner <[email protected]>
AuthorDate:    Wed, 08 Jul 2020 21:28:06 +02:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 09 Jul 2020 11:18:29 +02:00

x86/entry: Mark check_user_regs() noinstr

It's called from the non-instrumentable section.

Fixes c9c26150e61d ("x86/entry: Assert that syscalls are on the right stack")
---
 arch/x86/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/common.c +1 -1
index e83b3f1..ea7b515 100644
@@ -46,7 +46,7 @@
 #include <trace/events/syscalls.h>
 
 /* Check that the stack and regs on entry from user mode are sane. */
-static void check_user_regs(struct pt_regs *regs)
+static noinstr void check_user_regs(struct pt_regs *regs)
 {
 	if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) {
 		/*
#5 lore raw

PATCH 3/3 x86/entry/common: Make prepare_exit_to_usermode() static

In reply to Thomas Gleixner

No users outside this file anymore.

---
 arch/x86/entry/common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/common.c +1 -1
@@ -294,7 +294,7 @@ static void __prepare_exit_to_usermode(s
 #endif
 }
 
-__visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
+static noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
 {
 	instrumentation_begin();
 	__prepare_exit_to_usermode(regs);
#6 lore raw

[tip: x86/urgent] x86/entry/common: Make prepare_exit_to_usermode() static

The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     bd87e6f6610aa96fde01ee6653e162213f7ec836
Gitweb:        https://git.kernel.org/tip/bd87e6f6610aa96fde01ee6653e162213f7ec836
Author:        Thomas Gleixner <[email protected]>
AuthorDate:    Wed, 08 Jul 2020 21:28:07 +02:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 09 Jul 2020 11:18:30 +02:00

x86/entry/common: Make prepare_exit_to_usermode() static

No users outside this file anymore.

---
 arch/x86/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/common.c +1 -1
index ea7b515..f092884 100644
@@ -294,7 +294,7 @@ static void __prepare_exit_to_usermode(struct pt_regs *regs)
 #endif
 }
 
-__visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
+static noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
 {
 	instrumentation_begin();
 	__prepare_exit_to_usermode(regs);
Acked-by on the v1 series
#7 lore raw
In reply to Thomas Gleixner
Quoted 5 lines · Thomas Gleixner

- Syzbot reported a missing local_irq_disable() in exc_alignment_check()
- A missing noinstr annotation
- Make a function static which is not longer used from ASM code

All are:

-Andy

Quoted 4 lines

Thanks,

tglx

Signature · 2 lines
Andy Lutomirski
AMA Capital Management, LLC