07 Jan, 2012

1 commit


04 Jan, 2012

6 commits


24 Nov, 2011

3 commits

  • 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: Tyler Hicks
    Reported-by: Michael Halcrow
    Cc: stable@kernel.org

    Tyler Hicks
     
  • Dirty pages weren't being written back when an mmap'ed eCryptfs file was
    closed before the mapping was unmapped. Since f_ops->flush() is not
    called by the munmap() path, the lower file was simply being released.
    This patch flushes the eCryptfs file in the vm_ops->close() path.

    https://launchpad.net/bugs/870326

    Signed-off-by: Tyler Hicks
    Cc: stable@kernel.org [2.6.39+]

    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/813146

    Signed-off-by: Tyler Hicks
    Cc: stable@kernel.org

    Tyler Hicks
     

02 Nov, 2011

1 commit


01 Nov, 2011

1 commit

  • Standardize the style for compiler based printf format verification.
    Standardized the location of __printf too.

    Done via script and a little typing.

    $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
    grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
    xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

    [akpm@linux-foundation.org: revert arch bits]
    Signed-off-by: Joe Perches
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

10 Aug, 2011

4 commits

  • Close a TOCTOU race for mounts done via ecryptfs-mount-private. The mount
    source (device) can be raced when the ownership test is done in userspace.
    Provide Ecryptfs a means to force the uid check at mount time.

    Signed-off-by: John Johansen
    Cc:
    Signed-off-by: Tyler Hicks

    John Johansen
     
  • fs/ecryptfs/keystore.c: In function ‘ecryptfs_generate_key_packet_set’:
    fs/ecryptfs/keystore.c:1991:28: warning: ‘payload_len’ may be used uninitialized in this function [-Wuninitialized]
    fs/ecryptfs/keystore.c:1976:9: note: ‘payload_len’ was declared here

    Signed-off-by: Tyler Hicks

    Tyler Hicks
     
  • This patch fixes the compile error reported at the address:

    https://bugzilla.kernel.org/show_bug.cgi?id=40292

    The problem arises when compiling eCryptfs as built-in and the 'encrypted'
    key type as a module. The patch prevents this combination from being set in
    the kernel configuration, by fixing the eCryptfs dependencies.

    Signed-off-by: Roberto Sassu
    Reported-by: David Hill
    Signed-off-by: Tyler Hicks

    Roberto Sassu
     
  • When an eCryptfs inode's lower file has been closed, and the pointer has
    been set to NULL, return an error when trying to do a lower read or
    write rather than calling BUG().

    https://bugzilla.kernel.org/show_bug.cgi?id=37292

    Signed-off-by: Tyler Hicks
    Cc:

    Tyler Hicks
     

29 Jul, 2011

2 commits

  • Make the inode mapping bdi consistent with the superblock bdi so that
    dirty pages are flushed properly.

    Signed-off-by: Thieu Le
    Cc: [2.6.39+]
    Signed-off-by: Tyler Hicks

    Thieu Le
     
  • Fixes a regression caused by b5695d04634fa4ccca7dcbc05bb4a66522f02e0b

    Kernel keyring keys containing eCryptfs authentication tokens should not
    be write locked when calling out to ecryptfsd to wrap and unwrap file
    encryption keys. The eCryptfs kernel code can not hold the key's write
    lock because ecryptfsd needs to request the key after receiving such a
    request from the kernel.

    Without this fix, all file opens and creates will timeout and fail when
    using the eCryptfs PKI infrastructure. This is not an issue when using
    passphrase-based mount keys, which is the most widely deployed eCryptfs
    configuration.

    Signed-off-by: Tyler Hicks
    Acked-by: Roberto Sassu
    Tested-by: Roberto Sassu
    Tested-by: Alexis Hafner1
    Cc: [2.6.39+]

    Tyler Hicks
     

28 Jul, 2011

1 commit

  • …s/security-testing-2.6

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (54 commits)
    tpm_nsc: Fix bug when loading multiple TPM drivers
    tpm: Move tpm_tis_reenable_interrupts out of CONFIG_PNP block
    tpm: Fix compilation warning when CONFIG_PNP is not defined
    TOMOYO: Update kernel-doc.
    tpm: Fix a typo
    tpm_tis: Probing function for Intel iTPM bug
    tpm_tis: Fix the probing for interrupts
    tpm_tis: Delay ACPI S3 suspend while the TPM is busy
    tpm_tis: Re-enable interrupts upon (S3) resume
    tpm: Fix display of data in pubek sysfs entry
    tpm_tis: Add timeouts sysfs entry
    tpm: Adjust interface timeouts if they are too small
    tpm: Use interface timeouts returned from the TPM
    tpm_tis: Introduce durations sysfs entry
    tpm: Adjust the durations if they are too small
    tpm: Use durations returned from TPM
    TOMOYO: Enable conditional ACL.
    TOMOYO: Allow using argv[]/envp[] of execve() as conditions.
    TOMOYO: Allow using executable's realpath and symlink's target as conditions.
    TOMOYO: Allow using owner/group etc. of file objects as conditions.
    ...

    Fix up trivial conflict in security/tomoyo/realpath.c

    Linus Torvalds
     

26 Jul, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    fs: Merge split strings
    treewide: fix potentially dangerous trailing ';' in #defined values/expressions
    uwb: Fix misspelling of neighbourhood in comment
    net, netfilter: Remove redundant goto in ebt_ulog_packet
    trivial: don't touch files that are removed in the staging tree
    lib/vsprintf: replace link to Draft by final RFC number
    doc: Kconfig: `to be' -> `be'
    doc: Kconfig: Typo: square -> squared
    doc: Konfig: Documentation/power/{pm => apm-acpi}.txt
    drivers/net: static should be at beginning of declaration
    drivers/media: static should be at beginning of declaration
    drivers/i2c: static should be at beginning of declaration
    XTENSA: static should be at beginning of declaration
    SH: static should be at beginning of declaration
    MIPS: static should be at beginning of declaration
    ARM: static should be at beginning of declaration
    rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check
    Update my e-mail address
    PCIe ASPM: forcedly -> forcibly
    gma500: push through device driver tree
    ...

    Fix up trivial conflicts:
    - arch/arm/mach-ep93xx/dma-m2p.c (deleted)
    - drivers/gpio/gpio-ep93xx.c (renamed and context nearby)
    - drivers/net/r8169.c (just context changes)

    Linus Torvalds
     

22 Jul, 2011

1 commit


21 Jul, 2011

1 commit

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     

20 Jul, 2011

3 commits


27 Jun, 2011

2 commits


30 May, 2011

6 commits

  • Now that ecryptfs_lookup_interpose() is no longer using
    ecryptfs_header_cache_2 to read in metadata, the kmem_cache can be
    removed and the ecryptfs_header_cache_1 kmem_cache can be renamed to
    ecryptfs_header_cache.

    Signed-off-by: Tyler Hicks

    Tyler Hicks
     
  • ecryptfs_lookup_interpose() has turned into spaghetti code over the
    years. This is an effort to clean it up.

    - Shorten overly descriptive variable names such as ecryptfs_dentry
    - Simplify gotos and error paths
    - Create helper function for reading plaintext i_size from metadata

    It also includes an optimization when reading i_size from the metadata.
    A complete page-sized kmem_cache_alloc() was being done to read in 16
    bytes of metadata. The buffer for that is now statically declared.

    Signed-off-by: Tyler Hicks

    Tyler Hicks
     
  • Instead of having the calling functions translate the true/false return
    code to either 0 or -EINVAL, have contains_ecryptfs_marker() return 0 or
    -EINVAL so that the calling functions can just reuse the return code.

    Also, rename the function to ecryptfs_validate_marker() to avoid callers
    mistakenly thinking that it returns true/false codes.

    Signed-off-by: Tyler Hicks

    Tyler Hicks
     
  • Only unlock and d_add() new inodes after the plaintext inode size has
    been read from the lower filesystem. This fixes a race condition that
    was sometimes seen during a multi-job kernel build in an eCryptfs mount.

    https://bugzilla.kernel.org/show_bug.cgi?id=36002

    Signed-off-by: Tyler Hicks
    Reported-by: David
    Tested-by: David

    Tyler Hicks
     
  • The eCryptfs inode get, initialization, and dentry interposition code
    has two separate paths. One is for when dentry interposition is needed
    after doing things like a mkdir in the lower filesystem and the other
    is needed after a lookup. Unlocking new inodes and doing a d_add() needs
    to happen at different times, depending on which type of dentry
    interposing is being done.

    This patch cleans up the inode get and initialization code paths and
    splits them up so that the locking and d_add() differences mentioned
    above can be handled appropriately in a later patch.

    Signed-off-by: Tyler Hicks
    Tested-by: David

    Tyler Hicks
     
  • These functions should live in inode.c since their focus is on inodes
    and they're primarily used by functions in inode.c.

    Also does a simple cleanup of ecryptfs_inode_test() and rolls
    ecryptfs_init_inode() into ecryptfs_inode_set().

    Signed-off-by: Tyler Hicks
    Tested-by: David

    Tyler Hicks
     

29 May, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (36 commits)
    Cache xattr security drop check for write v2
    fs: block_page_mkwrite should wait for writeback to finish
    mm: Wait for writeback when grabbing pages to begin a write
    configfs: remove unnecessary dentry_unhash on rmdir, dir rename
    fat: remove unnecessary dentry_unhash on rmdir, dir rename
    hpfs: remove unnecessary dentry_unhash on rmdir, dir rename
    minix: remove unnecessary dentry_unhash on rmdir, dir rename
    fuse: remove unnecessary dentry_unhash on rmdir, dir rename
    coda: remove unnecessary dentry_unhash on rmdir, dir rename
    afs: remove unnecessary dentry_unhash on rmdir, dir rename
    affs: remove unnecessary dentry_unhash on rmdir, dir rename
    9p: remove unnecessary dentry_unhash on rmdir, dir rename
    ncpfs: fix rename over directory with dangling references
    ncpfs: document dentry_unhash usage
    ecryptfs: remove unnecessary dentry_unhash on rmdir, dir rename
    hostfs: remove unnecessary dentry_unhash on rmdir, dir rename
    hfsplus: remove unnecessary dentry_unhash on rmdir, dir rename
    hfs: remove unnecessary dentry_unhash on rmdir, dir rename
    omfs: remove unnecessary dentry_unhash on rmdir, dir rneame
    udf: remove unnecessary dentry_unhash from rmdir, dir rename
    ...

    Linus Torvalds
     

28 May, 2011

4 commits

  • ecryptfs does not have problems with references to unlinked directories.

    CC: Tyler Hicks
    CC: Dustin Kirkland
    CC: ecryptfs-devel@lists.launchpad.net
    Signed-off-by: Sage Weil
    Signed-off-by: Al Viro

    Sage Weil
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
    MAINTAINERS: Update eCryptfs mailing list
    eCryptfs: Allow 2 scatterlist entries for encrypted filenames
    eCryptfs: Clear i_nlink in rmdir

    Linus Torvalds
     
  • The buffers allocated while encrypting and decrypting long filenames can
    sometimes straddle two pages. In this situation, virt_to_scatterlist()
    will return -ENOMEM, causing the operation to fail and the user will get
    scary error messages in their logs:

    kernel: ecryptfs_write_tag_70_packet: Internal error whilst attempting
    to convert filename memory to scatterlist; expected rc = 1; got rc =
    [-12]. block_aligned_filename_size = [272]
    kernel: ecryptfs_encrypt_filename: Error attempting to generate tag 70
    packet; rc = [-12]
    kernel: ecryptfs_encrypt_and_encode_filename: Error attempting to
    encrypt filename; rc = [-12]
    kernel: ecryptfs_lookup: Error attempting to encrypt and encode
    filename; rc = [-12]

    The solution is to allow up to 2 scatterlist entries to be used.

    Signed-off-by: Tyler Hicks
    Cc:

    Tyler Hicks
     
  • eCryptfs wasn't clearing the eCryptfs inode's i_nlink after a successful
    vfs_rmdir() on the lower directory. This resulted in the inode evict and
    destroy paths to be missed.

    https://bugs.launchpad.net/ecryptfs/+bug/723518

    Signed-off-by: Tyler Hicks
    Cc:

    Tyler Hicks
     

26 May, 2011

2 commits