Whamcloud - gitweb
LU-13717 sec: make client encryption compatible with ext4 11/45211/15
authorSebastien Buisson <sbuisson@ddn.com>
Thu, 6 Jan 2022 21:19:02 +0000 (14:19 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 18 Jan 2022 09:09:23 +0000 (09:09 +0000)
commit4231fab66eab3e984499bf0c6bd4514692a409fa
tree156d6bd6aeb4c39a81eea5ff7ee71a8bca0e597d
parente26d7cc3992252e5fce5a51aee716f933b04c13a
LU-13717 sec: make client encryption compatible with ext4

In order to benefit from encrypted file handling implemented in
e2fsprogs, we need to adjust the way Lustre deals with encryption
context of files.

First, the encryption context needs to be stored in an xattr named
"encryption.c" instead of "security.c". But neither llite nor ldiskfs
has an xattr handler for this "encryption." xattr type. So we need
to export ldiskfs_xattr_get and ldiskfs_xattr_set_handle symbols for
this to work.

Second, we set the LDISKFS_ENCRYPT_FL flag on files for which we set
the 'encryption.c' xattr. But we just keep this flag for on-disk
inodes, and make sure the flag is cleared for in-memory inodes.
The purpose is to help e2fsprogs with encrypted files handling, while
not disturbing Lustre server side with the encryption flag (servers
are not supposed to know about it for Lustre client-side encryption).

To maintain compatibility with 2.14 in which encryption context is
stored in "security.c" xattr, we try to fetch enc context from this
xattr if getting it from "encryption.c" fails. On client side, in all
cases everything looks like encryption context is stored in
"encryption.c".

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I784ec530f0dfdd2743169ba2326ff6c5cdd4e85a
Reviewed-on: https://review.whamcloud.com/45211
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
35 files changed:
ldiskfs/kernel_patches/patches/linux-5.4/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/linux-5.8/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel7.9/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel8.4/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel8.5/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel8/ext4-enc-flag.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.6.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.7.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.8.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.9.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.1.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.2.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.3.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.4.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.5.series
ldiskfs/kernel_patches/series/ldiskfs-4.18-rhel8.series
ldiskfs/kernel_patches/series/ldiskfs-5.10.0-ml.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.0-42-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.0-66-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.0-80-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.0-90-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.0-ml.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.136-ml.series
ldiskfs/kernel_patches/series/ldiskfs-5.4.21-ml.series
ldiskfs/kernel_patches/series/ldiskfs-5.8.0-53-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.8.0-63-ubuntu20.series
ldiskfs/kernel_patches/series/ldiskfs-5.8.0-ml.series
ldiskfs/kernel_patches/series/ldiskfs-5.9.0-ml.series
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/llite/crypto.c
lustre/llite/llite_internal.h
lustre/llite/xattr.c
lustre/mdt/mdt_lib.c
lustre/osd-ldiskfs/osd_handler.c
lustre/tests/sanity-sec.sh