All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/3] x86/entry: A couple of small fixes
@ 2020-07-08 19:28 Thomas Gleixner
  2020-07-08 19:28 ` [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check() Thomas Gleixner
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Gleixner @ 2020-07-08 19:28 UTC (permalink / raw)
  To: LKML; +Cc: x86

 - 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check()
  2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
@ 2020-07-08 19:28 ` Thomas Gleixner
  2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
  2020-07-08 19:28 ` [patch 2/3] x86/entry: Mark check_user_regs() noinstr Thomas Gleixner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2020-07-08 19:28 UTC (permalink / raw)
  To: LKML; +Cc: x86, syzbot+0889df9502bc0f112b31

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: syzbot+0889df9502bc0f112b31@syzkaller.appspotmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/traps.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch 2/3] x86/entry: Mark check_user_regs() noinstr
  2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
  2020-07-08 19:28 ` [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check() Thomas Gleixner
@ 2020-07-08 19:28 ` Thomas Gleixner
  2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
  2020-07-08 19:28 ` [patch 3/3] x86/entry/common: Make prepare_exit_to_usermode() static Thomas Gleixner
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2020-07-08 19:28 UTC (permalink / raw)
  To: LKML; +Cc: x86

It's called from the non-instrumentable section.

Fixes: c9c26150e61d ("x86/entry: Assert that syscalls are on the right stack")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/entry/common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -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)) {
 		/*


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch 3/3] x86/entry/common: Make prepare_exit_to_usermode() static
  2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
  2020-07-08 19:28 ` [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check() Thomas Gleixner
  2020-07-08 19:28 ` [patch 2/3] x86/entry: Mark check_user_regs() noinstr Thomas Gleixner
@ 2020-07-08 19:28 ` Thomas Gleixner
  2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
  2020-07-08 21:17 ` [patch 0/3] x86/entry: A couple of small fixes Andy Lutomirski
  2020-07-09  9:09 ` Peter Zijlstra
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2020-07-08 19:28 UTC (permalink / raw)
  To: LKML; +Cc: x86

No users outside this file anymore.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/entry/common.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -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);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch 0/3] x86/entry: A couple of small fixes
  2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
                   ` (2 preceding siblings ...)
  2020-07-08 19:28 ` [patch 3/3] x86/entry/common: Make prepare_exit_to_usermode() static Thomas Gleixner
@ 2020-07-08 21:17 ` Andy Lutomirski
  2020-07-09  9:09 ` Peter Zijlstra
  4 siblings, 0 replies; 9+ messages in thread
From: Andy Lutomirski @ 2020-07-08 21:17 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, X86 ML

On Wed, Jul 8, 2020 at 12:29 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>
>  - 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:

Acked-by: Andy Lutomirski <luto@kernel.org>

-Andy

> Thanks,
>
>         tglx
>


-- 
Andy Lutomirski
AMA Capital Management, LLC

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch 0/3] x86/entry: A couple of small fixes
  2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
                   ` (3 preceding siblings ...)
  2020-07-08 21:17 ` [patch 0/3] x86/entry: A couple of small fixes Andy Lutomirski
@ 2020-07-09  9:09 ` Peter Zijlstra
  4 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2020-07-09  9:09 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, x86

On Wed, Jul 08, 2020 at 09:28:04PM +0200, Thomas Gleixner wrote:
>  - 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

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip: x86/urgent] x86/entry/common: Make prepare_exit_to_usermode() static
  2020-07-08 19:28 ` [patch 3/3] x86/entry/common: Make prepare_exit_to_usermode() static Thomas Gleixner
@ 2020-07-09  9:22   ` tip-bot2 for Thomas Gleixner
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2020-07-09  9:22 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Thomas Gleixner, Andy Lutomirski, x86, LKML

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 <tglx@linutronix.de>
AuthorDate:    Wed, 08 Jul 2020 21:28:07 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200708192934.301116609@linutronix.de

---
 arch/x86/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index ea7b515..f092884 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -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);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip: x86/urgent] x86/entry: Mark check_user_regs() noinstr
  2020-07-08 19:28 ` [patch 2/3] x86/entry: Mark check_user_regs() noinstr Thomas Gleixner
@ 2020-07-09  9:22   ` tip-bot2 for Thomas Gleixner
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2020-07-09  9:22 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Thomas Gleixner, Andy Lutomirski, x86, LKML

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 <tglx@linutronix.de>
AuthorDate:    Wed, 08 Jul 2020 21:28:06 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200708192934.191497962@linutronix.de

---
 arch/x86/entry/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index e83b3f1..ea7b515 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -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)) {
 		/*

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip: x86/urgent] x86/traps: Disable interrupts in exc_aligment_check()
  2020-07-08 19:28 ` [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check() Thomas Gleixner
@ 2020-07-09  9:22   ` tip-bot2 for Thomas Gleixner
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2020-07-09  9:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: syzbot+0889df9502bc0f112b31, Thomas Gleixner, Andy Lutomirski, x86, LKML

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 <tglx@linutronix.de>
AuthorDate:    Wed, 08 Jul 2020 21:28:05 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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: syzbot+0889df9502bc0f112b31@syzkaller.appspotmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200708192934.076519438@linutronix.de

---
 arch/x86/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 6ed8cc5..4f3a509 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-09  9:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 19:28 [patch 0/3] x86/entry: A couple of small fixes Thomas Gleixner
2020-07-08 19:28 ` [patch 1/3] x86/traps: Disable interrupts in exc_aligment_check() Thomas Gleixner
2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2020-07-08 19:28 ` [patch 2/3] x86/entry: Mark check_user_regs() noinstr Thomas Gleixner
2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2020-07-08 19:28 ` [patch 3/3] x86/entry/common: Make prepare_exit_to_usermode() static Thomas Gleixner
2020-07-09  9:22   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2020-07-08 21:17 ` [patch 0/3] x86/entry: A couple of small fixes Andy Lutomirski
2020-07-09  9:09 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.