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

Dann Frazier dannf at alioth.debian.org
Sun Jul 19 20:54:23 UTC 2009


Author: dannf
Date: Sun Jul 19 20:54:20 2009
New Revision: 13976

Log:
Add -fno-delete-null-pointer-checks to CFLAGS (Closes: #537617)

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/add-fno-delete-null-pointer-checks-to-CFLAGS.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/18

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Sun Jul 19 20:22:50 2009	(r13975)
+++ dists/lenny/linux-2.6/debian/changelog	Sun Jul 19 20:54:20 2009	(r13976)
@@ -25,6 +25,7 @@
     (Closes: #498271)
   * libata: make sure port is thawed when skipping resets. This change
     avoid regressing #533657 with the fix for #498271.
+  * Add -fno-delete-null-pointer-checks to CFLAGS (Closes: #537617)
 
  -- maximilian attems <maks at debian.org>  Wed, 10 Jun 2009 15:34:04 +0200
 

Added: dists/lenny/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/lenny/linux-2.6/debian/patches/bugfix/all/add-fno-delete-null-pointer-checks-to-CFLAGS.patch	Sun Jul 19 20:54:20 2009	(r13976)
@@ -0,0 +1,58 @@
+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.26 by dann frazier <dannf at debian.org>
+
+diff -urpN a/Makefile b/Makefile
+--- a/Makefile	2009-07-19 13:43:58.000000000 -0600
++++ b/Makefile	2009-07-19 13:53:15.000000000 -0600
+@@ -320,7 +320,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXI
+ 
+ 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
+ 
+ # .kernelvariables must be included before cc-option
+ # since it may change the value of $(CC)

Modified: dists/lenny/linux-2.6/debian/patches/series/18
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/18	Sun Jul 19 20:22:50 2009	(r13975)
+++ dists/lenny/linux-2.6/debian/patches/series/18	Sun Jul 19 20:54:20 2009	(r13976)
@@ -7,3 +7,4 @@
 + bugfix/all/replace_fwrapv_with_fno-strict-overflow.patch
 + bugfix/all/drivers-ata-sata_nv-broken-hardreset.patch
 + bugfix/all/libata-make-sure-port-is-thawed-when-skipping-reset.patch
++ bugfix/all/add-fno-delete-null-pointer-checks-to-CFLAGS.patch



More information about the Kernel-svn-changes mailing list