lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Nov 2019 09:42:59 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
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


* Thomas Gleixner <tglx@...utronix.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