diff mbox

[Xenial,SRU] s390: fix test_fp_ctl inline assembly contraints

Message ID 1467740607-5084-1-git-send-email-tim.gardner@canonical.com
State New
Headers show

Commit Message

Tim Gardner July 5, 2016, 5:43 p.m. UTC
From: Martin Schwidefsky <schwidefsky@de.ibm.com>

BugLink: http://bugs.launchpad.net/bugs/1597971

The test_fp_ctl function is used to test if a given value is a valid
floating-point control. The inline assembly in test_fp_ctl uses an
incorrect constraint for the 'orig_fpc' variable. If the compiler
chooses the same register for 'fpc' and 'orig_fpc' the test_fp_ctl()
function always returns true. This allows user space to trigger
kernel oopses with invalid floating-point control values on the
signal stack.

This problem has been introduced with git commit 4725c86055f5bbdcdf
"s390: fix save and restore of the floating-point-control register"

Cc: stable@vger.kernel.org # v3.13+
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
(cherry picked from commit bcf4dd5f9ee096bd1510f838dd4750c35df4e38b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 arch/s390/include/asm/fpu/api.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kamal Mostafa July 6, 2016, 3:48 p.m. UTC | #1

Stefan Bader July 8, 2016, 8:34 a.m. UTC | #2

Kamal Mostafa July 8, 2016, 4:02 p.m. UTC | #3
Applied to Xenial.

 -Kamal
diff mbox

Patch

diff --git a/arch/s390/include/asm/fpu/api.h b/arch/s390/include/asm/fpu/api.h
index 5e04f3c..8ae236b0 100644
--- a/arch/s390/include/asm/fpu/api.h
+++ b/arch/s390/include/asm/fpu/api.h
@@ -22,7 +22,7 @@  static inline int test_fp_ctl(u32 fpc)
 		"	la	%0,0\n"
 		"1:\n"
 		EX_TABLE(0b,1b)
-		: "=d" (rc), "=d" (orig_fpc)
+		: "=d" (rc), "=&d" (orig_fpc)
 		: "d" (fpc), "0" (-EINVAL));
 	return rc;
 }