mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "zhangxiaoxu (A)" <zhangxiaoxu5@huawei.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: <john.stultz@linaro.org>, <sboyd@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] time: Validate the usec before covert to nsec in do_adjtimex
Date: Mon, 8 Jul 2019 18:42:13 +0800	[thread overview]
Message-ID: <2c4e8e8d-6e90-0d09-cf28-45330eb598ce@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1907081124000.3648@nanos.tec.linutronix.de>



在 2019/7/8 17:24, Thomas Gleixner 写道:
> On Mon, 8 Jul 2019, ZhangXiaoxu wrote:
> 
>> When covert the usec to nsec, it will multiple 1000, it maybe
>> overflow and lead an undefined behavior.
>>
>> For example, users may input an negative tv_usec values when
>> call adjtimex syscall, then multiple 1000 maybe overflow it
>> to a positive and legal number.
>>
>> So, we should validate the usec before coverted it to nsec.
> 
> That's correct, but the actuall inject function wants to keep the sanity
> check,
timekeeping_inject_offset is called only by timekeeping_warp_clock and do_adjtimex.
The do_adjtimex already validate it, and timekeeping_warp_clock is set tv_nsec=0.
We keep the sanity check is for some other maybe use this function?
I had send a v2 to keep the sanity check in timekeeping_inject_offset.

Thanks.
> 
> Thanks,
> 
> 	tglx
> 
> .
> 


  reply	other threads:[~2019-07-08 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  7:55 ZhangXiaoxu
2019-07-08  9:24 ` Thomas Gleixner
2019-07-08 10:42   ` zhangxiaoxu (A) [this message]
2019-07-08 16:39 ` Richard Cochran

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=2c4e8e8d-6e90-0d09-cf28-45330eb598ce@huawei.com \
    --to=zhangxiaoxu5@huawei.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.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

all inboxes | Powered by JetHome®