From: "zhengbin (A)" <zhengbin13@huawei.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: <john.stultz@linaro.org>, <sboyd@kernel.org>,
<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>,
<zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH] time: compat settimeofday: Validate the values of tv from user
Date: Fri, 5 Jul 2019 20:32:55 +0800 [thread overview]
Message-ID: <39dd218b-4fc1-83bd-df2a-3cd69cc90c72@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1907051230340.1802@nanos.tec.linutronix.de>
On 2019/7/5 20:14, Thomas Gleixner wrote:
> Zhengbin,
>
> On Fri, 5 Jul 2019, zhengbin wrote:
>
>> Similar to commit 6ada1fc0e1c4
>> ("time: settimeofday: Validate the values of tv from user"),
>> an unvalidated user input is multiplied by a constant, which can result
>> in an undefined behaviour for large values. While this is validated
>> later, we should avoid triggering undefined behaviour.
> I surely agree with the patch, but the argument that this is validated
> later and we just should avoid UB in general is just wrong.
>
> For a wide range of negative tv_usec values the multiplication overflow
> turns them in positive numbers. So the 'validated later' is not catching
> the invalid input.
>
> So 'should avoid ....' is just the wrong argument here.
>
> Validation _is_ required before the multiplication so UB won't turn an
> invalid value into a valid one.
>
> Thanks,
>
> tglx
Strongly agree with this, I send a v2 patch, modify the comment?
>
> .
>
prev parent reply other threads:[~2019-07-05 12:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-05 9:14 zhengbin
2019-07-05 12:14 ` Thomas Gleixner
2019-07-05 12:32 ` zhengbin (A) [this message]
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=39dd218b-4fc1-83bd-df2a-3cd69cc90c72@huawei.com \
--to=zhengbin13@huawei.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/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
all inboxes | Powered by JetHome®