1. 26 2月, 2013 1 次提交
  2. 15 9月, 2012 1 次提交
    • T
      eCryptfs: Copy up attributes of the lower target inode after rename · 8335eafc
      Tyler Hicks 提交于
      After calling into the lower filesystem to do a rename, the lower target
      inode's attributes were not copied up to the eCryptfs target inode. This
      resulted in the eCryptfs target inode staying around, rather than being
      evicted, because i_nlink was not updated for the eCryptfs inode. This
      also meant that eCryptfs didn't do the final iput() on the lower target
      inode so it stayed around, as well. This would result in a failure to
      free up space occupied by the target file in the rename() operation.
      Both target inodes would eventually be evicted when the eCryptfs
      filesystem was unmounted.
      
      This patch calls fsstack_copy_attr_all() after the lower filesystem
      does its ->rename() so that important inode attributes, such as i_nlink,
      are updated at the eCryptfs layer. ecryptfs_evict_inode() is now called
      and eCryptfs can drop its final reference on the lower inode.
      
      http://launchpad.net/bugs/561129Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Tested-by: NColin Ian King <colin.king@canonical.com>
      Cc: <stable@vger.kernel.org> [2.6.39+]
      8335eafc
  3. 30 7月, 2012 2 次提交
  4. 23 7月, 2012 1 次提交
  5. 14 7月, 2012 4 次提交
    • A
      don't pass nameidata * to vfs_create() · 312b63fb
      Al Viro 提交于
      all we want is a boolean flag, same as the method gets now
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      312b63fb
    • A
      don't pass nameidata to ->create() · ebfc3b49
      Al Viro 提交于
      boolean "does it have to be exclusive?" flag is passed instead;
      Local filesystem should just ignore it - the object is guaranteed
      not to be there yet.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ebfc3b49
    • A
      stop passing nameidata to ->lookup() · 00cd8dd3
      Al Viro 提交于
      Just the flags; only NFS cares even about that, but there are
      legitimate uses for such argument.  And getting rid of that
      completely would require splitting ->lookup() into a couple
      of methods (at least), so let's leave that alone for now...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      00cd8dd3
    • T
      eCryptfs: Revert to a writethrough cache model · 821f7494
      Tyler Hicks 提交于
      A change was made about a year ago to get eCryptfs to better utilize its
      page cache during writes. The idea was to do the page encryption
      operations during page writeback, rather than doing them when initially
      writing into the page cache, to reduce the number of page encryption
      operations during sequential writes. This meant that the encrypted page
      would only be written to the lower filesystem during page writeback,
      which was a change from how eCryptfs had previously wrote to the lower
      filesystem in ecryptfs_write_end().
      
      The change caused a few eCryptfs-internal bugs that were shook out.
      Unfortunately, more grave side effects have been identified that will
      force changes outside of eCryptfs. Because the lower filesystem isn't
      consulted until page writeback, eCryptfs has no way to pass lower write
      errors (ENOSPC, mainly) back to userspace. Additionaly, it was reported
      that quotas could be bypassed because of the way eCryptfs may sometimes
      open the lower filesystem using a privileged kthread.
      
      It would be nice to resolve the latest issues, but it is best if the
      eCryptfs commits be reverted to the old behavior in the meantime.
      
      This reverts:
      32001d6f "eCryptfs: Flush file in vma close"
      5be79de2 "eCryptfs: Flush dirty pages in setattr"
      57db4e8d "ecryptfs: modify write path to encrypt page in writepage"
      Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Tested-by: NColin King <colin.king@canonical.com>
      Cc: Colin King <colin.king@canonical.com>
      Cc: Thieu Le <thieule@google.com>
      821f7494
  6. 09 7月, 2012 2 次提交
    • T
      eCryptfs: Initialize empty lower files when opening them · e3ccaa97
      Tyler Hicks 提交于
      Historically, eCryptfs has only initialized lower files in the
      ecryptfs_create() path. Lower file initialization is the act of writing
      the cryptographic metadata from the inode's crypt_stat to the header of
      the file. The ecryptfs_open() path already expects that metadata to be
      in the header of the file.
      
      A number of users have reported empty lower files in beneath their
      eCryptfs mounts. Most of the causes for those empty files being left
      around have been addressed, but the presence of empty files causes
      problems due to the lack of proper cryptographic metadata.
      
      To transparently solve this problem, this patch initializes empty lower
      files in the ecryptfs_open() error path. If the metadata is unreadable
      due to the lower inode size being 0, plaintext passthrough support is
      not in use, and the metadata is stored in the header of the file (as
      opposed to the user.ecryptfs extended attribute), the lower file will be
      initialized.
      
      The number of nested conditionals in ecryptfs_open() was getting out of
      hand, so a helper function was created. To avoid the same nested
      conditional problem, the conditional logic was reversed inside of the
      helper function.
      
      https://launchpad.net/bugs/911507Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Cc: John Johansen <john.johansen@canonical.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      e3ccaa97
    • T
      eCryptfs: Unlink lower inode when ecryptfs_create() fails · 8bc2d3cf
      Tyler Hicks 提交于
      ecryptfs_create() creates a lower inode, allocates an eCryptfs inode,
      initializes the eCryptfs inode and cryptographic metadata attached to
      the inode, and then writes the metadata to the header of the file.
      
      If an error was to occur after the lower inode was created, an empty
      lower file would be left in the lower filesystem. This is a problem
      because ecryptfs_open() refuses to open any lower files which do not
      have the appropriate metadata in the file header.
      
      This patch properly unlinks the lower inode when an error occurs in the
      later stages of ecryptfs_create(), reducing the chance that an empty
      lower file will be left in the lower filesystem.
      
      https://launchpad.net/bugs/872905Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Cc: John Johansen <john.johansen@canonical.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      8bc2d3cf
  7. 30 5月, 2012 1 次提交
  8. 17 2月, 2012 1 次提交
  9. 26 1月, 2012 1 次提交
    • T
      eCryptfs: Check inode changes in setattr · a261a039
      Tyler Hicks 提交于
      Most filesystems call inode_change_ok() very early in ->setattr(), but
      eCryptfs didn't call it at all. It allowed the lower filesystem to make
      the call in its ->setattr() function. Then, eCryptfs would copy the
      appropriate inode attributes from the lower inode to the eCryptfs inode.
      
      This patch changes that and actually calls inode_change_ok() on the
      eCryptfs inode, fairly early in ecryptfs_setattr(). Ideally, the call
      would happen earlier in ecryptfs_setattr(), but there are some possible
      inode initialization steps that must happen first.
      
      Since the call was already being made on the lower inode, the change in
      functionality should be minimal, except for the case of a file extending
      truncate call. In that case, inode_newsize_ok() was never being
      called on the eCryptfs inode. Rather than inode_newsize_ok() catching
      maximum file size errors early on, eCryptfs would encrypt zeroed pages
      and write them to the lower filesystem until the lower filesystem's
      write path caught the error in generic_write_checks(). This patch
      introduces a new function, called ecryptfs_inode_newsize_ok(), which
      checks if the new lower file size is within the appropriate limits when
      the truncate operation will be growing the lower file.
      
      In summary this change prevents eCryptfs truncate operations (and the
      resulting page encryptions), which would exceed the lower filesystem
      limits or FSIZE rlimits, from ever starting.
      Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Reviewed-by: NLi Wang <liwang@nudt.edu.cn>
      Cc: <stable@vger.kernel.org>
      a261a039
  10. 04 1月, 2012 5 次提交
  11. 24 11月, 2011 1 次提交
    • T
      eCryptfs: Prevent file create race condition · b59db43a
      Tyler Hicks 提交于
      The file creation path prematurely called d_instantiate() and
      unlock_new_inode() before the eCryptfs inode info was fully
      allocated and initialized and before the eCryptfs metadata was written
      to the lower file.
      
      This could result in race conditions in subsequent file and inode
      operations leading to unexpected error conditions or a null pointer
      dereference while attempting to use the unallocated memory.
      
      https://launchpad.net/bugs/813146Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Cc: stable@kernel.org
      b59db43a
  12. 02 11月, 2011 1 次提交
  13. 29 7月, 2011 1 次提交
  14. 20 7月, 2011 3 次提交
  15. 30 5月, 2011 4 次提交
  16. 28 5月, 2011 2 次提交
  17. 26 5月, 2011 2 次提交
  18. 26 4月, 2011 5 次提交
    • T
      eCryptfs: Flush dirty pages in setattr · 5be79de2
      Tyler Hicks 提交于
      After 57db4e8d changed eCryptfs to
      write-back caching, eCryptfs page writeback updates the lower inode
      times due to the use of vfs_write() on the lower file.
      
      To preserve inode metadata changes, such as 'cp -p' does with
      utimensat(), we need to flush all dirty pages early in
      ecryptfs_setattr() so that the user-updated lower inode metadata isn't
      clobbered later in writeback.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=33372Reported-by: NRocko <rockorequin@hotmail.com>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      5be79de2
    • T
      eCryptfs: Handle failed metadata read in lookup · 3aeb86ea
      Tyler Hicks 提交于
      When failing to read the lower file's crypto metadata during a lookup,
      eCryptfs must continue on without throwing an error. For example, there
      may be a plaintext file in the lower mount point that the user wants to
      delete through the eCryptfs mount.
      
      If an error is encountered while reading the metadata in lookup(), the
      eCryptfs inode's size could be incorrect. We must be sure to reread the
      plaintext inode size from the metadata when performing an open() or
      setattr(). The metadata is already being read in those paths, so this
      adds minimal performance overhead.
      
      This patch introduces a flag which will track whether or not the
      plaintext inode size has been read so that an incorrect i_size can be
      fixed in the open() or setattr() paths.
      
      https://bugs.launchpad.net/bugs/509180
      
      Cc: <stable@kernel.org>
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      3aeb86ea
    • T
      eCryptfs: Add reference counting to lower files · 332ab16f
      Tyler Hicks 提交于
      For any given lower inode, eCryptfs keeps only one lower file open and
      multiplexes all eCryptfs file operations through that lower file. The
      lower file was considered "persistent" and stayed open from the first
      lookup through the lifetime of the inode.
      
      This patch keeps the notion of a single, per-inode lower file, but adds
      reference counting around the lower file so that it is closed when not
      currently in use. If the reference count is at 0 when an operation (such
      as open, create, etc.) needs to use the lower file, a new lower file is
      opened. Since the file is no longer persistent, all references to the
      term persistent file are changed to lower file.
      
      Locking is added around the sections of code that opens the lower file
      and assign the pointer in the inode info, as well as the code the fputs
      the lower file when all eCryptfs users are done with it.
      
      This patch is needed to fix issues, when mounted on top of the NFSv3
      client, where the lower file is left silly renamed until the eCryptfs
      inode is destroyed.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      332ab16f
    • T
      eCryptfs: dput dentries returned from dget_parent · dd55c898
      Tyler Hicks 提交于
      Call dput on the dentries previously returned by dget_parent() in
      ecryptfs_rename(). This is needed for supported eCryptfs mounts on top
      of the NFSv3 client.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      dd55c898
    • T
      eCryptfs: Remove extra d_delete in ecryptfs_rmdir · 35ffa948
      Tyler Hicks 提交于
      vfs_rmdir() already calls d_delete() on the lower dentry. That was being
      duplicated in ecryptfs_rmdir() and caused a NULL pointer dereference
      when NFSv3 was the lower filesystem.
      Signed-off-by: NTyler Hicks <tyhicks@linux.vnet.ibm.com>
      35ffa948
  19. 28 3月, 2011 2 次提交