From: Thomas Gleixner <tglx@linutronix.de>
To: zhengbin <zhengbin13@huawei.com>
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 14:14:55 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1907051230340.1802@nanos.tec.linutronix.de> (raw)
In-Reply-To: <1562318088-37669-1-git-send-email-zhengbin13@huawei.com>
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
next prev parent reply other threads:[~2019-07-05 12:15 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 [this message]
2019-07-05 12:32 ` zhengbin (A)
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=alpine.DEB.2.21.1907051230340.1802@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
--cc=zhengbin13@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®