From 9d832f5acc7ff74e4f39398f2f82b740eb48d762 Mon Sep 17 00:00:00 2001 From: Ivan Volosyuk Date: Mon, 25 Nov 2024 23:33:58 +1100 Subject: [PATCH] Linux: Guard proc sentinel values using kernel version. Kernel 6.11-rc1 and later no longer use proc sentinels and zfs module will fail loading if compiled with CONFIG_RANDSTRUCT_PERFORMANCE=y The change restricts use of the sentinel values to earlier kernel versions. Ideally we should check for sentinels instead of kernel version. Closes #16620 Signed-off-by: Ivan Volosyuk --- module/os/linux/spl/spl-proc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/module/os/linux/spl/spl-proc.c b/module/os/linux/spl/spl-proc.c index 9af192274733..1f745b5dc35a 100644 --- a/module/os/linux/spl/spl-proc.c +++ b/module/os/linux/spl/spl-proc.c @@ -51,6 +51,10 @@ typedef struct ctl_table spl_ctl_table; #define CONST_CTL_TABLE struct ctl_table #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) +#define PROC_USE_SENTINELS +#endif + static unsigned long table_min = 0; static unsigned long table_max = ~0; @@ -359,11 +363,15 @@ static struct ctl_table spl_kmem_table[] = { .mode = 0444, .proc_handler = &proc_doslab, }, +#ifdef PROC_USE_SENTINELS {}, +#endif }; static struct ctl_table spl_kstat_table[] = { +#ifdef PROC_USE_SENTINELS {}, +#endif }; static struct ctl_table spl_table[] = { @@ -397,7 +405,9 @@ static struct ctl_table spl_table[] = { .child = spl_kstat_table, }, #endif +#ifdef PROC_USE_SENTINELS {}, +#endif }; #ifdef HAVE_REGISTER_SYSCTL_TABLE @@ -407,7 +417,9 @@ static struct ctl_table spl_dir[] = { .mode = 0555, .child = spl_table, }, +#ifdef PROC_USE_SENTINELS {} +#endif }; static struct ctl_table spl_root[] = { @@ -416,7 +428,9 @@ static struct ctl_table spl_root[] = { .mode = 0555, .child = spl_dir, }, +#ifdef PROC_USE_SENTINELS {} +#endif }; #endif