mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Xishi Qiu <qiuxishi@huawei.com>
Subject: [patch 0/2] timers: Prevent multiplication overflow in timespec/val conversions
Date: Tue, 20 Jun 2017 17:37:34 +0200	[thread overview]
Message-ID: <20170620153734.970526461@linutronix.de> (raw)

KASAN detected a multiplication overflow in the sys_setitimer() timeval
conversion. The same issue is possible the posix-cpu-timer sys_timer_set()
implementation.

In both cases the conversion of the tv_sec part overflows when multiplied
with NSEC_PER_SEC, i.e. 1e9.

This can be mitigated by using the timespec/val_to_ktime() helper, which
prevents the overflow and clamps the result to KTIME_MAX (~292 years).

Thanks,

	tglx

             reply	other threads:[~2017-06-20 15:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 15:37 Thomas Gleixner [this message]
2017-06-20 15:37 ` [patch 1/2] itimer: Make timeval to nsec conversion range limited Thomas Gleixner
2017-06-20 19:39   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-06-20 15:37 ` [patch 2/2] posix-cpu-timers: Make timespec to nsec conversion safe Thomas Gleixner
2017-06-20 19:40   ` [tip:timers/core] " tip-bot for 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=20170620153734.970526461@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=qiuxishi@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

Powered by JetHome