Skip to content

no support for native ext4 encryption in raspian with kernel 4.9 or 4.14 #2486

Open

Description

@finasfinas

Support for native ext4 encryption has been added to the kernel since version 4.1. It is enabled with CONFIG_EXT4_ENCRYPTION=1

A running kernel can be checked for support by looking at the existence of the following file:
/sys/fs/ext4/features/encryption
If this file does not exist, then the kernel has been compiled without the CONFIG_EXT4_ENCRYPTION option and thus has no native ext4 encryption support.

This option does not cause overhead and brings significant gains in ease of use and performance when compared with other options like luks+ dm-crypt, etc.

Userland tools to create and mount an encrypted ext4 filesystem are already present as the version shipped of efsutils already has support for this.

please add support in the kernel for native ext4 encryption.

Activity

  1. Ferroin commented on Apr 4, 2018

    @Ferroin
    Contributor

    This option does not cause overhead

    You mean it causes minimal runtime overhead if not in use.

    At minimum, if you're not using the VFS encryption API, you're still going to take a few extra CPU cycles in many VFS operations (at least read and write calls) to determine if the file being operated on is encrypted or not, and it will still increase the runtime memory footprint of the kernel.

    Beyond that, I do agree with your points about usability being far better than FDE (LUKS or otherwise), and would like to add that it's not just ext4 that supports this (F2FS has support too, and there's some talk of adding it to other filesystems as well).

  2. finasfinas commented on Apr 4, 2018

    @finasfinas
    Author

    yes,
    I was refering to no overhead when not in use. When in use it's still cheaper to run than all the others except maybe loop-aes.

    Anyway, it's an easy fix, and at least from my point of view a no brainer to just add support in the kernel and problem solved as it has no drawbacks at all.

  3. JamesH65 commented on Apr 20, 2018

    @JamesH65
    Contributor

    @popcornmix @pelwell Any thoughts on this?

  4. finasfinas commented on Apr 25, 2018

    @finasfinas
    Author

    Considering the time that has passed without an answer, maybe this is not the right place to post a bug report. Does the project have a bug tracker where a bug report can be filled?

  5. JamesH65 commented on Apr 25, 2018

    @JamesH65
    Contributor

    This is the correct place for linux kernel bug reports and requests for kernel changes.

    Note though that 21 days is not a long time - we've issues on here that are lots older than that!

    What we really want to know is what the overheads are (you say there are none but that doesn't sound possible - something must change). So what is the performance hit on the low end machines (Pi1, Zero etc), both in cycles and memory?

  6. popcornmix commented on Apr 25, 2018

    @popcornmix
    Collaborator

    As this is a built-in option (rather than a kernel module) it will have an effect on kernel size and memory usage for all users (whether they use it or not).
    This means it needs more thought in weighing up cost/benefit before enabling.
    Useful information for this decision is kernel.img size before and after this change and free memory (free -h) after boting with/without this change.

  7. Ferroin commented on Apr 25, 2018

    @Ferroin
    Contributor

    Using bcr2835_defconfig (that is the default for the ARMv7 Pi's right?) with the rpi-4.14.y branch as of right now, kernel size without this is 4602k.

    Using an otherwise identical configuration with this enabled, kernel size is 4640k.

    If we do the smart thing and update the config to use the ext4 driver for ext2 and ext3 (CONFIG_EXT2_FS=n, CONFIG_EXT3_FS=n, and CONFIG_EXT$_USE_FOR_EXT2=y), then a decent percentage of that size increase can be recouped (making these changes in addition to enabling FS encryption results in a kernel image size of 4617k).

    I've got no data right now for runtime memory usage unfortunately, as I don't have any spare Pi's to check on right now, but I don't think it will be all that bad (I'd expect it's maybe a few hundred kB difference at most to just enable this, and would probably be a net decrease if we change to using the ext4 driver for ext2 and ext3).

  8. JamesH65 commented on May 11, 2018

    @JamesH65
    Contributor

    @Ferroin Did you manage to get any run time figures?

  9. added
    Waiting for external input
    on May 11, 2018
  10. Ferroin commented on May 14, 2018

    @Ferroin
    Contributor

    Unfortunately not anything native. I just did some testing over the weekend in a QEMU VM running an emulated ARMv7a CPU equivalent to the Pi 2 on an x86 host, and the performance difference between not having VFS encryption enabled at all, and having it built in but unused was less than 1% (about 0.2-0.4% in most cases, though I expect that to be much lower on the Pi because I/O is much slower there than it was in the VM). In pretty much all cases, it required looking at numbers from batches of thousands of I/O operations to produce a performance difference measurable from userspace without needing to use perf.

  11. JamesH65 commented on Jun 26, 2018

    @JamesH65
    Contributor

    @popcornmix Is that enough information or would we still want some runtime memory data?

  12. added
    Waiting for internal comment
    and removed
    Waiting for external input
    on Jun 29, 2018
  13. JamesH65 commented on Jul 31, 2019

    @JamesH65
    Contributor

    @popcornmix @pelwell Any further thoughts on this, or flag up for 30 day close?

  14. pelwell commented on Jul 31, 2019

    @pelwell
    Contributor

    The issue title is now out-of-data, but the same issue applies to our 4.19 defconfigs. I'm inclined to trust @Ferroin's analysis of the performance impact and possible mitigation - we could make these changes to bcm2709_defconfig and bcm2711_defconfig, leaving the smaller-memoried BCM2835-based devices without, but perhaps the actual impact is small enough that this differentiation isn't worthwhile.

  15. 56 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Waiting for internal comment

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions