Skip to content

Commit

Permalink
Linux: Guard proc sentinel values using kernel version.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
IvanVolosyuk committed Nov 25, 2024
1 parent d0a91b9 commit 02e8080
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions module/os/linux/spl/spl-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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
Expand All @@ -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[] = {
Expand All @@ -416,7 +428,9 @@ static struct ctl_table spl_root[] = {
.mode = 0555,
.child = spl_dir,
},
#ifdef PROC_USE_SENTINELS
{}
#endif
};
#endif

Expand Down

0 comments on commit 02e8080

Please sign in to comment.