From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrey Vagin <avagin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] posix-timers: Use array safe helper when fetching notification symbolic name
Date: Fri, 9 Nov 2018 12:28:11 +0300 [thread overview]
Message-ID: <20181109092810.GF13195@uranus.lan> (raw)
In-Reply-To: <alpine.DEB.2.21.1811091010440.1640@nanos.tec.linutronix.de>
On Fri, Nov 09, 2018 at 10:18:25AM +0100, Thomas Gleixner wrote:
> > + nidx = array_index_nospec(notify & ~SIGEV_THREAD_ID, ARRAY_SIZE(nstr));
>
> I completely understand your intention, but this is misleading. The above
> is really not a speculation gadget.
>
> I'd rather do an open coded check here and fail the thing instead of
> printing wrong information:
>
> nidx = timer->it_sigev_notify & ~SIGEV_THREAD_ID;
> if (nidx >= ARRAY_SIZE(nstr))
> return -EINVAL;
Yes, I thought about such approach and did the similar code
in first place, then I dropped it because didn't want additional
"if"s here (your fix in the former commit already does all verification
needed). But thinking more I agree: this code is not time critical
and spending a few cycles won't hurt much. Will update, thanks Thomas!
next prev parent reply other threads:[~2018-11-09 9:28 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 [this message]
2018-11-09 11:31 ` [PATCH v2] fs/proc: timers -- Test for potential index overflow Cyrill Gorcunov
2018-12-21 20:28 ` 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=20181109092810.GF13195@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox