Patch "sysctl.c: fix underflow value setting risk in vm_table" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sysctl.c: fix underflow value setting risk in vm_table

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sysctl.c-fix-underflow-value-setting-risk-in-vm_tabl.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7cb6138e36f39f0f9aea6327028bd67583aa5ed3
Author: Lin Feng <linf@xxxxxxxxxx>
Date:   Thu Feb 25 17:20:53 2021 -0800

    sysctl.c: fix underflow value setting risk in vm_table
    
    [ Upstream commit 3b3376f222e3ab58367d9dd405cafd09d5e37b7c ]
    
    Apart from subsystem specific .proc_handler handler, all ctl_tables with
    extra1 and extra2 members set should use proc_dointvec_minmax instead of
    proc_dointvec, or the limit set in extra* never work and potentially echo
    underflow values(negative numbers) is likely make system unstable.
    
    Especially vfs_cache_pressure and zone_reclaim_mode, -1 is apparently not
    a valid value, but we can set to them.  And then kernel may crash.
    
    # echo -1 > /proc/sys/vm/vfs_cache_pressure
    
    Link: https://lkml.kernel.org/r/20201223105535.2875-1-linf@xxxxxxxxxx
    Signed-off-by: Lin Feng <linf@xxxxxxxxxx>
    Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
    Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 70665934d53e..eae6a078619f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1563,7 +1563,7 @@ static struct ctl_table vm_table[] = {
 		.data		= &block_dump,
 		.maxlen		= sizeof(block_dump),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
 	},
 	{
@@ -1571,7 +1571,7 @@ static struct ctl_table vm_table[] = {
 		.data		= &sysctl_vfs_cache_pressure,
 		.maxlen		= sizeof(sysctl_vfs_cache_pressure),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
 	},
 #if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
@@ -1581,7 +1581,7 @@ static struct ctl_table vm_table[] = {
 		.data		= &sysctl_legacy_va_layout,
 		.maxlen		= sizeof(sysctl_legacy_va_layout),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
 	},
 #endif
@@ -1591,7 +1591,7 @@ static struct ctl_table vm_table[] = {
 		.data		= &node_reclaim_mode,
 		.maxlen		= sizeof(node_reclaim_mode),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= SYSCTL_ZERO,
 	},
 	{



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux