Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1676775 > unrolled thread
| Started by | Alexander Potapenko <glider@google.com> |
|---|---|
| First post | 2017-06-28 17:10 +0200 |
| Last post | 2017-06-30 00:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] sysctl: don't read uninit memory in deprecated_sysctl_warning() Alexander Potapenko <glider@google.com> - 2017-06-28 17:10 +0200
Re: [PATCH] sysctl: don't read uninit memory in deprecated_sysctl_warning() Andrew Morton <akpm@linux-foundation.org> - 2017-06-30 00:40 +0200
| From | Alexander Potapenko <glider@google.com> |
|---|---|
| Date | 2017-06-28 17:10 +0200 |
| Subject | [PATCH] sysctl: don't read uninit memory in deprecated_sysctl_warning() |
| Message-ID | <tXmLo-8q5-39@gated-at.bofh.it> |
Don't attempt to read the first two elements of name[] unless they
were actually copied from the userspace.
This bug has been detected by KMSAN.
Signed-off-by: Alexander Potapenko <glider@google.com>
---
kernel/sysctl_binary.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index ece4b177052b..38d6ba22a209 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1346,7 +1346,7 @@ static void deprecated_sysctl_warning(const int *name, int nlen)
* CTL_KERN/KERN_VERSION is used by older glibc and cannot
* ever go away.
*/
- if (name[0] == CTL_KERN && name[1] == KERN_VERSION)
+ if (nlen >= 2 && name[0] == CTL_KERN && name[1] == KERN_VERSION)
return;
if (printk_ratelimit()) {
--
2.13.2.725.g09c95d1e9-goog
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2017-06-30 00:40 +0200 |
| Subject | Re: [PATCH] sysctl: don't read uninit memory in deprecated_sysctl_warning() |
| Message-ID | <tXQgq-5oe-27@gated-at.bofh.it> |
| In reply to | #1676775 |
On Wed, 28 Jun 2017 17:00:37 +0200 Alexander Potapenko <glider@google.com> wrote: > Don't attempt to read the first two elements of name[] unless they > were actually copied from the userspace. > > This bug has been detected by KMSAN. Thanks. I already have the identical http://ozlabs.org/~akpm/mmots/broken-out/sysctl-check-name-array-length-in-deprecated_sysctl_warning.patch
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web