1. 28 3月, 2011 1 次提交
    • T
      eCryptfs: Remove unnecessary grow_file() function · bd4f0fe8
      Tyler Hicks 提交于
      When creating a new eCryptfs file, the crypto metadata is written out
      and then the lower file was being "grown" with 4 kB of encrypted zeroes.
      I suspect that growing the encrypted file was to prevent an information
      leak that the unencrypted file was empty. However, the unencrypted file
      size is stored, in plaintext, in the metadata so growing the file is
      unnecessary.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      bd4f0fe8
  2. 22 2月, 2011 2 次提交
  3. 18 2月, 2011 1 次提交
  4. 18 1月, 2011 1 次提交
  5. 13 1月, 2011 1 次提交
  6. 07 1月, 2011 4 次提交
  7. 29 10月, 2010 2 次提交
    • T
      eCryptfs: Clear LOOKUP_OPEN flag when creating lower file · 2e21b3f1
      Tyler Hicks 提交于
      eCryptfs was passing the LOOKUP_OPEN flag through to the lower file
      system, even though ecryptfs_create() doesn't support the flag. A valid
      filp for the lower filesystem could be returned in the nameidata if the
      lower file system's create() function supported LOOKUP_OPEN, possibly
      resulting in unencrypted writes to the lower file.
      
      However, this is only a potential problem in filesystems (FUSE, NFS,
      CIFS, CEPH, 9p) that eCryptfs isn't known to support today.
      
      https://bugs.launchpad.net/ecryptfs/+bug/641703
      
      Reported-by: Kevin Buhr
      Cc: stable <stable@kernel.org>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      2e21b3f1
    • R
      ecryptfs: call vfs_setxattr() in ecryptfs_setxattr() · 48b512e6
      Roberto Sassu 提交于
      Ecryptfs is a stackable filesystem which relies on lower filesystems the
      ability of setting/getting extended attributes.
      
      If there is a security module enabled on the system it updates the
      'security' field of inodes according to the owned extended attribute set
      with the function vfs_setxattr().  When this function is performed on a
      ecryptfs filesystem the 'security' field is not updated for the lower
      filesystem since the call security_inode_post_setxattr() is missing for
      the lower inode.
      Further, the call security_inode_setxattr() is missing for the lower inode,
      leading to policy violations in the security module because specific
      checks for this hook are not performed (i. e. filesystem
      'associate' permission on SELinux is not checked for the lower filesystem).
      
      This patch replaces the call of the setxattr() method of the lower inode
      in the function ecryptfs_setxattr() with vfs_setxattr().
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Cc: stable <stable@kernel.org>
      Cc: Dustin Kirkland <kirkland@canonical.com>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      48b512e6
  8. 27 8月, 2010 1 次提交
  9. 10 8月, 2010 2 次提交
    • C
      check ATTR_SIZE contraints in inode_change_ok · 2c27c65e
      Christoph Hellwig 提交于
      Make sure we check the truncate constraints early on in ->setattr by adding
      those checks to inode_change_ok.  Also clean up and document inode_change_ok
      to make this obvious.
      
      As a fallout we don't have to call inode_newsize_ok from simple_setsize and
      simplify it down to a truncate_setsize which doesn't return an error.  This
      simplifies a lot of setattr implementations and means we use truncate_setsize
      almost everywhere.  Get rid of fat_setsize now that it's trivial and mark
      ext2_setsize static to make the calling convention obvious.
      
      Keep the inode_newsize_ok in vmtruncate for now as all callers need an
      audit for its removal anyway.
      
      Note: setattr code in ecryptfs doesn't call inode_change_ok at all and
      needs a deeper audit, but that is left for later.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      2c27c65e
    • L
      ecryptfs: dont call lookup_one_len to avoid NULL nameidata · 21edad32
      Lino Sanfilippo 提交于
      I have encountered the same problem that Eric Sandeen described in
      this post
      
       http://lkml.org/lkml/fancy/2010/4/23/467
      
      while experimenting with stackable filesystems.
      
      The reason seems to be that ecryptfs calls lookup_one_len() to get the
      lower dentry, which in turn calls the lower parent dirs d_revalidate()
      with a NULL nameidata object.
      If ecryptfs is the underlaying filesystem, the NULL pointer dereference
      occurs, since ecryptfs is not prepared to handle a NULL nameidata.
      
      I know that this cant happen any more, since it is no longer allowed to
      mount ecryptfs upon itself.
      
      But maybe this patch it useful nevertheless, since the problem would still
      apply for an underlaying filesystem that implements d_revalidate() and is
      not prepared to handle a NULL nameidata (I dont know if there actually
      is such a fs).
      
      With this patch (against 2.6.35-rc5) ecryptfs uses the vfs_lookup_path()
      function instead of lookup_one_len() which ensures that the nameidata
      passed to the lower filesystems d_revalidate().
      Signed-off-by: NLino Sanfilippo <LinoSanfilippo@gmx.de>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      21edad32
  10. 09 8月, 2010 1 次提交
  11. 28 5月, 2010 1 次提交
  12. 22 5月, 2010 1 次提交
  13. 20 4月, 2010 4 次提交
  14. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  15. 24 3月, 2010 3 次提交
  16. 20 1月, 2010 5 次提交
  17. 14 1月, 2010 1 次提交
  18. 17 12月, 2009 1 次提交
  19. 23 9月, 2009 1 次提交
    • T
      eCryptfs: Prevent lower dentry from going negative during unlink · 9c2d2056
      Tyler Hicks 提交于
      When calling vfs_unlink() on the lower dentry, d_delete() turns the
      dentry into a negative dentry when the d_count is 1.  This eventually
      caused a NULL pointer deref when a read() or write() was done and the
      negative dentry's d_inode was dereferenced in
      ecryptfs_read_update_atime() or ecryptfs_getxattr().
      
      Placing mutt's tmpdir in an eCryptfs mount is what initially triggered
      the oops and I was able to reproduce it with the following sequence:
      
      open("/tmp/upper/foo", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 3
      link("/tmp/upper/foo", "/tmp/upper/bar") = 0
      unlink("/tmp/upper/foo")                = 0
      open("/tmp/upper/bar", O_RDWR|O_CREAT|O_NOFOLLOW, 0600) = 4
      unlink("/tmp/upper/bar")                = 0
      write(4, "eCryptfs test\n"..., 14 <unfinished ...>
      +++ killed by SIGKILL +++
      
      https://bugs.launchpad.net/ecryptfs/+bug/387073Reported-by: NLoïc Minier <loic.minier@canonical.com>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
      Cc: ecryptfs-devel@lists.launchpad.net
      Cc: stable <stable@kernel.org>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      9c2d2056
  20. 28 4月, 2009 2 次提交
  21. 23 4月, 2009 2 次提交
    • T
      eCryptfs: Larger buffer for encrypted symlink targets · 3a6b42ca
      Tyler Hicks 提交于
      When using filename encryption with eCryptfs, the value of the symlink
      in the lower filesystem is encrypted and stored as a Tag 70 packet.
      This results in a longer symlink target than if the target value wasn't
      encrypted.
      
      Users were reporting these messages in their syslog:
      
      [ 45.653441] ecryptfs_parse_tag_70_packet: max_packet_size is [56]; real
      packet size is [51]
      [ 45.653444] ecryptfs_decode_and_decrypt_filename: Could not parse tag
      70 packet from filename; copying through filename as-is
      
      This was due to bufsiz, one the arguments in readlink(), being used to
      when allocating the buffer passed to the lower inode's readlink().
      That symlink target may be very large, but when decoded and decrypted,
      could end up being smaller than bufsize.
      
      To fix this, the buffer passed to the lower inode's readlink() will
      always be PATH_MAX in size when filename encryption is enabled.  Any
      necessary truncation occurs after the decoding and decrypting.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      3a6b42ca
    • T
      eCryptfs: Lock lower directory inode mutex during lookup · ca8e34f2
      Tyler Hicks 提交于
      This patch locks the lower directory inode's i_mutex before calling
      lookup_one_len() to find the appropriate dentry in the lower filesystem.
      This bug was found thanks to the warning set in commit 2f9092e1.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      ca8e34f2
  22. 22 4月, 2009 1 次提交
    • T
      eCryptfs: Fix data corruption when using ecryptfs_passthrough · 13a791b4
      Tyler Hicks 提交于
      ecryptfs_passthrough is a mount option that allows eCryptfs to allow
      data to be written to non-eCryptfs files in the lower filesystem.  The
      passthrough option was causing data corruption due to it not always
      being treated as a non-eCryptfs file.
      
      The first 8 bytes of an eCryptfs file contains the decrypted file size.
      This value was being written to the non-eCryptfs files, too.  Also,
      extra 0x00 characters were being written to make the file size a
      multiple of PAGE_CACHE_SIZE.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      13a791b4
  23. 23 3月, 2009 1 次提交