<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs/ecryptfs/super.c, branch v2.6.35.1</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>fix a couple of ecryptfs leaks</title>
<updated>2010-05-21T22:31:13+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2010-03-21T02:32:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=decabd6650915a9534dad09e967115513be12b24'/>
<id>decabd6650915a9534dad09e967115513be12b24</id>
<content type='text'>
First of all, get_sb_nodev() grabs anon dev minor and we
never free it in ecryptfs -&gt;kill_sb().  Moreover, on one
of the failure exits in ecryptfs_get_sb() we leak things -
it happens before we set -&gt;s_root and -&gt;put_super() won't
be called in that case.  Solution: kill -&gt;put_super(), do
all that stuff in -&gt;kill_sb().  And use kill_anon_sb() instead
of generic_shutdown_super() to deal with anon dev leak.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
First of all, get_sb_nodev() grabs anon dev minor and we
never free it in ecryptfs -&gt;kill_sb().  Moreover, on one
of the failure exits in ecryptfs_get_sb() we leak things -
it happens before we set -&gt;s_root and -&gt;put_super() won't
be called in that case.  Solution: kill -&gt;put_super(), do
all that stuff in -&gt;kill_sb().  And use kill_anon_sb() instead
of generic_shutdown_super() to deal with anon dev leak.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ecryptfs: add bdi backing to mount session</title>
<updated>2010-04-22T10:22:04+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>jens.axboe@oracle.com</email>
</author>
<published>2010-04-22T10:22:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9df9c8b930156a2f9ce2b2ae66acb14bee2663f5'/>
<id>9df9c8b930156a2f9ce2b2ae66acb14bee2663f5</id>
<content type='text'>
This ensures that dirty data gets flushed properly.

Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This ensures that dirty data gets flushed properly.

Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6</title>
<updated>2010-04-19T21:20:32+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-04-19T21:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9b030e2006546366c832911ca5eb9e785408795b'/>
<id>9b030e2006546366c832911ca5eb9e785408795b</id>
<content type='text'>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
  eCryptfs: Turn lower lookup error messages into debug messages
  eCryptfs: Copy lower directory inode times and size on link
  ecryptfs: fix use with tmpfs by removing d_drop from ecryptfs_destroy_inode
  ecryptfs: fix error code for missing xattrs in lower fs
  eCryptfs: Decrypt symlink target for stat size
  eCryptfs: Strip metadata in xattr flag in encrypted view
  eCryptfs: Clear buffer before reading in metadata xattr
  eCryptfs: Rename ecryptfs_crypt_stat.num_header_bytes_at_front
  eCryptfs: Fix metadata in xattr feature regression
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
  eCryptfs: Turn lower lookup error messages into debug messages
  eCryptfs: Copy lower directory inode times and size on link
  ecryptfs: fix use with tmpfs by removing d_drop from ecryptfs_destroy_inode
  ecryptfs: fix error code for missing xattrs in lower fs
  eCryptfs: Decrypt symlink target for stat size
  eCryptfs: Strip metadata in xattr flag in encrypted view
  eCryptfs: Clear buffer before reading in metadata xattr
  eCryptfs: Rename ecryptfs_crypt_stat.num_header_bytes_at_front
  eCryptfs: Fix metadata in xattr feature regression
</pre>
</div>
</content>
</entry>
<entry>
<title>ecryptfs: fix use with tmpfs by removing d_drop from ecryptfs_destroy_inode</title>
<updated>2010-04-19T19:42:13+00:00</updated>
<author>
<name>Jeff Mahoney</name>
<email>jeffm@jeffreymahoney.com</email>
</author>
<published>2010-03-19T19:35:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=133b8f9d632cc23715c6d72d1c5ac449e054a12a'/>
<id>133b8f9d632cc23715c6d72d1c5ac449e054a12a</id>
<content type='text'>
Since tmpfs has no persistent storage, it pins all its dentries in memory
so they have d_count=1 when other file systems would have d_count=0.
-&gt;lookup is only used to create new dentries. If the caller doesn't
instantiate it, it's freed immediately at dput(). -&gt;readdir reads
directly from the dcache and depends on the dentries being hashed.

