<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/crypto, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-11-20T01:56:13Z</updated>
<entry>
<title>fscrypto: don't use on-stack buffer for key derivation</title>
<updated>2016-11-20T01:56:13Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-11-14T01:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0f0909e242f73c1154272cf04f07fc9afe13e5b8'/>
<id>urn:sha1:0f0909e242f73c1154272cf04f07fc9afe13e5b8</id>
<content type='text'>
With the new (in 4.9) option to use a virtually-mapped stack
(CONFIG_VMAP_STACK), stack buffers cannot be used as input/output for
the scatterlist crypto API because they may not be directly mappable to
struct page.  get_crypt_info() was using a stack buffer to hold the
output from the encryption operation used to derive the per-file key.
Fix it by using a heap buffer.

This bug could most easily be observed in a CONFIG_DEBUG_SG kernel
because this allowed the BUG in sg_set_buf() to be triggered.

Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>fscrypto: don't use on-stack buffer for filename encryption</title>
<updated>2016-11-20T01:56:06Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-11-14T01:35:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3c7018ebf8dbf14e7cd4f5dc648c51fc979f45bb'/>
<id>urn:sha1:3c7018ebf8dbf14e7cd4f5dc648c51fc979f45bb</id>
<content type='text'>
With the new (in 4.9) option to use a virtually-mapped stack
(CONFIG_VMAP_STACK), stack buffers cannot be used as input/output for
the scatterlist crypto API because they may not be directly mappable to
struct page.  For short filenames, fname_encrypt() was encrypting a
stack buffer holding the padded filename.  Fix it by encrypting the
filename in-place in the output buffer, thereby making the temporary
buffer unnecessary.

This bug could most easily be observed in a CONFIG_DEBUG_SG kernel
because this allowed the BUG in sg_set_buf() to be triggered.

Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>fscrypto: lock inode while setting encryption policy</title>
<updated>2016-10-15T13:48:50Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-10-15T13:48:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8906a8223ad4909b391c5628f7991ebceda30e52'/>
<id>urn:sha1:8906a8223ad4909b391c5628f7991ebceda30e52</id>
<content type='text'>
i_rwsem needs to be acquired while setting an encryption policy so that
concurrent calls to FS_IOC_SET_ENCRYPTION_POLICY are correctly
serialized (especially the -&gt;get_context() + -&gt;set_context() pair), and
so that new files cannot be created in the directory during or after the
-&gt;empty_dir() check.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Richard Weinberger &lt;richard@nod.at&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>fscrypto: make XTS tweak initialization endian-independent</title>
<updated>2016-10-13T03:30:16Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-10-13T03:30:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fb4454376df9d820d95452d71dd83da6971f9338'/>
<id>urn:sha1:fb4454376df9d820d95452d71dd83da6971f9338</id>
<content type='text'>
The XTS tweak (or IV) was initialized differently on little endian and
big endian systems.  Because the ciphertext depends on the XTS tweak, it
was not possible to use an encrypted filesystem created by a little
endian system on a big endian system and vice versa, even if they shared
the same PAGE_SIZE.  Fix this by always using little endian.

This will break hypothetical big endian users of ext4 or f2fs
encryption.  However, all users we are aware of are little endian, and
it's believed that "real" big endian users are unlikely to exist yet.
So this might as well be fixed now before it's too late.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4</title>
<updated>2016-10-07T22:15:33Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-10-07T22:15:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2eee010d092903ee95716b6c2fbd9d3289839aa4'/>
<id>urn:sha1:2eee010d092903ee95716b6c2fbd9d3289839aa4</id>
<content type='text'>
Pull ext4 updates from Ted Ts'o:
 "Lots of bug fixes and cleanups"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (40 commits)
  ext4: remove unused variable
  ext4: use journal inode to determine journal overhead
  ext4: create function to read journal inode
  ext4: unmap metadata when zeroing blocks
  ext4: remove plugging from ext4_file_write_iter()
  ext4: allow unlocked direct IO when pages are cached
  ext4: require encryption feature for EXT4_IOC_SET_ENCRYPTION_POLICY
  fscrypto: use standard macros to compute length of fname ciphertext
  ext4: do not unnecessarily null-terminate encrypted symlink data
  ext4: release bh in make_indexed_dir
  ext4: Allow parallel DIO reads
  ext4: allow DAX writeback for hole punch
  jbd2: fix lockdep annotation in add_transaction_credits()
  blockgroup_lock.h: simplify definition of NR_BG_LOCKS
  blockgroup_lock.h: remove debris from bgl_lock_ptr() conversion
  fscrypto: make filename crypto functions return 0 on success
  fscrypto: rename completion callbacks to reflect usage
  fscrypto: remove unnecessary includes
  fscrypto: improved validation when loading inode encryption metadata
  ext4: fix memory leak when symlink decryption fails
  ...
