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

Dann Frazier dannf at alioth.debian.org
Fri Jul 17 14:02:54 UTC 2009


Author: dannf
Date: Fri Jul 17 14:02:52 2009
New Revision: 13957

Log:
Add -fno-delete-null-pointer-checks to CFLAGS

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/all/add-fno-delete-null-pointer-checks-to-cflags.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/3

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Fri Jul 17 14:01:24 2009	(r13956)
+++ dists/sid/linux-2.6/debian/changelog	Fri Jul 17 14:02:52 2009	(r13957)
@@ -12,6 +12,7 @@
   [ dann frazier ]
   * Fix NULL pointer dereference in tun_chr_pool() (CVE-2009-1897)
   * personality: fix PER_CLEAR_ON_SETID (CVE-2009-1895)
+  * Add -fno-delete-null-pointer-checks to CFLAGS
 
  -- Bastian Blank <waldi at debian.org>  Wed, 08 Jul 2009 09:51:46 +0200
 

Added: dists/sid/linux-2.6/debian/patches/bugfix/all/add-fno-delete-null-pointer-checks-to-cflags.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/all/add-fno-delete-null-pointer-checks-to-cflags.patch	Fri Jul 17 14:02:52 2009	(r13957)
@@ -0,0 +1,57 @@
+commit a3ca86aea507904148870946d599e07a340b39bf
+Author: Eugene Teo <eteo at redhat.com>
+Date:   Wed Jul 15 14:59:10 2009 +0800
+
+    Add '-fno-delete-null-pointer-checks' to gcc CFLAGS
+    
+    Turning on this flag could prevent the compiler from optimising away
+    some "useless" checks for null pointers.  Such bugs can sometimes become
+    exploitable at compile time because of the -O2 optimisation.
+    
+    See http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Optimize-Options.html
+    
+    An example that clearly shows this 'problem' is commit 6bf67672.
+    
+     static void __devexit agnx_pci_remove(struct pci_dev *pdev)
+     {
+         struct ieee80211_hw *dev = pci_get_drvdata(pdev);
+    -    struct agnx_priv *priv = dev->priv;
+    +    struct agnx_priv *priv;
+         AGNX_TRACE;
+    
+         if (!dev)
+             return;
+    +    priv = dev->priv;
+    
+    By reverting this patch, and compile it with and without
+    -fno-delete-null-pointer-checks flag, we can see that the check for dev
+    is compiled away.
+    
+        call    printk  #
+    -   testq   %r12, %r12  # dev
+    -   je  .L94    #,
+        movq    %r12, %rdi  # dev,
+    
+    Clearly the 'fix' is to stop using dev before it is tested, but building
+    with -fno-delete-null-pointer-checks flag at least makes it harder to
+    abuse.
+    
+    Signed-off-by: Eugene Teo <eugeneteo at kernel.sg>
+    Acked-by: Eric Paris <eparis at redhat.com>
+    Acked-by: Wang Cong <amwang at redhat.com>
+    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+
+Backported to Debian's 2.6.30 by dann frazier <dannf at debian.org>
+
+--- linux-source-2.6.30.orig/Makefile	2009-07-07 09:13:25.000000000 -0600
++++ linux-source-2.6.30/Makefile	2009-07-16 23:57:06.000000000 -0600
+@@ -352,7 +352,8 @@
+ 
+ KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
+ 		   -fno-strict-aliasing -fno-common \
+-		   -Werror-implicit-function-declaration
++		   -Werror-implicit-function-declaration \
++		   -fno-delete-null-pointer-checks
+ KBUILD_AFLAGS   := -D__ASSEMBLY__
+ 
+ # Read KERNELRELEASE from include/config/kernel.release (if it exists)

Modified: dists/sid/linux-2.6/debian/patches/series/3
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/3	Fri Jul 17 14:01:24 2009	(r13956)
+++ dists/sid/linux-2.6/debian/patches/series/3	Fri Jul 17 14:02:52 2009	(r13957)
@@ -2,3 +2,4 @@
 + bugfix/ia64/fix-asm-fpu-h.patch
 + bugfix/all/tun-tap-fix-crash-on-open-and-poll.patch
 + bugfix/all/personality-fix-PER_CLEAR_ON_SETID.patch
++ bugfix/all/add-fno-delete-null-pointer-checks-to-cflags.patch



More information about the Kernel-svn-changes mailing list