Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-07-09 13:02:36 +0200
committerTakashi Iwai <tiwai@suse.de>2018-07-09 13:02:36 +0200
commit4e3472d744051ed3c8b44ab6c38e0f6398ba6807 (patch)
tree93a8bf7b2dfbc6c69c4461ab11ce4bc30b785f16
parent8725f3c6f3e8a74f8cc7dd64fe153ec0d931c1b4 (diff)
parentc27577224bb367f4c4670ee47ee1410eead0e89e (diff)
Merge cve/linux-4.4 into SLE12-SP3
-rw-r--r--patches.fixes/alarmtimer-Prevent-overflow-for-relative-nanosleep.patch51
-rw-r--r--series.conf2
2 files changed, 53 insertions, 0 deletions
diff --git a/patches.fixes/alarmtimer-Prevent-overflow-for-relative-nanosleep.patch b/patches.fixes/alarmtimer-Prevent-overflow-for-relative-nanosleep.patch
new file mode 100644
index 0000000000..2ae1e45c85
--- /dev/null
+++ b/patches.fixes/alarmtimer-Prevent-overflow-for-relative-nanosleep.patch
@@ -0,0 +1,51 @@
+From 5f936e19cc0ef97dbe3a56e9498922ad5ba1edef Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 2 Jul 2018 09:34:29 +0200
+Subject: [PATCH] alarmtimer: Prevent overflow for relative nanosleep
+Git-commit: 5f936e19cc0ef97dbe3a56e9498922ad5ba1edef
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Patch-mainline: Queued in subsystem maintainer repo
+References: CVE-2018-13053 bsc#1099924
+
+Air Icy reported:
+
+ UBSAN: Undefined behaviour in kernel/time/alarmtimer.c:811:7
+ signed integer overflow:
+ 1529859276030040771 + 9223372036854775807 cannot be represented in type 'long long int'
+ Call Trace:
+ alarm_timer_nsleep+0x44c/0x510 kernel/time/alarmtimer.c:811
+ __do_sys_clock_nanosleep kernel/time/posix-timers.c:1235 [inline]
+ __se_sys_clock_nanosleep kernel/time/posix-timers.c:1213 [inline]
+ __x64_sys_clock_nanosleep+0x326/0x4e0 kernel/time/posix-timers.c:1213
+ do_syscall_64+0xb8/0x3a0 arch/x86/entry/common.c:290
+
+alarm_timer_nsleep() uses ktime_add() to add the current time and the
+relative expiry value. ktime_add() has no sanity checks so the addition
+can overflow when the relative timeout is large enough.
+
+Use ktime_add_safe() which has the necessary sanity checks in place and
+limits the result to the valid range.
+
+Fixes: 9a7adcf5c6de ("timers: Posix interface for alarm-timers")
+Reported-by: Team OWL337 <icytxw@gmail.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: John Stultz <john.stultz@linaro.org>
+Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1807020926360.1595@nanos.tec.linutronix.de
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ kernel/time/alarmtimer.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/kernel/time/alarmtimer.c
++++ b/kernel/time/alarmtimer.c
+@@ -773,7 +773,8 @@ static int alarm_timer_nsleep(const cloc
+ /* Convert (if necessary) to absolute time */
+ if (flags != TIMER_ABSTIME) {
+ ktime_t now = alarm_bases[type].gettime();
+- exp = ktime_add(now, exp);
++
++ exp = ktime_add_safe(now, exp);
+ }
+
+ if (alarmtimer_do_nsleep(&alarm, exp))
diff --git a/series.conf b/series.conf
index 78f5681104..90bc5b0284 100644
--- a/series.conf
+++ b/series.conf
@@ -3944,6 +3944,8 @@
patches.suse/0001-softirq-Let-ksoftirqd-do-its-job.patch
patches.suse/0001-tick-broadcast-Reduce-lock-cacheline-contention.patch
+ patches.fixes/alarmtimer-Prevent-overflow-for-relative-nanosleep.patch
+
########################################################
# futex
########################################################