When an ecryptfs mount is mounted, it associates the lower file and dentry
with the ecryptfs files as they're accessed. When it's umounted and
destroys all the in-memory ecryptfs inodes, it fput's the lower_files and
d_drop's the lower_dentries. Commit 4981e081 added this and a d_delete in
2008 and several months later commit caeeeecf removed the d_delete. I
believe the d_drop() needs to be removed as well.

The d_drop effectively hides any file that has been accessed via ecryptfs
from the underlying tmpfs since it depends on it being hashed for it to
be accessible. I've removed the d_drop on my development node and see no
ill effects with basic testing on both tmpfs and persistent storage.

As a side effect, after ecryptfs d_drops the dentries on tmpfs, tmpfs
BUGs on umount. This is due to the dentries being unhashed.
tmpfs-&gt;kill_sb is kill_litter_super which calls d_genocide to drop
the reference pinning the dentry. It skips unhashed and negative dentries,
but shrink_dcache_for_umount_subtree doesn't. Since those dentries
still have an elevated d_count, we get a BUG().

This patch removes the d_drop call and fixes both issues.

This issue was reported at:
https://bugzilla.novell.com/show_bug.cgi?id=567887

Reported-by:  Árpád Bíró &lt;biroa@demasz.hu&gt;
Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Dustin Kirkland &lt;kirkland@canonical.com&gt;
Cc: stable@kernel.org
Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since tmpfs has no persistent storage, it pins all its dentries in memory
so they have d_count=1 when other file systems would have d_count=0.
-&gt;lookup is only used to create new dentries. If the caller doesn't
instantiate it, it's freed immediately at dput(). -&gt;readdir reads
directly from the dcache and depends on the dentries being hashed.

When an ecryptfs mount is mounted, it associates the lower file and dentry
with the ecryptfs files as they're accessed. When it's umounted and
destroys all the in-memory ecryptfs inodes, it fput's the lower_files and
d_drop's the lower_dentries. Commit 4981e081 added this and a d_delete in
2008 and several months later commit caeeeecf removed the d_delete. I
believe the d_drop() needs to be removed as well.

The d_drop effectively hides any file that has been accessed via ecryptfs
from the underlying tmpfs since it depends on it being hashed for it to
be accessible. I've removed the d_drop on my development node and see no
ill effects with basic testing on both tmpfs and persistent storage.

As a side effect, after ecryptfs d_drops the dentries on tmpfs, tmpfs
BUGs on umount. This is due to the dentries being unhashed.
tmpfs-&gt;kill_sb is kill_litter_super which calls d_genocide to drop
the reference pinning the dentry. It skips unhashed and negative dentries,
but shrink_dcache_for_umount_subtree doesn't. Since those dentries
still have an elevated d_count, we get a BUG().

This patch removes the d_drop call and fixes both issues.

This issue was reported at:
https://bugzilla.novell.com/show_bug.cgi?id=567887

Reported-by:  Árpád Bíró &lt;biroa@demasz.hu&gt;
Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Cc: Dustin Kirkland &lt;kirkland@canonical.com&gt;
Cc: stable@kernel.org
Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h</title>
<updated>2010-03-30T13:02:32+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-03-24T08:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5a0e3ad6af8660be21ca98a971cd00f331318c05'/>
<id>5a0e3ad6af8660be21ca98a971cd00f331318c05</id>
<content type='text'>
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 -&gt; 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: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 -&gt; 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: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ecryptfs: Remove unneeded locking that triggers lockdep false positives</title>
<updated>2009-09-23T14:10:30+00:00</updated>
<author>
<name>Roland Dreier</name>
<email>roland@digitalvampire.org</email>
</author>
<published>2009-07-14T20:32:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=05dafedb906425fe935199f4c92700d87285e3e9'/>
<id>05dafedb906425fe935199f4c92700d87285e3e9</id>
<content type='text'>
In ecryptfs_destroy_inode(), inode_info-&gt;lower_file_mutex is locked,
and just after the mutex is unlocked, the code does:

 	kmem_cache_free(ecryptfs_inode_info_cache, inode_info);