</content>
</entry>
<entry>
<title>fscrypto: use standard macros to compute length of fname ciphertext</title>
<updated>2016-09-30T05:46:18Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-09-30T05:46:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=55be3145d174c04c44f1996eca8eb3a4476b1063'/>
<id>urn:sha1:55be3145d174c04c44f1996eca8eb3a4476b1063</id>
<content type='text'>
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>fscrypto: make filename crypto functions return 0 on success</title>
<updated>2016-09-15T21:25:55Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-09-15T21:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ef1eb3aa50930f026135085cd160b1212cdfe817'/>
<id>urn:sha1:ef1eb3aa50930f026135085cd160b1212cdfe817</id>
<content type='text'>
Several filename crypto functions: fname_decrypt(),
fscrypt_fname_disk_to_usr(), and fscrypt_fname_usr_to_disk(), returned
the output length on success or -errno on failure.  However, the output
length was redundant with the value written to 'oname-&gt;len'.  It is also
potentially error-prone to make callers have to check for '&lt; 0' instead
of '!= 0'.

Therefore, make these functions return 0 instead of a length, and make
the callers who cared about the return value being a length use
'oname-&gt;len' instead.  For consistency also make other callers check for
a nonzero result rather than a negative result.

This change also fixes the inconsistency of fname_encrypt() actually
already returning 0 on success, not a length like the other filename
crypto functions and as documented in its function comment.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&gt;
Acked-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>fscrypto: rename completion callbacks to reflect usage</title>
<updated>2016-09-15T20:51:01Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-09-15T20:51:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=53fd7550ec40571e26f730a0d3fc0a5dd93ecda2'/>
<id>urn:sha1:53fd7550ec40571e26f730a0d3fc0a5dd93ecda2</id>
<content type='text'>
fscrypt_complete() was used only for data pages, not for all
encryption/decryption.  Rename it to page_crypt_complete().

dir_crypt_complete() was used for filename encryption/decryption for
both directory entries and symbolic links.  Rename it to
fname_crypt_complete().

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>fscrypto: remove unnecessary includes</title>
<updated>2016-09-15T20:41:09Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-09-15T20:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d83ae730b6f9464e46eaf052ff84d9486c5b4107'/>
<id>urn:sha1:d83ae730b6f9464e46eaf052ff84d9486c5b4107</id>
<content type='text'>
This patch removes some #includes that are clearly not needed, such as a
reference to ecryptfs, which is unrelated to the new filesystem
encryption code.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>fscrypto: improved validation when loading inode encryption metadata</title>
<updated>2016-09-15T17:32:11Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2016-09-15T17:32:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f39850dffa9cba0f6920ff907710bcddc7f2a26'/>
<id>urn:sha1:8f39850dffa9cba0f6920ff907710bcddc7f2a26</id>
<content type='text'>
- Validate fscrypt_context.format and fscrypt_context.flags.  If
  unrecognized values are set, then the kernel may not know how to
  interpret the encrypted file, so it should fail the operation.

- Validate that AES_256_XTS is used for contents and that AES_256_CTS is
  used for filenames.  It was previously possible for the kernel to
  accept these reversed, though it would have taken manual editing of
  the block device.  This was not intended.

- Fail cleanly rather than BUG()-ing if a file has an unexpected type.

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
</content>
</entry>
</feed>
