[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1911121106450.1833@nanos.tec.linutronix.de>
Date: Tue, 12 Nov 2019 11:07:04 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Ingo Molnar <mingo@...nel.org>
cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Linus Torvalds <torvalds@...uxfoundation.org>,
Andy Lutomirski <luto@...nel.org>,
Stephen Hemminger <stephen@...workplumber.org>,
Willy Tarreau <w@....eu>, Juergen Gross <jgross@...e.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [patch V2 14/16] x86/iopl: Restrict iopl() permission scope
On Tue, 12 Nov 2019, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@...utronix.de> wrote:
>
> > +static void task_update_io_bitmap(void)
> > +{
> > + struct thread_struct *t = ¤t->thread;
> > +
> > + preempt_disable();
> > + if (t->iopl_emul == 3 || t->io_bitmap) {
> > + /* TSS update is handled on exit to user space */
> > + set_thread_flag(TIF_IO_BITMAP);
> > + } else {
> > + clear_thread_flag(TIF_IO_BITMAP);
> > + /* Invalidate TSS */
> > + tss_update_io_bitmap();
> > + }
> > + preempt_enable();
> > +}
> > +
> > void io_bitmap_exit(void)
> > {
> > struct io_bitmap *iobm = current->thread.io_bitmap;
> >
> > - preempt_disable();
> > current->thread.io_bitmap = NULL;
> > - clear_thread_flag(TIF_IO_BITMAP);
> > - tss_update_io_bitmap();
> > - preempt_enable();
> > + task_update_io_bitmap();
>
> BTW., isn't the preempt_disable()/enable() sequence only needed around
> the tss_update_io_bitmap() call?
>
> ->iopl_emul, ->io_bitmap and TIF_IO_BITMAP can only be set by the current
> task AFAICS.
>
> I.e. critical section could be narrowed a bit.
Yes.
Powered by blists - more mailing lists