This means that if another context could possibly try to take the same
mutex as ecryptfs_destroy_inode(), then it could end up getting the
mutex just before the data structure containing the mutex is freed.
So any such use would be an obvious use-after-free bug (catchable with
slab poisoning or mutex debugging), and therefore the locking in
ecryptfs_destroy_inode() is not needed and can be dropped.

Similarly, in ecryptfs_destroy_crypt_stat(), crypt_stat-&gt;keysig_list_mutex
is locked, and then the mutex is unlocked just before the code does:

 	memset(crypt_stat, 0, sizeof(struct ecryptfs_crypt_stat));

Therefore taking this mutex is similarly not necessary.

Removing this locking fixes false-positive lockdep reports such as the
following (and they are false-positives for exactly the same reason
that the locking is not needed):

=================================
[ INFO: inconsistent lock state ]
2.6.31-2-generic #14~rbd3
---------------------------------
inconsistent {RECLAIM_FS-ON-W} -&gt; {IN-RECLAIM_FS-W} usage.
kswapd0/323 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&amp;inode_info-&gt;lower_file_mutex){+.+.?.}, at: [&lt;ffffffff81210d34&gt;] ecryptfs_destroy_inode+0x34/0x100
{RECLAIM_FS-ON-W} state was registered at:
  [&lt;ffffffff8108c02c&gt;] mark_held_locks+0x6c/0xa0
  [&lt;ffffffff8108c10f&gt;] lockdep_trace_alloc+0xaf/0xe0
  [&lt;ffffffff81125a51&gt;] kmem_cache_alloc+0x41/0x1a0
  [&lt;ffffffff8113117a&gt;] get_empty_filp+0x7a/0x1a0
  [&lt;ffffffff8112dd46&gt;] dentry_open+0x36/0xc0
  [&lt;ffffffff8121a36c&gt;] ecryptfs_privileged_open+0x5c/0x2e0
  [&lt;ffffffff81210283&gt;] ecryptfs_init_persistent_file+0xa3/0xe0
  [&lt;ffffffff8120e838&gt;] ecryptfs_lookup_and_interpose_lower+0x278/0x380
  [&lt;ffffffff8120f97a&gt;] ecryptfs_lookup+0x12a/0x250
  [&lt;ffffffff8113930a&gt;] real_lookup+0xea/0x160
  [&lt;ffffffff8113afc8&gt;] do_lookup+0xb8/0xf0
  [&lt;ffffffff8113b518&gt;] __link_path_walk+0x518/0x870
  [&lt;ffffffff8113bd9c&gt;] path_walk+0x5c/0xc0
  [&lt;ffffffff8113be5b&gt;] do_path_lookup+0x5b/0xa0
  [&lt;ffffffff8113bfe7&gt;] user_path_at+0x57/0xa0
  [&lt;ffffffff811340dc&gt;] vfs_fstatat+0x3c/0x80
  [&lt;ffffffff8113424b&gt;] vfs_stat+0x1b/0x20
  [&lt;ffffffff81134274&gt;] sys_newstat+0x24/0x50
  [&lt;ffffffff81013132&gt;] system_call_fastpath+0x16/0x1b
  [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff
irq event stamp: 7811
hardirqs last  enabled at (7811): [&lt;ffffffff810c037f&gt;] call_rcu+0x5f/0x90
hardirqs last disabled at (7810): [&lt;ffffffff810c0353&gt;] call_rcu+0x33/0x90
softirqs last  enabled at (3764): [&lt;ffffffff810631da&gt;] __do_softirq+0x14a/0x220
softirqs last disabled at (3751): [&lt;ffffffff8101440c&gt;] call_softirq+0x1c/0x30

other info that might help us debug this:
2 locks held by kswapd0/323:
 #0:  (shrinker_rwsem){++++..}, at: [&lt;ffffffff810f67ed&gt;] shrink_slab+0x3d/0x190
 #1:  (&amp;type-&gt;s_umount_key#35){.+.+..}, at: [&lt;ffffffff811429a1&gt;] prune_dcache+0xd1/0x1b0

stack backtrace:
Pid: 323, comm: kswapd0 Tainted: G         C 2.6.31-2-generic #14~rbd3
Call Trace:
 [&lt;ffffffff8108ad6c&gt;] print_usage_bug+0x18c/0x1a0
 [&lt;ffffffff8108aff0&gt;] ? check_usage_forwards+0x0/0xc0
 [&lt;ffffffff8108bac2&gt;] mark_lock_irq+0xf2/0x280
 [&lt;ffffffff8108bd87&gt;] mark_lock+0x137/0x1d0
 [&lt;ffffffff81164710&gt;] ? fsnotify_clear_marks_by_inode+0x30/0xf0
 [&lt;ffffffff8108bee6&gt;] mark_irqflags+0xc6/0x1a0
 [&lt;ffffffff8108d337&gt;] __lock_acquire+0x287/0x430
 [&lt;ffffffff8108d585&gt;] lock_acquire+0xa5/0x150
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff8108d2e7&gt;] ? __lock_acquire+0x237/0x430
 [&lt;ffffffff815526ad&gt;] __mutex_lock_common+0x4d/0x3d0
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff81164710&gt;] ? fsnotify_clear_marks_by_inode+0x30/0xf0
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff8129a91e&gt;] ? _raw_spin_unlock+0x5e/0xb0
 [&lt;ffffffff81552b36&gt;] mutex_lock_nested+0x46/0x60
 [&lt;ffffffff81210d34&gt;] ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff81145d27&gt;] destroy_inode+0x87/0xd0
 [&lt;ffffffff81146b4c&gt;] generic_delete_inode+0x12c/0x1a0
 [&lt;ffffffff81145832&gt;] iput+0x62/0x70
 [&lt;ffffffff811423c8&gt;] dentry_iput+0x98/0x110
 [&lt;ffffffff81142550&gt;] d_kill+0x50/0x80
 [&lt;ffffffff81142623&gt;] prune_one_dentry+0xa3/0xc0
 [&lt;ffffffff811428b1&gt;] __shrink_dcache_sb+0x271/0x290
 [&lt;ffffffff811429d9&gt;] prune_dcache+0x109/0x1b0
 [&lt;ffffffff81142abf&gt;] shrink_dcache_memory+0x3f/0x50
 [&lt;ffffffff810f68dd&gt;] shrink_slab+0x12d/0x190
 [&lt;ffffffff810f9377&gt;] balance_pgdat+0x4d7/0x640
 [&lt;ffffffff8104c4c0&gt;] ? finish_task_switch+0x40/0x150
 [&lt;ffffffff810f63c0&gt;] ? isolate_pages_global+0x0/0x60
 [&lt;ffffffff810f95f7&gt;] kswapd+0x117/0x170
 [&lt;ffffffff810777a0&gt;] ? autoremove_wake_function+0x0/0x40
 [&lt;ffffffff810f94e0&gt;] ? kswapd+0x0/0x170
 [&lt;ffffffff810773be&gt;] kthread+0x9e/0xb0
 [&lt;ffffffff8101430a&gt;] child_rip+0xa/0x20
 [&lt;ffffffff81013c90&gt;] ? restore_args+0x0/0x30
 [&lt;ffffffff81077320&gt;] ? kthread+0x0/0xb0
 [&lt;ffffffff81014300&gt;] ? child_rip+0x0/0x20

Signed-off-by: Roland Dreier &lt;roland@digitalvampire.org&gt;
Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In ecryptfs_destroy_inode(), inode_info-&gt;lower_file_mutex is locked,
and just after the mutex is unlocked, the code does:

 	kmem_cache_free(ecryptfs_inode_info_cache, inode_info);

This means that if another context could possibly try to take the same
mutex as ecryptfs_destroy_inode(), then it could end up getting the
mutex just before the data structure containing the mutex is freed.
So any such use would be an obvious use-after-free bug (catchable with
slab poisoning or mutex debugging), and therefore the locking in
ecryptfs_destroy_inode() is not needed and can be dropped.

Similarly, in ecryptfs_destroy_crypt_stat(), crypt_stat-&gt;keysig_list_mutex
is locked, and then the mutex is unlocked just before the code does:

 	memset(crypt_stat, 0, sizeof(struct ecryptfs_crypt_stat));

Therefore taking this mutex is similarly not necessary.

Removing this locking fixes false-positive lockdep reports such as the
following (and they are false-positives for exactly the same reason
that the locking is not needed):

=================================
[ INFO: inconsistent lock state ]
2.6.31-2-generic #14~rbd3
---------------------------------
inconsistent {RECLAIM_FS-ON-W} -&gt; {IN-RECLAIM_FS-W} usage.
kswapd0/323 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&amp;inode_info-&gt;lower_file_mutex){+.+.?.}, at: [&lt;ffffffff81210d34&gt;] ecryptfs_destroy_inode+0x34/0x100
{RECLAIM_FS-ON-W} state was registered at:
  [&lt;ffffffff8108c02c&gt;] mark_held_locks+0x6c/0xa0
  [&lt;ffffffff8108c10f&gt;] lockdep_trace_alloc+0xaf/0xe0
  [&lt;ffffffff81125a51&gt;] kmem_cache_alloc+0x41/0x1a0
  [&lt;ffffffff8113117a&gt;] get_empty_filp+0x7a/0x1a0
  [&lt;ffffffff8112dd46&gt;] dentry_open+0x36/0xc0
  [&lt;ffffffff8121a36c&gt;] ecryptfs_privileged_open+0x5c/0x2e0
  [&lt;ffffffff81210283&gt;] ecryptfs_init_persistent_file+0xa3/0xe0
  [&lt;ffffffff8120e838&gt;] ecryptfs_lookup_and_interpose_lower+0x278/0x380
  [&lt;ffffffff8120f97a&gt;] ecryptfs_lookup+0x12a/0x250
  [&lt;ffffffff8113930a&gt;] real_lookup+0xea/0x160
  [&lt;ffffffff8113afc8&gt;] do_lookup+0xb8/0xf0
  [&lt;ffffffff8113b518&gt;] __link_path_walk+0x518/0x870
  [&lt;ffffffff8113bd9c&gt;] path_walk+0x5c/0xc0
  [&lt;ffffffff8113be5b&gt;] do_path_lookup+0x5b/0xa0
  [&lt;ffffffff8113bfe7&gt;] user_path_at+0x57/0xa0
  [&lt;ffffffff811340dc&gt;] vfs_fstatat+0x3c/0x80
  [&lt;ffffffff8113424b&gt;] vfs_stat+0x1b/0x20
  [&lt;ffffffff81134274&gt;] sys_newstat+0x24/0x50
  [&lt;ffffffff81013132&gt;] system_call_fastpath+0x16/0x1b
  [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff
irq event stamp: 7811
hardirqs last  enabled at (7811): [&lt;ffffffff810c037f&gt;] call_rcu+0x5f/0x90
hardirqs last disabled at (7810): [&lt;ffffffff810c0353&gt;] call_rcu+0x33/0x90
softirqs last  enabled at (3764): [&lt;ffffffff810631da&gt;] __do_softirq+0x14a/0x220
softirqs last disabled at (3751): [&lt;ffffffff8101440c&gt;] call_softirq+0x1c/0x30

other info that might help us debug this:
2 locks held by kswapd0/323:
 #0:  (shrinker_rwsem){++++..}, at: [&lt;ffffffff810f67ed&gt;] shrink_slab+0x3d/0x190
 #1:  (&amp;type-&gt;s_umount_key#35){.+.+..}, at: [&lt;ffffffff811429a1&gt;] prune_dcache+0xd1/0x1b0

stack backtrace:
Pid: 323, comm: kswapd0 Tainted: G         C 2.6.31-2-generic #14~rbd3
Call Trace:
 [&lt;ffffffff8108ad6c&gt;] print_usage_bug+0x18c/0x1a0
 [&lt;ffffffff8108aff0&gt;] ? check_usage_forwards+0x0/0xc0
 [&lt;ffffffff8108bac2&gt;] mark_lock_irq+0xf2/0x280
 [&lt;ffffffff8108bd87&gt;] mark_lock+0x137/0x1d0
 [&lt;ffffffff81164710&gt;] ? fsnotify_clear_marks_by_inode+0x30/0xf0
 [&lt;ffffffff8108bee6&gt;] mark_irqflags+0xc6/0x1a0
 [&lt;ffffffff8108d337&gt;] __lock_acquire+0x287/0x430
 [&lt;ffffffff8108d585&gt;] lock_acquire+0xa5/0x150
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff8108d2e7&gt;] ? __lock_acquire+0x237/0x430
 [&lt;ffffffff815526ad&gt;] __mutex_lock_common+0x4d/0x3d0
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff81164710&gt;] ? fsnotify_clear_marks_by_inode+0x30/0xf0
 [&lt;ffffffff81210d34&gt;] ? ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff8129a91e&gt;] ? _raw_spin_unlock+0x5e/0xb0
 [&lt;ffffffff81552b36&gt;] mutex_lock_nested+0x46/0x60
 [&lt;ffffffff81210d34&gt;] ecryptfs_destroy_inode+0x34/0x100
 [&lt;ffffffff81145d27&gt;] destroy_inode+0x87/0xd0
 [&lt;ffffffff81146b4c&gt;] generic_delete_inode+0x12c/0x1a0
 [&lt;ffffffff81145832&gt;] iput+0x62/0x70
 [&lt;ffffffff811423c8&gt;] dentry_iput+0x98/0x110
 [&lt;ffffffff81142550&gt;] d_kill+0x50/0x80
 [&lt;ffffffff81142623&gt;] prune_one_dentry+0xa3/0xc0
 [&lt;ffffffff811428b1&gt;] __shrink_dcache_sb+0x271/0x290
 [&lt;ffffffff811429d9&gt;] prune_dcache+0x109/0x1b0
 [&lt;ffffffff81142abf&gt;] shrink_dcache_memory+0x3f/0x50
 [&lt;ffffffff810f68dd&gt;] shrink_slab+0x12d/0x190
 [&lt;ffffffff810f9377&gt;] balance_pgdat+0x4d7/0x640
 [&lt;ffffffff8104c4c0&gt;] ? finish_task_switch+0x40/0x150
 [&lt;ffffffff810f63c0&gt;] ? isolate_pages_global+0x0/0x60
 [&lt;ffffffff810f95f7&gt;] kswapd+0x117/0x170
 [&lt;ffffffff810777a0&gt;] ? autoremove_wake_function+0x0/0x40
 [&lt;ffffffff810f94e0&gt;] ? kswapd+0x0/0x170
 [&lt;ffffffff810773be&gt;] kthread+0x9e/0xb0
 [&lt;ffffffff8101430a&gt;] child_rip+0xa/0x20
 [&lt;ffffffff81013c90&gt;] ? restore_args+0x0/0x30
 [&lt;ffffffff81077320&gt;] ? kthread+0x0/0xb0
 [&lt;ffffffff81014300&gt;] ? child_rip+0x0/0x20

