'struct fscrypt_operations' is only used by fs/crypto/ (which is always
built-in) and by three filesystems (which are either built-in to GKI, in
the case of ext4 and f2fs, or aren't supported by Android, in the case
of ubifs). The only way a loadable module could use fscrypt_operations
is if the module were a filesystem that used fs/crypto/, which isn't
possible since KMI symbol list doesn't include anything in fs/crypto/.
However, any change to struct fscrypt_operations changes the symbol CRC
of most of the KMI functions exported by any files fs/*.c that include
<linux/fscrypt.h>. This is because the definition of fscrypt_operations
is visible to them, and in principle it's possible to get to
fscrypt_operations from most VFS structs (e.g. inode->i_sb->s_cop), even
though there's no reason to do so outside the crypto code.
Work around this by putting the definition of struct fscrypt_operations
behind #ifdef FSCRYPT_NEED_OPS, and only defining this in the files that
actually need the definition. (It could be moved into a separate header
instead, but this way keeps the diff from upstream smaller.)
This will cause a one-time CRC change of all the affected KMI functions,
but afterwards any changes to fscrypt_operations won't "break the KMI".
Bug: 170265596
Test: re-generated the ABI, changed struct fscrypt_operations (and
struct fscrypt_info as well, just in case), re-generated the ABI
again, and verified it didn't change.
Change-Id: Ib5dd49550aec81a64b3d6077a0aeb5747be908ff
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>