Re: [PATCH] ext4: Check for encryption feature before fscrypt_process_policy()

From: Eric Biggers
Date: Fri Sep 23 2016 - 17:57:07 EST


On Thu, Sep 22, 2016 at 06:38:03PM -0400, Theodore Ts'o wrote:
>
> I think it's fine to fix it now in upstream. It might cause some
> problems for Cyanogen developers if they want to try to use an
> upstream kernel and also enable the ext4 encryption feature, but the
> fix to make_ext4fs isn't all that hard.

Would it make sense to at least provide a helpful error message in the kernel
log? For example:

if (!ext4_has_feature_encrypt(sb)) {
ext4_msg(sb, KERN_INFO,
"warning: process `%s' tried to set "
"encryption policy on filesystem without "
"encryption enabled. This is not supported. "
"Use 'tune2fs -O encrypt' to enable the "
"encryption feature flag first.",
current->comm);
return -EOPNOTSUPP;
}

Eric