Skip to content

Commit a231f5b

Browse files
nbouchinet-anssiJoelgranados
authored andcommitted
sysctl: Fix underflow value setting risk in vm_table
Commit 3b3376f ("sysctl.c: fix underflow value setting risk in vm_table") fixes underflow value setting risk in vm_table but misses vdso_enabled sysctl. vdso_enabled sysctl is initialized with .extra1 value as SYSCTL_ZERO to avoid negative value writes but the proc_handler is proc_dointvec and not proc_dointvec_minmax and thus do not uses .extra1 and .extra2. The following command thus works : `# echo -1 > /proc/sys/vm/vdso_enabled` This patch properly sets the proc_handler to proc_dointvec_minmax. In addition to .extra1, .extra2 is set to SYSCTL_ONE. The sysctl is thus bounded between 0 and 1. Fixes: 3b3376f ("sysctl.c: fix underflow value setting risk in vm_table") Signed-off-by: Nicolas Bouchinet <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent 049439e commit a231f5b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/sh/kernel/vsyscall/vsyscall.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ static const struct ctl_table vdso_table[] = {
3737
.data = &vdso_enabled,
3838
.maxlen = sizeof(vdso_enabled),
3939
.mode = 0644,
40-
.proc_handler = proc_dointvec,
40+
.proc_handler = proc_dointvec_minmax,
4141
.extra1 = SYSCTL_ZERO,
42+
.extra2 = SYSCTL_ONE,
4243
},
4344
};
4445

0 commit comments

Comments
 (0)