Patch "sysctl: handle error writing UINT_MAX to u32 fields" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
sysctl: handle error writing UINT_MAX to u32 fields
to the 4.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-handle-error-writing-uint_max-to-u32-fields.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
e7d316a02f683864a12389f8808570e37fb90aa3Mon Sep 17 00:00:00 2001
From: Subash Abhinov Kasiviswanathan <[email protected]>
Date: Thu, 25 Aug 2016 15:16:51 -0700
Subject: sysctl: handle error writing UINT_MAX to u32 fields
From: Subash Abhinov Kasiviswanathan <[email protected]>
commit e7d316a02f683864a12389f8808570e37fb90aa3 upstream.
We have scripts which write to certain fields on 3.18 kernels but this seems to be failing on 4.4 kernels. An entry which we write to here is xfrm_aevent_rseqth which is u32.
echo 4294967295 > /proc/sys/net/core/xfrm_aevent_rseqth
Commit 230633d109e3 ("kernel/sysctl.c: detect overflows when converting to int") prevented writing to sysctl entries when integer overflow occurs. However, this does not apply to unsigned integers.
Heinrich suggested that we introduce a new option to handle 64 bit limits and set min as 0 and max as UINT_MAX. This might not work as it leads to issues similar to __do_proc_doulongvec_minmax. Alternatively, we would need to change the datatype of the entry to 64 bit.
static int __do_proc_doulongvec_minmax(void *data, struct ctl_table
{
i = (unsigned long *) data; //This cast is causing to read beyond the size of data (u32)
vleft = table->maxlen / sizeof(unsigned long); //vleft is 0 because maxlen is sizeof(u32) which is lesser than sizeof(unsigned long) on x86_64.
Introduce a new proc handler proc_douintvec. Individual proc entries will need to be updated to use the new handler.
--- include/linux/sysctl.h | 2 ++ kernel/sysctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-)
include/linux/sysctl.h +2 -0
@@ -41,6 +41,8 @@ extern int proc_dostring(struct ctl_tabl void __user *, size_t *, loff_t *);extern int proc_dointvec (struct ctl_table *,int ,void __user *,size_t *,loff_t *); +extern int proc_douintvec (struct ctl_table *,int , +void __user *,size_t *,loff_t *);extern int proc_dointvec_minmax (struct ctl_table *,int ,void __user *,size_t *,loff_t *); extern int proc_dointvec_jiffies(struct ctl_table *, int,
kernel/sysctl.c +43 -2
69 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/sysctl-handle-error-writing-uint_max-to-u32-fields.patch