1. 17 4月, 2018 1 次提交
    • T
      eCryptfs: don't pass up plaintext names when using filename encryption · e86281e7
      Tyler Hicks 提交于
      Both ecryptfs_filldir() and ecryptfs_readlink_lower() use
      ecryptfs_decode_and_decrypt_filename() to translate lower filenames to
      upper filenames. The function correctly passes up lower filenames,
      unchanged, when filename encryption isn't in use. However, it was also
      passing up lower filenames when the filename wasn't encrypted or
      when decryption failed. Since 88ae4ab9, eCryptfs refuses to lookup
      lower plaintext names when filename encryption is enabled so this
      resulted in a situation where userspace would see lower plaintext
      filenames in calls to getdents(2) but then not be able to lookup those
      filenames.
      
      An example of this can be seen when enabling filename encryption on an
      eCryptfs mount at the root directory of an Ext4 filesystem:
      
      $ ls -1i /lower
      12 ECRYPTFS_FNEK_ENCRYPTED.FWYZD8TcW.5FV-TKTEYOHsheiHX9a-w.NURCCYIMjI8pn5BDB9-h3fXwrE--
      11 lost+found
      $ ls -1i /upper
      ls: cannot access '/upper/lost+found': No such file or directory
       ? lost+found
      12 test
      
      With this change, the lower lost+found dentry is ignored:
      
      $ ls -1i /lower
      12 ECRYPTFS_FNEK_ENCRYPTED.FWYZD8TcW.5FV-TKTEYOHsheiHX9a-w.NURCCYIMjI8pn5BDB9-h3fXwrE--
      11 lost+found
      $ ls -1i /upper
      12 test
      
      Additionally, some potentially noisy error/info messages in the related
      code paths are turned into debug messages so that the logs can't be
      easily filled.
      
      Fixes: 88ae4ab9 ("ecryptfs_lookup(): try either only encrypted or plaintext name")
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      e86281e7
  2. 07 11月, 2017 3 次提交
  3. 05 11月, 2017 1 次提交
  4. 20 6月, 2016 2 次提交
  5. 28 5月, 2016 1 次提交
  6. 20 4月, 2016 1 次提交
  7. 11 4月, 2016 1 次提交
  8. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  9. 23 2月, 2016 1 次提交
  10. 27 1月, 2016 1 次提交
  11. 19 8月, 2015 1 次提交
  12. 16 4月, 2015 1 次提交
  13. 27 11月, 2014 1 次提交
  14. 20 11月, 2014 1 次提交
  15. 15 11月, 2013 1 次提交
  16. 25 10月, 2013 1 次提交
  17. 07 9月, 2013 2 次提交
  18. 29 6月, 2013 1 次提交
  19. 08 6月, 2013 10 次提交
  20. 10 5月, 2013 1 次提交
    • T
      eCryptfs: Use the ablkcipher crypto API · 4dfea4f0
      Tyler Hicks 提交于
      Make the switch from the blkcipher kernel crypto interface to the
      ablkcipher interface.
      
      encrypt_scatterlist() and decrypt_scatterlist() now use the ablkcipher
      interface but, from the eCryptfs standpoint, still treat the crypto
      operation as a synchronous operation. They submit the async request and
      then wait until the operation is finished before they return. Most of
      the changes are contained inside those two functions.
      
      Despite waiting for the completion of the crypto operation, the
      ablkcipher interface provides performance increases in most cases when
      used on AES-NI capable hardware.
      Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Acked-by: NColin King <colin.king@canonical.com>
      Reviewed-by: NZeev Zilberman <zeev@annapurnaLabs.com>
      Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>
      Cc: Tim Chen <tim.c.chen@intel.com>
      Cc: Ying Huang <ying.huang@intel.com>
      Cc: Thieu Le <thieule@google.com>
      Cc: Li Wang <dragonylffly@163.com>
      Cc: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
      4dfea4f0
  21. 29 1月, 2013 1 次提交
  22. 19 12月, 2012 1 次提交
  23. 17 2月, 2012 1 次提交
  24. 26 1月, 2012 3 次提交
  25. 24 11月, 2011 1 次提交
    • T
      eCryptfs: Extend array bounds for all filename chars · 0f751e64
      Tyler Hicks 提交于
      From mhalcrow's original commit message:
      
          Characters with ASCII values greater than the size of
          filename_rev_map[] are valid filename characters.
          ecryptfs_decode_from_filename() will access kernel memory beyond
          that array, and ecryptfs_parse_tag_70_packet() will then decrypt
          those characters. The attacker, using the FNEK of the crafted file,
          can then re-encrypt the characters to reveal the kernel memory past
          the end of the filename_rev_map[] array. I expect low security
          impact since this array is statically allocated in the text area,
          and the amount of memory past the array that is accessible is
          limited by the largest possible ASCII filename character.
      
      This patch solves the issue reported by mhalcrow but with an
      implementation suggested by Linus to simply extend the length of
      filename_rev_map[] to 256. Characters greater than 0x7A are mapped to
      0x00, which is how invalid characters less than 0x7A were previously
      being handled.
      Signed-off-by: NTyler Hicks <tyhicks@canonical.com>
      Reported-by: NMichael Halcrow <mhalcrow@google.com>
      Cc: stable@kernel.org
      0f751e64