[linux] 01/01: [powerpc*] kernel: Fix FP and vector register restoration

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Thu Aug 3 09:37:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

carnil pushed a commit to branch stretch
in repository linux.

commit b0fc78bf8d9c1f4b35337da275dca21d7dd51efb
Author: Salvatore Bonaccorso <carnil at debian.org>
Date:   Thu Aug 3 11:28:56 2017 +0200

    [powerpc*] kernel: Fix FP and vector register restoration
    
    Closes: #868902
    
    Thanks: Gabriel F. T. Gomes for the report and analysis.
---
 debian/changelog                                   |  5 +++
 ...nel-Fix-FP-and-vector-register-restoratio.patch | 52 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 58 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 73fad58..ccc24dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,11 @@ linux (4.9.30-3) UNRELEASED; urgency=medium
   * [arm64,armhf] udeb: Ship usb3503 module in usb-modules, needed for
     e.g. Arndale development boards, thanks to Wei Liu (Closes: #865645).
 
+  [ Salvatore Bonaccorso ]
+  * [powerpc*] kernel: Fix FP and vector register restoration.
+    Thanks to Gabriel F. T. Gomes for the report and analysis.
+    (Closes: #868902)
+
  -- Ben Hutchings <ben at decadent.org.uk>  Sun, 16 Jul 2017 21:54:09 +0100
 
 linux (4.9.30-2+deb9u2) stretch-security; urgency=high
diff --git a/debian/patches/bugfix/powerpc/powerpc-kernel-Fix-FP-and-vector-register-restoratio.patch b/debian/patches/bugfix/powerpc/powerpc-kernel-Fix-FP-and-vector-register-restoratio.patch
new file mode 100644
index 0000000..eeb30a9
--- /dev/null
+++ b/debian/patches/bugfix/powerpc/powerpc-kernel-Fix-FP-and-vector-register-restoratio.patch
@@ -0,0 +1,52 @@
+From: Breno Leitao <leitao at debian.org>
+Date: Fri, 2 Jun 2017 18:43:30 -0300
+Subject: powerpc/kernel: Fix FP and vector register restoration
+Origin: https://git.kernel.org/linus/1195892c091a15cc862f4e202482a36adc924e12
+Bug-Debian: https://bugs.debian.org/868902
+
+Currently tsk->thread->load_vec and load_fp are not initialized during
+task creation, which can lead to garbage values in these variables (non-zero
+values).
+
+These variables will be checked later in restore_math() to validate if the
+FP and vector registers are being utilized. Since these values might be
+non-zero, the restore_math() will continue to save the FP and vectors even if
+they were never utilized by the userspace application. load_fp and load_vec
+counters will then overflow (they wrap at 255) and the FP and Altivec will be
+finally disabled, but before that condition is reached (counter overflow)
+several context switches will have restored FP and vector registers without
+need, causing a performance degradation.
+
+Fixes: 70fe3d980f5f ("powerpc: Restore FPU/VEC/VSX if previously used")
+Cc: stable at vger.kernel.org # v4.6+
+Signed-off-by: Breno Leitao <leitao at debian.org>
+Signed-off-by: Gustavo Romero <gusbromero at gmail.com>
+Acked-by: Anton Blanchard <anton at samba.org>
+Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
+---
+ arch/powerpc/kernel/process.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
+index baae104b16c7..a9435397eab8 100644
+--- a/arch/powerpc/kernel/process.c
++++ b/arch/powerpc/kernel/process.c
+@@ -1666,6 +1666,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
+ #ifdef CONFIG_VSX
+ 	current->thread.used_vsr = 0;
+ #endif
++	current->thread.load_fp = 0;
+ 	memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state));
+ 	current->thread.fp_save_area = NULL;
+ #ifdef CONFIG_ALTIVEC
+@@ -1674,6 +1675,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
+ 	current->thread.vr_save_area = NULL;
+ 	current->thread.vrsave = 0;
+ 	current->thread.used_vr = 0;
++	current->thread.load_vec = 0;
+ #endif /* CONFIG_ALTIVEC */
+ #ifdef CONFIG_SPE
+ 	memset(current->thread.evr, 0, sizeof(current->thread.evr));
+-- 
+2.13.3
+
diff --git a/debian/patches/series b/debian/patches/series
index bcf3b30..5e46969 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -91,6 +91,7 @@ bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch
 bugfix/all/kbuild-do-not-use-hyphen-in-exported-variable-name.patch
 bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch
 bugfix/all/kbuild-include-addtree-remove-quotes-before-matching-path.patch
+bugfix/powerpc/powerpc-kernel-Fix-FP-and-vector-register-restoratio.patch
 
 # Miscellaneous features
 features/all/netfilter-nft_ct-add-notrack-support.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list