mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: Sohil Mehta <sohil.mehta@intel.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] x86/process: Return early on NULL iobm in native_tss_update_io_bitmap()
Date: Fri, 12 Jun 2026 03:11:25 +0000	[thread overview]
Message-ID: <171f279830f34b2292bbfb4a5604d3db@baidu.com> (raw)
In-Reply-To: <44a31716-c021-463e-aa2b-8fdbe0b6b6a2@intel.com>

> 
> How about?
> 
> x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is
> assigned
> 
> 
> On 5/31/2026 10:37 PM, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > When 'iobm' is NULL, native_tss_update_io_bitmap() clears the thread
> > flag and invalidates the TSS bitmap, but falls through to subsequent
> > code that dereferences 'iobm'.
> >
> 
> "When iobm is NULL.." makes it sound like this can easily happen. Would it
> be better to say:

True, I haven’t observed this issue myself. I agree that your commit message is better, so I will send a v2 with it.

Thanks

-Li
> 
> 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.
> 
> > Add a missing return statement to prevent a potential kernel NULL
> > pointer dereference panic.
> >
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> >  arch/x86/kernel/process.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> 
> The code change looks good to me.
> 
> Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
> 
> > 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;
> >  		}
> >
> >  		/*
> 


      reply	other threads:[~2026-06-12  3:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  5:37 lirongqing
2026-06-10 12:40 ` 答复: " Li,Rongqing
2026-06-12  2:19 ` Sohil Mehta
2026-06-12  3:11   ` Li,Rongqing [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=171f279830f34b2292bbfb4a5604d3db@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®