mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Christoph Hellwig <hch@lst.de>
Cc: Neil Brown <neilb@cse.unsw.edu.au>,
	Dave Kleikamp <shaggy@austin.ibm.com>,
	Andrew Morton <akpm@osdl.org>,
	nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [-mm patch] fs/nfsd/vfs.c: fix possible runtime stack corruption
Date: Wed, 14 Dec 2005 00:06:25 +0100	[thread overview]
Message-ID: <20051213230625.GW23349@stusta.de> (raw)

Compiling 2.6.15-rc5-mm2 with CONFIG_NFSD_V4=n and CONFIG_NFSD_V2_ACL=y 
or CONFIG_NFSD_V3_ACL=y results due to 
add-vfs_-helpers-for-xattr-operations.patch in the following:

<--  snip  -->

...
  CC [M]  fs/nfsd/vfs.o
fs/nfsd/vfs.c: In function 'nfsd_getxattr':
fs/nfsd/vfs.c:376: warning: implicit declaration of function 'vfs_getxattr'
fs/nfsd/vfs.c: In function 'nfsd_set_posix_acl':
fs/nfsd/vfs.c:1931: warning: implicit declaration of function 'vfs_setxattr'
fs/nfsd/vfs.c:1936: warning: implicit declaration of function 'vfs_removexattr'
...

<--  snip  -->


The possible stack corruption if gcc guessed the types of the parameters 
of any of these functions wrong is obvious.


Given the -Werror-implicit-function-declaration flag, gcc would	
abort compilation in such cases:

<--  snip  -->

...
  CC [M]  fs/nfsd/vfs.o
fs/nfsd/vfs.c: In function 'nfsd_getxattr':
fs/nfsd/vfs.c:376: error: implicit declaration of function 'vfs_getxattr'
fs/nfsd/vfs.c: In function 'nfsd_set_posix_acl':
fs/nfsd/vfs.c:1931: error: implicit declaration of function 'vfs_setxattr'
fs/nfsd/vfs.c:1936: error: implicit declaration of function 'vfs_removexattr'
make[2]: *** [fs/nfsd/vfs.o] Error 1

<--  snip  -->



Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.15-rc5-mm2-modular/fs/nfsd/vfs.c.old	2005-12-13 22:05:39.000000000 +0100
+++ linux-2.6.15-rc5-mm2-modular/fs/nfsd/vfs.c	2005-12-13 22:05:55.000000000 +0100
@@ -48,8 +48,8 @@
 #include <linux/fsnotify.h>
 #include <linux/posix_acl.h>
 #include <linux/posix_acl_xattr.h>
-#ifdef CONFIG_NFSD_V4
 #include <linux/xattr.h>
+#ifdef CONFIG_NFSD_V4
 #include <linux/nfs4.h>
 #include <linux/nfs4_acl.h>
 #include <linux/nfsd_idmap.h>


                 reply	other threads:[~2005-12-13 23:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051213230625.GW23349@stusta.de \
    --to=bunk@stusta.de \
    --cc=akpm@osdl.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=nfs@lists.sourceforge.net \
    --cc=shaggy@austin.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome