15 Jul, 2008

1 commit


05 Jul, 2008

1 commit


03 Jul, 2008

1 commit


07 Jun, 2008

1 commit

  • The page decrypt calls in ecryptfs_write() are both pointless and buggy.
    Pointless because ecryptfs_get_locked_page() has already brought the page
    up to date, and buggy because prior mmap writes will just be blown away by
    the decrypt call.

    This patch also removes the declaration of a now-nonexistent function
    ecryptfs_write_zeros().

    Thanks to Eric Sandeen and David Kleikamp for helping to track this
    down.

    Eric said:

    fsx w/ mmap dies quickly ( < 100 ops) without this, and survives
    nicely (to millions of ops+) with it in place.

    Signed-off-by: Michael Halcrow
    Cc: Eric Sandeen
    Cc: Dave Kleikamp
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     

25 May, 2008

1 commit


22 May, 2008

1 commit


13 May, 2008

2 commits

  • Fix imbalanced calls for mutex lock/unlock on ecryptfs_daemon_hash_mux
    Revealed by Ingo Molnar: http://lkml.org/lkml/2008/5/7/260

    Signed-off-by: Cyrill Gorcunov
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cyrill Gorcunov
     
  • dget(dentry->d_parent) --> dget_parent(dentry)

    unlock_parent() is racy and unnecessary. Replace single caller with
    unlock_dir().

    There are several other suspect uses of ->d_parent in ecryptfs...

    Signed-off-by: Miklos Szeredi
    Cc: Michael Halcrow
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

29 Apr, 2008

8 commits

  • Some drivers have duplicated unlikely() macros. IS_ERR() already has
    unlikely() in itself.

    This patch cleans up such pointless code.

    Signed-off-by: Hirofumi Nakagawa
    Acked-by: David S. Miller
    Acked-by: Jeff Garzik
    Cc: Paul Clements
    Cc: Richard Purdie
    Cc: Alessandro Zummo
    Cc: David Brownell
    Cc: James Bottomley
    Cc: Michael Halcrow
    Cc: Anton Altaparmakov
    Cc: Al Viro
    Cc: Carsten Otte
    Cc: Patrick McHardy
    Cc: Paul Mundt
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hirofumi Nakagawa
     
  • Make sure crypt_stat->flags is protected with a lock in ecryptfs_open().

    Signed-off-by: Michael Halcrow
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • Make eCryptfs key module subsystem respect namespaces.

    Since I will be removing the netlink interface in a future patch, I just made
    changes to the netlink.c code so that it will not break the build. With my
    recent patches, the kernel module currently defaults to the device handle
    interface rather than the netlink interface.

    [akpm@linux-foundation.org: export free_user_ns()]
    Signed-off-by: Michael Halcrow
    Acked-by: Serge Hallyn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • Update the versioning information. Make the message types generic. Add an
    outgoing message queue to the daemon struct. Make the functions to parse
    and write the packet lengths available to the rest of the module. Add
    functions to create and destroy the daemon structs. Clean up some of the
    comments and make the code a little more consistent with itself.

    [akpm@linux-foundation.org: printk fixes]
    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • A regular device file was my real preference from the get-go, but I went with
    netlink at the time because I thought it would be less complex for managing
    send queues (i.e., just do a unicast and move on). It turns out that we do
    not really get that much complexity reduction with netlink, and netlink is
    more heavyweight than a device handle.

    In addition, the netlink interface to eCryptfs has been broken since 2.6.24.
    I am assuming this is a bug in how eCryptfs uses netlink, since the other
    in-kernel users of netlink do not seem to be having any problems. I have had
    one report of a user successfully using eCryptfs with netlink on 2.6.24, but
    for my own systems, when starting the userspace daemon, the initial helo
    message sent to the eCryptfs kernel module results in an oops right off the
    bat. I spent some time looking at it, but I have not yet found the cause.
    The netlink interface breaking gave me the motivation to just finish my patch
    to migrate to a regular device handle. If I cannot find out soon why the
    netlink interface in eCryptfs broke, I am likely to just send a patch to
    disable it in 2.6.24 and 2.6.25. I would like the device handle to be the
    preferred means of communicating with the userspace daemon from 2.6.26 on
    forward.

    This patch:

    Functions to facilitate reading and writing to the eCryptfs miscellaneous
    device handle. This will replace the netlink interface as the preferred
    mechanism for communicating with the userspace eCryptfs daemon.

    Each user has his own daemon, which registers itself by opening the eCryptfs
    device handle. Only one daemon per euid may be registered at any given time.
    The eCryptfs module sends a message to a daemon by adding its message to the
    daemon's outgoing message queue. The daemon reads the device handle to get
    the oldest message off the queue.

    Incoming messages from the userspace daemon are immediately handled. If the
    message is a response, then the corresponding process that is blocked waiting
    for the response is awakened.

    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • Callers of notify_change() need to hold i_mutex.

    Signed-off-by: Miklos Szeredi
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • __FUNCTION__ is gcc-specific, use __func__

    Signed-off-by: Harvey Harrison
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Harvey Harrison
     
  • Remove the no longer used ecryptfs_header_cache_0.

    Signed-off-by: Adrian Bunk
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

20 Mar, 2008

1 commit

  • ecryptfs_d_release() is doing a mntput before doing the dput. This patch
    moves the dput before the mntput.

    Thanks to Rajouri Jammu for reporting this.

    Signed-off-by: Michael Halcrow
    Cc: Rajouri Jammu
    Cc: Eric Sandeen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     

05 Mar, 2008

1 commit

  • When the page is not up to date, ecryptfs_prepare_write() should be
    acting much like ecryptfs_readpage(). This includes the painfully
    obvious step of actually decrypting the page contents read from the
    lower encrypted file.

    Note that this patch resolves a bug in eCryptfs in 2.6.24 that one can
    produce with these steps:

    # mount -t ecryptfs /secret /secret
    # echo "abc" > /secret/file.txt
    # umount /secret
    # mount -t ecryptfs /secret /secret
    # echo "def" >> /secret/file.txt
    # cat /secret/file.txt

    Without this patch, the resulting data returned from cat is likely to
    be something other than "abc\ndef\n".

    (Thanks to Benedikt Driessen for reporting this.)

    Signed-off-by: Michael Halcrow
    Cc: Benedikt Driessen
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     

15 Feb, 2008

2 commits

  • * Add path_put() functions for releasing a reference to the dentry and
    vfsmount of a struct path in the right order

    * Switch from path_release(nd) to path_put(&nd->path)

    * Rename dput_path() to path_put_conditional()

    [akpm@linux-foundation.org: fix cifs]
    Signed-off-by: Jan Blunck
    Signed-off-by: Andreas Gruenbacher
    Acked-by: Christoph Hellwig
    Cc:
    Cc: Al Viro
    Cc: Steven French
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     
  • This is the central patch of a cleanup series. In most cases there is no good
    reason why someone would want to use a dentry for itself. This series reflects
    that fact and embeds a struct path into nameidata.

    Together with the other patches of this series
    - it enforced the correct order of getting/releasing the reference count on
    pairs
    - it prepares the VFS for stacking support since it is essential to have a
    struct path in every place where the stack can be traversed
    - it reduces the overall code size:

    without patch series:
    text data bss dec hex filename
    5321639 858418 715768 6895825 6938d1 vmlinux

    with patch series:
    text data bss dec hex filename
    5320026 858418 715768 6894212 693284 vmlinux

    This patch:

    Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix cifs]
    [akpm@linux-foundation.org: fix smack]
    Signed-off-by: Jan Blunck
    Signed-off-by: Andreas Gruenbacher
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

07 Feb, 2008

