Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1618923 > unrolled thread
| Started by | Liping Zhang <zlpnobody@163.com> |
|---|---|
| First post | 2017-04-07 18:00 +0200 |
| Last post | 2017-04-07 18:00 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/3] sysctl: fix some bugs related to proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200
[PATCH 2/3] sysctl: don't print negative flag for proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200
[PATCH 1/3] sysctl: add sanity check for proc_douintvec Liping Zhang <zlpnobody@163.com> - 2017-04-07 18:00 +0200
| From | Liping Zhang <zlpnobody@163.com> |
|---|---|
| Date | 2017-04-07 18:00 +0200 |
| Subject | [PATCH 0/3] sysctl: fix some bugs related to proc_douintvec |
| Message-ID | <ttEsN-K9-5@gated-at.bofh.it> |
From: Liping Zhang <zlpnobody@gmail.com>
This patch set aims to fix some bugs introduced by commit e7d316a02f68
("sysctl: handle error writing UINT_MAX to u32 fields").
Liping Zhang (3):
sysctl: add sanity check for proc_douintvec
sysctl: don't print negative flag for proc_douintvec
sysctl: report EINVAL if value is larger than UINT_MAX for
proc_douintvec
fs/proc/proc_sysctl.c | 1 +
kernel/sysctl.c | 3 +++
2 files changed, 4 insertions(+)
--
2.5.5
[toc] | [next] | [standalone]
| From | Liping Zhang <zlpnobody@163.com> |
|---|---|
| Date | 2017-04-07 18:00 +0200 |
| Subject | [PATCH 2/3] sysctl: don't print negative flag for proc_douintvec |
| Message-ID | <ttEsO-K9-15@gated-at.bofh.it> |
| In reply to | #1618923 |
From: Liping Zhang <zlpnobody@gmail.com>
I saw some very confusing sysctl output on my system:
# cat /proc/sys/net/core/xfrm_aevent_rseqth
-2
# cat /proc/sys/net/core/xfrm_aevent_etime
-10
cat /proc/sys/net/ipv4/tcp_notsent_lowat
-4294967295
Because we forget to set the *negp flag in proc_douintvec, so it will
become a garbage value.
Since the value related to proc_douintvec is always an unsigned integer,
so we can set *negp to false explictily to fix this issue.
Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
---
kernel/sysctl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index acf0a5a..8cca4c7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2136,6 +2136,7 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
*valp = *lvalp;
} else {
unsigned int val = *valp;
+ *negp = false;
*lvalp = (unsigned long)val;
}
return 0;
--
2.5.5
[toc] | [prev] | [next] | [standalone]
| From | Liping Zhang <zlpnobody@163.com> |
|---|---|
| Date | 2017-04-07 18:00 +0200 |
| Subject | [PATCH 1/3] sysctl: add sanity check for proc_douintvec |
| Message-ID | <ttEsO-K9-21@gated-at.bofh.it> |
| In reply to | #1618923 |
From: Liping Zhang <zlpnobody@gmail.com>
Commit e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
introduced the proc_douintvec helper function, but it forgot to add
the related sanity check when doing register_sysctl_table. So add it now.
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
---
fs/proc/proc_sysctl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 8f91ec6..d04ea43 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1074,6 +1074,7 @@ static int sysctl_check_table(const char *path, struct ctl_table *table)
if ((table->proc_handler == proc_dostring) ||
(table->proc_handler == proc_dointvec) ||
+ (table->proc_handler == proc_douintvec) ||
(table->proc_handler == proc_dointvec_minmax) ||
(table->proc_handler == proc_dointvec_jiffies) ||
(table->proc_handler == proc_dointvec_userhz_jiffies) ||
--
2.5.5
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web