mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
@ 2026-06-12  5:49 lirongqing
  2026-06-12 14:34 ` Sohil Mehta
  0 siblings, 1 reply; 4+ messages in thread
From: lirongqing @ 2026-06-12  5:49 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Li RongQing, sohil.mehta, linux-kernel

From: Li RongQing <lirongqing@baidu.com>

Outside the IOPL emulation path, the IO bitmap is always expected
to be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE()
handles the case where the flag and the pointer got out of sync.
In this rare scenario, return early instead of continuing and
dereferencing a NULL pointer.

[Sohil Mehta: rephrased commit message]

Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v1: rephrased commit message

 arch/x86/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4c718f8..d5cd217 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -486,6 +486,7 @@ void native_tss_update_io_bitmap(void)
 		if (WARN_ON_ONCE(!iobm)) {
 			clear_thread_flag(TIF_IO_BITMAP);
 			native_tss_invalidate_io_bitmap();
+			return;
 		}
 
 		/*
-- 
2.9.4


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

* Re: [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
  2026-06-12  5:49 [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned lirongqing
@ 2026-06-12 14:34 ` Sohil Mehta
  2026-06-13  3:01   ` 答复: [外部邮件] " Li,Rongqing
  0 siblings, 1 reply; 4+ messages in thread
From: Sohil Mehta @ 2026-06-12 14:34 UTC (permalink / raw)
  To: lirongqing, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H . Peter Anvin, linux-kernel

On 6/11/2026 10:49 PM, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> Outside the IOPL emulation path, the IO bitmap is always expected
> to be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE()
> handles the case where the flag and the pointer got out of sync.
> In this rare scenario, return early instead of continuing and
> dereferencing a NULL pointer.
> 
> [Sohil Mehta: rephrased commit message]
> 

Never add handler comments for others. Such comments are only expected
to be added when someone who is handling your patch modifies it but
keeps the original authorship. You shouldn't add handler comments when
you are changing the patch as an author yourself.

> Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---

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

* 答复: [外部邮件] Re: [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
  2026-06-12 14:34 ` Sohil Mehta
@ 2026-06-13  3:01   ` Li,Rongqing
  2026-06-13  6:59     ` Sohil Mehta
  0 siblings, 1 reply; 4+ messages in thread
From: Li,Rongqing @ 2026-06-13  3:01 UTC (permalink / raw)
  To: Sohil Mehta, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H . Peter Anvin, linux-kernel

> On 6/11/2026 10:49 PM, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > Outside the IOPL emulation path, the IO bitmap is always expected to
> > be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE()
> > handles the case where the flag and the pointer got out of sync.
> > In this rare scenario, return early instead of continuing and
> > dereferencing a NULL pointer.
> >
> > [Sohil Mehta: rephrased commit message]
> >
> 
> Never add handler comments for others. Such comments are only expected
> to be added when someone who is handling your patch modifies it but keeps
> the original authorship. You shouldn't add handler comments when you are
> changing the patch as an author yourself.
> 

Ok, I will remove it in next version

[Li,Rongqing] 



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

* Re: 答复: [外部邮件] Re: [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
  2026-06-13  3:01   ` 答复: [外部邮件] " Li,Rongqing
@ 2026-06-13  6:59     ` Sohil Mehta
  0 siblings, 0 replies; 4+ messages in thread
From: Sohil Mehta @ 2026-06-13  6:59 UTC (permalink / raw)
  To: Li,Rongqing, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H . Peter Anvin, linux-kernel

Upon rereading, the title seems very long. Maybe shorten it to:

x86/ioperm: Prevent NULL dereference on missing IO bitmap

On 6/12/2026 8:01 PM, Li,Rongqing wrote:

>>> [Sohil Mehta: rephrased commit message]
>>>

Such comments are usually added below the '---' line if needed.

> Ok, I will remove it in next version
> 
> [Li,Rongqing] 
> 
> 


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

end of thread, other threads:[~2026-06-13  6:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12  5:49 [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned lirongqing
2026-06-12 14:34 ` Sohil Mehta
2026-06-13  3:01   ` 答复: [外部邮件] " Li,Rongqing
2026-06-13  6:59     ` Sohil Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®