8 commits

  • Jeff Moyer pointed out that a mount; umount loop of ecryptfs, with the same
    cipher & other mount options, created a new ecryptfs_key_tfm_cache item
    each time, and the cache could grow quite large this way.

    Looking at this with mhalcrow, we saw that ecryptfs_parse_options()
    unconditionally called ecryptfs_add_new_key_tfm(), which is what was adding
    these items.

    Refactor ecryptfs_get_tfm_and_mutex_for_cipher_name() to create a new
    helper function, ecryptfs_tfm_exists(), which checks for the cipher on the
    cached key_tfm_list, and sets a pointer to it if it exists. This can then
    be called from ecryptfs_parse_options(), and new key_tfm's can be added
    only when a cached one is not found.

    With list locking changes suggested by akpm.

    Signed-off-by: Eric Sandeen
    Cc: Michael Halcrow
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Only the lower byte of cipher_code is ever used, so it makes sense
    for its type to be u8.

    Signed-off-by: Trevor Highland
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trevor Highland
     
  • The printk statements that result when the user does not have the
    proper key available could use some refining.

    Signed-off-by: Mike Halcrow
    Cc: Mike Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • ecryptfs_debug really should not be a mount option; it is not per-mount,
    but rather sets a global "ecryptfs_verbosity" variable which affects all
    mounted filesysytems. It's already settable as a module load option,
    I think we can leave it at that.

    Also, if set, since secret values come out in debug messages, kick
    things off with a stern warning.

    Signed-off-by: Eric Sandeen
    Acked-by: Mike Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Change ecryptfs_show_options to reflect the actual mount options in use.
    Note that this does away with the "dir=" output, which is not a valid mount
    option and appears to be unused.

    Mount options such as "ecryptfs_verbose" and "ecryptfs_xattr_metadata" are
    somewhat indeterminate for a given fs, but in any case the reported mount
    options can be used in a new mount command to get the same behavior.

    [akpm@linux-foundation.org: fix printk warning]
    Signed-off-by: Eric Sandeen
    Acked-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • There is no need to keep re-setting the same key for any given eCryptfs inode.
    This patch optimizes the use of the crypto API and helps performance a bit.

    Signed-off-by: Trevor Highland
    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trevor Highland
     
  • Remove internal references to header extents; just keep track of header bytes
    instead. Headers can easily span multiple pages with the recent persistent
    file changes.

    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • - make the following needlessly global code static:
    - crypto.c:ecryptfs_lower_offset_for_extent()
    - crypto.c:key_tfm_list
    - crypto.c:key_tfm_list_mutex
    - inode.c:ecryptfs_getxattr()
    - main.c:ecryptfs_init_persistent_file()

    - remove the no longer used mmap.c:ecryptfs_lower_page_cache

    - #if 0 the unused read_write.c:ecryptfs_read()

    Signed-off-by: Adrian Bunk
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

06 Feb, 2008

1 commit

  • Simplify page cache zeroing of segments of pages through 3 functions

    zero_user_segments(page, start1, end1, start2, end2)

    Zeros two segments of the page. It takes the position where to
    start and end the zeroing which avoids length calculations and
    makes code clearer.

    zero_user_segment(page, start, end)

    Same for a single segment.

    zero_user(page, start, length)

    Length variant for the case where we know the length.

    We remove the zero_user_page macro. Issues:

    1. Its a macro. Inline functions are preferable.

    2. The KM_USER0 macro is only defined for HIGHMEM.

    Having to treat this special case everywhere makes the
    code needlessly complex. The parameter for zeroing is always
    KM_USER0 except in one single case that we open code.

    Avoiding KM_USER0 makes a lot of code not having to be dealing
    with the special casing for HIGHMEM anymore. Dealing with
    kmap is only necessary for HIGHMEM configurations. In those
    configurations we use KM_USER0 like we do for a series of other
    functions defined in highmem.h.

    Since KM_USER0 is depends on HIGHMEM the existing zero_user_page
    function could not be a macro. zero_user_* functions introduced
    here can be be inline because that constant is not used when these
    functions are called.

    Also extract the flushing of the caches to be outside of the kmap.

    [akpm@linux-foundation.org: fix nfs and ntfs build]
    [akpm@linux-foundation.org: fix ntfs build some more]
    Signed-off-by: Christoph Lameter
    Cc: Steven French
    Cc: Michael Halcrow
    Cc:
    Cc: Steven Whitehouse
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Anton Altaparmakov
    Cc: Mark Fasheh
    Cc: David Chinner
    Cc: Michael Halcrow
    Cc: Steven French
    Cc: Steven Whitehouse
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

29 Jan, 2008

1 commit


25 Jan, 2008

8 commits


09 Jan, 2008

1 commit

  • This patch corrects some erroneous dentry handling in eCryptfs.

    If there is a problem creating the lower file, then there is nothing that
    the persistent lower file can do to really help us. This patch makes a
    vfs_create() failure in the lower filesystem always lead to an
    unconditional do_create failure in eCryptfs.

    Under certain sequences of operations, the eCryptfs dentry can remain in
    the dcache after an unlink. This patch calls d_drop() on the eCryptfs
    dentry to correct this.

    eCryptfs has no business calling d_delete() directly on a lower
    filesystem's dentry. This patch removes the call to d_delete() on the
    lower persistent file's dentry in ecryptfs_destroy_inode().

    (Thanks to David Kleikamp, Eric Sandeen, and Jeff Moyer for helping
    identify and resolve this issue)

    Signed-off-by: Michael Halcrow
    Cc: Dave Kleikamp
    Cc: Eric Sandeen
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     

24 Dec, 2007

1 commit

  • Thanks to Jeff Moyer for pointing this out.

    If the RDWR dentry_open() in ecryptfs_init_persistent_file fails,
    it will do a dput/mntput. Need to re-take references if we
    retry as RDONLY.

    Signed-off-by: Eric Sandeen
    Acked-by: Mike Halcrow
    Signed-off-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen