All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL
@ 2022-03-10 12:09 Li Huafei
  2022-03-10 14:04 ` Masami Hiramatsu
  2022-03-11 18:30 ` [tip: x86/urgent] " tip-bot2 for Li Huafei
  0 siblings, 2 replies; 4+ messages in thread
From: Li Huafei @ 2022-03-10 12:09 UTC (permalink / raw)
  To: peterz, tglx
  Cc: alexandre.chartre, mhiramat, mingo, bp, dave.hansen, x86, hpa,
	laijs, chang.seok.bae, fenghua.yu, thomas.tai, linux-kernel

Since kprobe_int3_handler() is called in do_int3(), probing do_int3()
can cause a breakpoint recursion and crash the kernel. Therefore,
do_int3() should be marked as NOKPROBE_SYMBOL.

Fixes: 21e28290b317 ("x86/traps: Split int3 handler up")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 arch/x86/kernel/traps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index c9d566dcf89a..8143693a7ea6 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -659,6 +659,7 @@ static bool do_int3(struct pt_regs *regs)
 
 	return res == NOTIFY_STOP;
 }
+NOKPROBE_SYMBOL(do_int3);
 
 static void do_int3_user(struct pt_regs *regs)
 {
-- 
2.17.1


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

* Re: [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL
  2022-03-10 12:09 [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL Li Huafei
@ 2022-03-10 14:04 ` Masami Hiramatsu
  2022-03-11 10:21   ` Li Huafei
  2022-03-11 18:30 ` [tip: x86/urgent] " tip-bot2 for Li Huafei
  1 sibling, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2022-03-10 14:04 UTC (permalink / raw)
  To: Li Huafei
  Cc: peterz, tglx, alexandre.chartre, mhiramat, mingo, bp,
	dave.hansen, x86, hpa, laijs, chang.seok.bae, fenghua.yu,
	thomas.tai, linux-kernel

On Thu, 10 Mar 2022 20:09:15 +0800
Li Huafei <lihuafei1@huawei.com> wrote:

> Since kprobe_int3_handler() is called in do_int3(), probing do_int3()
> can cause a breakpoint recursion and crash the kernel. Therefore,
> do_int3() should be marked as NOKPROBE_SYMBOL.
> 
> Fixes: 21e28290b317 ("x86/traps: Split int3 handler up")
> Signed-off-by: Li Huafei <lihuafei1@huawei.com>

Good catch!
This should be backported to stable kernel.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: stable@vger.kernel.org


Thank you,

> ---
>  arch/x86/kernel/traps.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index c9d566dcf89a..8143693a7ea6 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -659,6 +659,7 @@ static bool do_int3(struct pt_regs *regs)
>  
>  	return res == NOTIFY_STOP;
>  }
> +NOKPROBE_SYMBOL(do_int3);
>  
>  static void do_int3_user(struct pt_regs *regs)
>  {
> -- 
> 2.17.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL
  2022-03-10 14:04 ` Masami Hiramatsu
@ 2022-03-11 10:21   ` Li Huafei
  0 siblings, 0 replies; 4+ messages in thread
From: Li Huafei @ 2022-03-11 10:21 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: peterz, tglx, alexandre.chartre, mingo, bp, dave.hansen, x86,
	hpa, laijs, chang.seok.bae, fenghua.yu, thomas.tai, linux-kernel


On 2022/3/10 22:04, Masami Hiramatsu wrote:
> On Thu, 10 Mar 2022 20:09:15 +0800
> Li Huafei <lihuafei1@huawei.com> wrote:
>
>> Since kprobe_int3_handler() is called in do_int3(), probing do_int3()
>> can cause a breakpoint recursion and crash the kernel. Therefore,
>> do_int3() should be marked as NOKPROBE_SYMBOL.
>>
>> Fixes: 21e28290b317 ("x86/traps: Split int3 handler up")
>> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> Good catch!
> This should be backported to stable kernel.
>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: stable@vger.kernel.org

Thanks,

Huafei

>
>
> Thank you,
>
>> ---
>>   arch/x86/kernel/traps.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
>> index c9d566dcf89a..8143693a7ea6 100644
>> --- a/arch/x86/kernel/traps.c
>> +++ b/arch/x86/kernel/traps.c
>> @@ -659,6 +659,7 @@ static bool do_int3(struct pt_regs *regs)
>>   
>>   	return res == NOTIFY_STOP;
>>   }
>> +NOKPROBE_SYMBOL(do_int3);
>>   
>>   static void do_int3_user(struct pt_regs *regs)
>>   {
>> -- 
>> 2.17.1
>>
>

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

* [tip: x86/urgent] x86/traps: Mark do_int3() NOKPROBE_SYMBOL
  2022-03-10 12:09 [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL Li Huafei
  2022-03-10 14:04 ` Masami Hiramatsu
@ 2022-03-11 18:30 ` tip-bot2 for Li Huafei
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Li Huafei @ 2022-03-11 18:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Li Huafei, Borislav Petkov, Masami Hiramatsu, stable, x86, linux-kernel

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

Commit-ID:     a365a65f9ca1ceb9cf1ac29db4a4f51df7c507ad
Gitweb:        https://git.kernel.org/tip/a365a65f9ca1ceb9cf1ac29db4a4f51df7c507ad
Author:        Li Huafei <lihuafei1@huawei.com>
AuthorDate:    Thu, 10 Mar 2022 20:09:15 +08:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 11 Mar 2022 19:19:30 +01:00

x86/traps: Mark do_int3() NOKPROBE_SYMBOL

Since kprobe_int3_handler() is called in do_int3(), probing do_int3()
can cause a breakpoint recursion and crash the kernel. Therefore,
do_int3() should be marked as NOKPROBE_SYMBOL.

Fixes: 21e28290b317 ("x86/traps: Split int3 handler up")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220310120915.63349-1-lihuafei1@huawei.com
---
 arch/x86/kernel/traps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index c9d566d..8143693 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -659,6 +659,7 @@ static bool do_int3(struct pt_regs *regs)
 
 	return res == NOTIFY_STOP;
 }
+NOKPROBE_SYMBOL(do_int3);
 
 static void do_int3_user(struct pt_regs *regs)
 {

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

end of thread, other threads:[~2022-03-11 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 12:09 [PATCH] x86/traps: Mark do_int3() NOKPROBE_SYMBOL Li Huafei
2022-03-10 14:04 ` Masami Hiramatsu
2022-03-11 10:21   ` Li Huafei
2022-03-11 18:30 ` [tip: x86/urgent] " tip-bot2 for Li Huafei

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.