From: Cyrill Gorcunov <gorcunov@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Andrey Vagin <avagin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH v2] fs/proc: timers -- Test for potential index overflow
Date: Fri, 9 Nov 2018 14:31:53 +0300 [thread overview]
Message-ID: <20181109113153.GJ13195@uranus.lan> (raw)
In-Reply-To: <20181109092810.GF13195@uranus.lan>
When showing timer's notify symbolic name make sure we never fetch a value
sitting outside of the names array. Though the former issue displaying
timer->it_sigev_notify has been fixed by Thomas in commit cef31d9af9082434,
better to make sure we won't hit it again on furher modifications.
v2: Use explicit index overflow test (by tglx@). Since
it should never happen add warn-once to notify.
Cc: Andrey Vagin <avagin@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
fs/proc/base.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: linux-ml.git/fs/proc/base.c
===================================================================
--- linux-ml.git.orig/fs/proc/base.c
+++ linux-ml.git/fs/proc/base.c
@@ -2297,6 +2297,12 @@ static int show_timer(struct seq_file *m
timer = list_entry((struct list_head *)v, struct k_itimer, list);
notify = timer->it_sigev_notify;
+ if ((notify & ~SIGEV_THREAD_ID) >= ARRAY_SIZE(nstr)) {
+ WARN_ONCE(1, "timer: Bad signal notify mode %#x on ID %d\n",
+ notify, timer->it_id);
+ return -EINVAL;
+ }
+
seq_printf(m, "ID: %d\n", timer->it_id);
seq_printf(m, "signal: %d/%px\n",
timer->sigq->info.si_signo,
next prev parent reply other threads:[~2018-11-09 11:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 18:27 [PATCH] posix-timers: Use array safe helper when fetching notification symbolic name Cyrill Gorcunov
2018-11-09 9:18 ` Thomas Gleixner
2018-11-09 9:28 ` Cyrill Gorcunov
2018-11-09 11:31 ` Cyrill Gorcunov [this message]
2018-12-21 20:28 ` [PATCH v2] fs/proc: timers -- Test for potential index overflow Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181109113153.GJ13195@uranus.lan \
--to=gorcunov@gmail.com \
--cc=avagin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.