[kernel] r16255 - in dists/lenny/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Thu Sep 9 04:08:44 UTC 2010


Author: benh
Date: Thu Sep  9 04:08:33 2010
New Revision: 16255

Log:
math-emu: correct test for downshifting fraction in _FP_FROM_INT()

This is a serious bug on sparc (#593193) and the buggy macro is used for
alpha and s390 as well.

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/math-emu-correct-test-for-downshifting-fraction.patch
   dists/lenny/linux-2.6/debian/patches/series/26
Modified:
   dists/lenny/linux-2.6/debian/changelog

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Thu Sep  9 03:21:17 2010	(r16254)
+++ dists/lenny/linux-2.6/debian/changelog	Thu Sep  9 04:08:33 2010	(r16255)
@@ -1,3 +1,11 @@
+linux-2.6 (2.6.26-26) UNRELEASED; urgency=low
+
+  [ Ben Hutchings ]
+  * [alpha,s390,sparc] math-emu: correct test for downshifting fraction in
+    _FP_FROM_INT() (Closes: #593193)
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Thu, 09 Sep 2010 05:02:56 +0100
+
 linux-2.6 (2.6.26-25) stable; urgency=high
 
   [ Ben Hutchings ]

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/math-emu-correct-test-for-downshifting-fraction.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/math-emu-correct-test-for-downshifting-fraction.patch	Thu Sep  9 04:08:33 2010	(r16255)
@@ -0,0 +1,56 @@
+From: Mikael Pettersson <mikpe at it.uu.se>
+Date: Tue, 20 Jul 2010 18:45:14 -0700
+Subject: [PATCH] math-emu: correct test for downshifting fraction in _FP_FROM_INT()
+
+commit f8324e20f8289dffc646d64366332e05eaacab25 upstream.
+
+The kernel's math-emu code contains a macro _FP_FROM_INT() which is
+used to convert an integer to a raw normalized floating-point value.
+It does this basically in three steps:
+
+1. Compute the exponent from the number of leading zero bits.
+2. Downshift large fractions to put the MSB in the right position
+   for normalized fractions.
+3. Upshift small fractions to put the MSB in the right position.
+
+There is an boundary error in step 2, causing a fraction with its
+MSB exactly one bit above the normalized MSB position to not be
+downshifted.  This results in a non-normalized raw float, which when
+packed becomes a massively inaccurate representation for that input.
+
+The impact of this depends on a number of arch-specific factors,
+but it is known to have broken emulation of FXTOD instructions
+on UltraSPARC III, which was originally reported as GCC bug 44631
+<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44631>.
+
+Any arch which uses math-emu to emulate conversions from integers to
+same-size floats may be affected.
+
+The fix is simple: the exponent comparison used to determine if the
+fraction should be downshifted must be "<=" not "<".
+
+I'm sending a kernel module to test this as a reply to this message.
+There are also SPARC user-space test cases in the GCC bug entry.
+
+Signed-off-by: Mikael Pettersson <mikpe at it.uu.se>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ include/math-emu/op-common.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
+index 408f743..a4cb9d1 100644
+--- a/include/math-emu/op-common.h
++++ b/include/math-emu/op-common.h
+@@ -793,7 +793,7 @@ do {									\
+ 		X##_e -= (_FP_W_TYPE_SIZE - rsize);			\
+ 	X##_e = rsize - X##_e - 1;					\
+ 									\
+-	if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e)	\
++	if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs <= X##_e)	\
+ 	  __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\
+ 	_FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize);			\
+ 	if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0)			\
+-- 
+1.7.1
+

Added: dists/lenny/linux-2.6/debian/patches/series/26
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/series/26	Thu Sep  9 04:08:33 2010	(r16255)
@@ -0,0 +1 @@
++ bugfix/all/math-emu-correct-test-for-downshifting-fraction.patch



More information about the Kernel-svn-changes mailing list