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]
Message-ID: <CA+55aFz-=9L=K2O-yB5f9R-w40PzXJ5xEXcinnUdUF1QHO7KMQ@mail.gmail.com>
Date:	Sat, 1 Feb 2014 11:27:54 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Suresh Siddha <sbsiddha@...il.com>
Cc:	Nate Eldredge <nate@...tsmathematics.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	"the arch/x86 maintainers" <x86@...nel.org>,
	stable <stable@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Maarten Baert <maarten-baert@...mail.com>,
	Jan Kara <jack@...e.cz>, George Spelvin <linux@...izon.com>,
	Pekka Riikonen <priikone@....fi>
Subject: Re: [PATCH] Make math_state_restore() save and restore the interrupt flag

On Thu, Jan 30, 2014 at 11:33 PM, Suresh Siddha <sbsiddha@...il.com> wrote:
>
> a. delayed dynamic allocation of FPU state area was not a good idea
> (from me). Given most of the future cases will be anyway using eager
> FPU (because of processor features like xsaveopt etc, applications
> implicitly using FPU because of optimizations in commonly used
> libraries etc), we should probably go back to allocation of FPU state
> area during thread creation for everyone (including non-eager cases).

Yes, I suspect that will help some, and probably fix this particular bug.

That said, regardless of the allocation issue, I do think that it's
stupid for kernel_fpu_{begin,end} to save the math state if
"used_math" was not set.  So I do think__kernel_fpu_end() as-s is
buggy and stupid. So I do think we should *either* say

 (a) "we don't want to restore at all, because once the kernel starts
using math, it might do so a lot, and saving/restoring is a bad idea":

  void __kernel_fpu_end(void)
  {
          stts();
  }

*or*

 (b) make the use_eager_fpu() case check tsk_used_math() (in which
case we had better already have an allocation!)

  void __kernel_fpu_end(void)
  {
          if (use_eager_fpu()) {
                  struct task_struct *me = current;

                  if (tsk_used_math(me) && likely(!restore_fpu_checking(me)))
                          return;
          }
          stts();
  }

Quite frankly, I'd almost lean towards (a). Comments? Does anybody
have any loads where the kernel does a lot of fpu stuff (ie network
encryption using the hw engines or something)? I'd really like to hear
if it makes a difference..

               Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