lkml.org 
[lkml]   [2019]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch V2 14/16] x86/iopl: Restrict iopl() permission scope

* Thomas Gleixner <tglx@linutronix.de> wrote:

> +static void task_update_io_bitmap(void)
> +{
> + struct thread_struct *t = &current->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.

Thanks,

Ingo

\
 
 \ /
  Last update: 2019-11-12 09:43    [W:0.193 / U:1.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site