public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xishi Qiu <qiuxishi@huawei.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>, <fenghua.yu@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	John Stultz <john.stultz@linaro.org>
Subject: Re: [RFC] ubsan: signed integer overflow in setitimer()
Date: Tue, 6 Jun 2017 14:07:49 +0800	[thread overview]
Message-ID: <593646B5.6070406@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1706041703500.2813@nanos>

On 2017/6/4 23:06, Thomas Gleixner wrote:

> On Thu, 1 Jun 2017, Xishi Qiu wrote:
> 
> Cc'ed John Stultz
> 
>> Hi, this is the test case, and then I got ubsan error
>> (signed integer overflow) report, so the root cause is from
>> user or kernel? Shall we change something in timeval_valid()?
>>
>>
>> struct itimerval new_value;
>> int ret;
>>
>> new_value.it_interval.tv_sec = 140673496649799L;
>> new_value.it_interval.tv_usec = 6;
>> new_value.it_value.tv_sec = 140673496649807L;
>> new_value.it_value.tv_usec = 5;
>>
>> ret = setitimer(ITIMER_VIRTUAL, &new_value, NULL);
>>
>>
>> [  533.326588] ================================================================================
>> [  533.335346] UBSAN: Undefined behaviour in ./include/linux/time.h:239:27
>> [  533.342155] signed integer overflow:
>> [  533.345837] 140673496649807 * 1000000000 cannot be represented in type 'long int'
>> [  533.422181]  set_cpu_itimer+0x49c/0x540
>> [  533.442127]  do_setitimer+0xe1/0x540
> 
> We need a similar clamping of the conversion as we have for
> timespec/val_to_ktime(). I'll have a look in the next days unless John
> beats me to it.
> 

Hi Thomas, anything new?

Thanks,
Xishi Qiu

> Thanks,
> 
> 	tglx
> 
> .
> 

  reply	other threads:[~2017-06-06  6:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 12:03 [RFC] ubsan: signed integer overflow in setitimer() Xishi Qiu
2017-06-04 15:06 ` Thomas Gleixner
2017-06-06  6:07   ` Xishi Qiu [this message]
2017-06-06  7:43     ` Thomas Gleixner

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=593646B5.6070406@huawei.com \
    --to=qiuxishi@huawei.com \
    --cc=fenghua.yu@intel.com \
    --cc=john.stultz@linaro.org \
    --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