Signed-off-by: Roland Dreier &lt;roland@digitalvampire.org&gt;
Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>push BKL down into -&gt;put_super</title>
<updated>2009-06-12T01:36:07+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2009-05-05T13:40:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6cfd0148425e528b859b26e436b01f23f6926224'/>
<id>6cfd0148425e528b859b26e436b01f23f6926224</id>
<content type='text'>
Move BKL into -&gt;put_super from the only caller.  A couple of
filesystems had trivial enough -&gt;put_super (only kfree and NULLing of
s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs,
hugetlbfs, omfs, qnx4, shmem, all others got the full treatment.  Most
of them probably don't need it, but I'd rather sort that out individually.
Preferably after all the other BKL pushdowns in that area.

[AV: original used to move lock_super() down as well; these changes are
removed since we don't do lock_super() at all in generic_shutdown_super()
now]
[AV: fuse, btrfs and xfs are known to need no damn BKL, exempt]

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move BKL into -&gt;put_super from the only caller.  A couple of
filesystems had trivial enough -&gt;put_super (only kfree and NULLing of
s_fs_info + stuff in there) to not get any locking: coda, cramfs, efs,
hugetlbfs, omfs, qnx4, shmem, all others got the full treatment.  Most
of them probably don't need it, but I'd rather sort that out individually.
Preferably after all the other BKL pushdowns in that area.

[AV: original used to move lock_super() down as well; these changes are
removed since we don't do lock_super() at all in generic_shutdown_super()
now]
[AV: fuse, btrfs and xfs are known to need no damn BKL, exempt]

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>eCryptfs: Remove ecryptfs_unlink_sigs warnings</title>
<updated>2009-04-22T09:08:46+00:00</updated>
<author>
<name>Tyler Hicks</name>
<email>tyhicks@linux.vnet.ibm.com</email>
</author>
<published>2009-04-22T09:08:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e77cc8d243f9f1e1d3f0799e23cc14e837ccc8c6'/>
<id>e77cc8d243f9f1e1d3f0799e23cc14e837ccc8c6</id>
<content type='text'>
A feature was added to the eCryptfs umount helper to automatically
unlink the keys used for an eCryptfs mount from the kernel keyring upon
umount.  This patch keeps the unrecognized mount option warnings for
ecryptfs_unlink_sigs out of the logs.

Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A feature was added to the eCryptfs umount helper to automatically
unlink the keys used for an eCryptfs mount from the kernel keyring upon
umount.  This patch keeps the unrecognized mount option warnings for
ecryptfs_unlink_sigs out of the logs.

Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>eCryptfs: Print FNEK sig properly in /proc/mounts</title>
<updated>2009-04-22T08:54:13+00:00</updated>
<author>
<name>Tyler Hicks</name>
<email>tyhicks@linux.vnet.ibm.com</email>
</author>
<published>2009-03-16T17:35:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3a5203ab3c0c31e0f1434c69e893bfb85c6e6657'/>
<id>3a5203ab3c0c31e0f1434c69e893bfb85c6e6657</id>
<content type='text'>
The filename encryption key signature is not properly displayed in
/proc/mounts.  The "ecryptfs_sig=" mount option name is displayed for
all global authentication tokens, included those for filename keys.

This patch checks the global authentication token flags to determine if
the key is a FEKEK or FNEK and prints the appropriate mount option name
before the signature.

Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The filename encryption key signature is not properly displayed in
/proc/mounts.  The "ecryptfs_sig=" mount option name is displayed for
all global authentication tokens, included those for filename keys.

This patch checks the global authentication token flags to determine if
the key is a FEKEK or FNEK and prints the appropriate mount option name
before the signature.

Signed-off-by: Tyler Hicks &lt;tyhicks@linux.vnet.ibm.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ecryptfs: remove debug as mount option, and warn if set via modprobe</title>
<updated>2008-02-06T18:41:12+00:00</updated>
<author>
<name>Eric Sandeen</name>
<email>sandeen@redhat.com</email>
</author>
<published>2008-02-06T09:38:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2830bfd6cf66133c86d4a32004fd99c3de7e23bf'/>
<id>2830bfd6cf66133c86d4a32004fd99c3de7e23bf</id>
<content type='text'>
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 &lt;sandeen@redhat.com&gt;
Acked-by: Mike Halcrow &lt;mhalcrow@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;sandeen@redhat.com&gt;
Acked-by: Mike Halcrow &lt;mhalcrow@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
