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] [day] [month] [year] [list]
Message-ID: <tip-531bd721812cad4b7f7158b246fba8303b555be7@git.kernel.org>
Date:   Tue, 30 Apr 2019 04:30:13 -0700
From:   tip-bot for Sebastian Andrzej Siewior <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     luto@...nel.org, bp@...en8.de, fenghua.yu@...el.com, hpa@...or.com,
        mingo@...nel.org, torvalds@...ux-foundation.org,
        bigeasy@...utronix.de, peterz@...radead.org, tglx@...utronix.de,
        dave.hansen@...el.com, linux-kernel@...r.kernel.org,
        oleg@...hat.com
Subject: [tip:x86/fpu] x86/fpu: Remove unnecessary saving of FPU registers
 in copy_fpstate_to_sigframe()

Commit-ID:  531bd721812cad4b7f7158b246fba8303b555be7
Gitweb:     https://git.kernel.org/tip/531bd721812cad4b7f7158b246fba8303b555be7
Author:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
AuthorDate: Tue, 30 Apr 2019 10:31:26 +0200
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 30 Apr 2019 13:07:54 +0200

x86/fpu: Remove unnecessary saving of FPU registers in copy_fpstate_to_sigframe()

Since commit:

  eeec00d73be2e ("x86/fpu: Fault-in user stack if copy_fpstate_to_sigframe() fails")

there is no need to have FPU registers saved if
copy_fpregs_to_sigframe() fails, because we retry it after we resolved
the fault condition.

Saving the registers is not wrong but it is not necessary and it forces us
to load the FPU registers on the retry attempt.

Don't save the FPU registers if copy_fpstate_to_sigframe() fails.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jason@...c4.com
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: bp@...e.de
Cc: jannh@...gle.com
Cc: kurt.kanzenbach@...utronix.de
Cc: kvm@...r.kernel.org
Cc: pbonzini@...hat.com
Cc: riel@...riel.com
Cc: rkrcmar@...hat.com
Link: http://lkml.kernel.org/r/20190430083126.rilbb76yc27vrem5@linutronix.de
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/kernel/fpu/signal.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 6d6c2d6afde4..08c5059dc4ec 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -157,10 +157,9 @@ static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf)
  */
 int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
 {
-	struct fpu *fpu = &current->thread.fpu;
 	struct task_struct *tsk = current;
 	int ia32_fxstate = (buf != buf_fx);
-	int ret = -EFAULT;
+	int ret;
 
 	ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
 			 IS_ENABLED(CONFIG_IA32_EMULATION));
@@ -187,9 +186,6 @@ retry:
 	pagefault_disable();
 	ret = copy_fpregs_to_sigframe(buf_fx);
 	pagefault_enable();
-	if (ret && !test_thread_flag(TIF_NEED_FPU_LOAD))
-		copy_fpregs_to_fpstate(fpu);
-	set_thread_flag(TIF_NEED_FPU_LOAD);
 	fpregs_unlock();
 
 	if (ret) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