OpenCloudOS-Kernel/fs/verity
Eric Biggers d171c85d74 fsverity: use register_sysctl_init() to avoid kmemleak warning
commit ee5814dddefbaa181cb247a75676dd5103775db1 upstream.

Since the fsverity sysctl registration runs as a builtin initcall, there
is no corresponding sysctl deregistration and the resulting struct
ctl_table_header is not used.  This can cause a kmemleak warning just
after the system boots up.  (A pointer to the ctl_table_header is stored
in the fsverity_sysctl_header static variable, which kmemleak should
detect; however, the compiler can optimize out that variable.)  Avoid
the kmemleak warning by using register_sysctl_init() which is intended
for use by builtin initcalls and uses kmemleak_not_leak().

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Closes: https://lore.kernel.org/r/CAHj4cs8DTSvR698UE040rs_pX1k-WVe7aR6N2OoXXuhXJPDC-w@mail.gmail.com
Cc: stable@vger.kernel.org
Reviewed-by: Joel Granados <j.granados@samsung.com>
Link: https://lore.kernel.org/r/20240501025331.594183-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:47:33 +02:00
..
Kconfig fsverity: improve documentation for builtin signature support 2023-06-20 22:47:55 -07:00
Makefile fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl 2021-02-07 14:51:11 -08:00
enable.c fsverity: improve documentation for builtin signature support 2023-06-20 22:47:55 -07:00
fsverity_private.h fsverity: move sysctl registration out of signature.c 2023-07-11 22:57:03 -07:00
hash_algs.c fsverity: explicitly check that there is no algorithm 0 2023-07-11 22:49:18 -07:00
init.c fsverity: use register_sysctl_init() to avoid kmemleak warning 2024-06-16 13:47:33 +02:00
measure.c fsverity: rework fsverity_get_digest() again 2023-06-14 10:41:07 -07:00
open.c fsverity: simplify handling of errors during initcall 2023-07-11 22:49:18 -07:00
read_metadata.c fsverity: improve documentation for builtin signature support 2023-06-20 22:47:55 -07:00
signature.c fsverity: skip PKCS#7 parser when keyring is empty 2023-08-20 10:33:43 -07:00
verify.c fsverity: simplify handling of errors during initcall 2023-07-11 22:49:18 -07:00