Skip to contentSkip to conversation

hrtimer fixes

GIT PULL Thomas Gleixner 3 participants 7 messages Feb 14, 2008 – Feb 18, 2008

lore
Share & tools
lore
#0 lore raw

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

The second patch prevents a false positive of the same WARN_ON().

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Thanks,

tglx
---

Thomas Gleixner (2):
hrtimer: check relative timeouts for overflow
hrtimer: catch expired CLOCK_REALTIME timers early

 include/linux/ktime.h |    2 ++
 kernel/futex.c        |    2 +-
 kernel/futex_compat.c |    2 +-
 kernel/hrtimer.c      |   48 +++++++++++++++++++++++++++++++-----------------
 kernel/posix-timers.c |    8 +++++---
 5 files changed, 40 insertions(+), 22 deletions(-)
include/linux/ktime.h +2 -0
index 36c542b..2cd7fa7 100644
@@ -310,6 +310,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
 	return ktime_sub_ns(kt, usec * 1000);
 }
 
+extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * the clock_getres() system call to give application programmers an
kernel/futex.c +1 -1
index a6baaec..221f212 100644
@@ -2116,7 +2116,7 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
 
 		t = timespec_to_ktime(ts);
 		if (cmd == FUTEX_WAIT)
-			t = ktime_add(ktime_get(), t);
+			t = ktime_add_safe(ktime_get(), t);
 		tp = &t;
 	}
 	/*
kernel/futex_compat.c +1 -1
index 133d558..7d5e4b0 100644
@@ -176,7 +176,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
 
 		t = timespec_to_ktime(ts);
 		if (cmd == FUTEX_WAIT)
-			t = ktime_add(ktime_get(), t);
+			t = ktime_add_safe(ktime_get(), t);
 		tp = &t;
 	}
 	if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
kernel/hrtimer.c +31 -17

85 lines not on this page · raw message

kernel/posix-timers.c +5 -3
index 022c9c3..a9b0420 100644
@@ -767,9 +767,11 @@ common_timer_set(struct k_itimer *timr, int flags,
 	/* SIGEV_NONE timers are not queued ! See common_timer_get */
 	if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
 		/* Setup correct expiry time for relative timers */
-		if (mode == HRTIMER_MODE_REL)
-			timer->expires = ktime_add(timer->expires,
-						   timer->base->get_time());
+		if (mode == HRTIMER_MODE_REL) {
+			timer->expires =
+				ktime_add_safe(timer->expires,
+					       timer->base->get_time());
+		}
 		return 0;
 	}
 
#1 lore raw
Quoted 6 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

Quoted 7 lines

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

The second patch prevents a false positive of the same WARN_ON().

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

If so, you can just add a:
Cc: stable <[email protected]>
to the signed-off-by area, and we (the stable tree developers) will get an automated email when it goes into Linus's tree, with the git changelog entry.

thanks,

greg k-h

#2 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

Quoted 5 lines
Quoted 3 lines

The second patch prevents a false positive of the same WARN_ON().

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

Yes, both are for stable as well. The report was against 2.6.24 stable

Quoted 5 lines

If so, you can just add a:
Cc: stable <[email protected]>
to the signed-off-by area, and we (the stable tree developers) will get an automated email when it goes into Linus's tree, with the git changelog entry.

Will do next time.

Thanks,

tglx

#3 lore raw
Quoted 13 lines · Thomas Gleixner
Quoted 11 lines · Greg KH
Quoted 10 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

The second patch prevents a false positive of the same WARN_ON().

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

Yes, both are for stable as well. The report was against 2.6.24 stable

Cool. But the stable team deals with individual patches, not git pulls. Can you send us the individual patches when they hit Linus's tree?

thanks,

greg k-h

#4 lore raw
Quoted 16 lines · Greg KH
Quoted 15 lines · Thomas Gleixner
Quoted 13 lines · Greg KH
Quoted 12 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

The second patch prevents a false positive of the same WARN_ON().

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

Yes, both are for stable as well. The report was against 2.6.24 stable

Cool. But the stable team deals with individual patches, not git pulls. Can you send us the individual patches when they hit Linus's tree?

Sure, will do.

Thanks,

tglx

#5 lore raw
In reply to Greg KH
Quoted 16 lines · On Thu, 14 Feb 2008 13:45:42 -0800 Greg KH <[email protected]> wrote:
Quoted 15 lines · Thomas Gleixner
Quoted 13 lines · Greg KH
Quoted 12 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

The second patch prevents a false positive of the same WARN_ON().

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

Yes, both are for stable as well. The report was against 2.6.24 stable

Cool. But the stable team deals with individual patches, not git pulls. Can you send us the individual patches when they hit Linus's tree?

Confused. That assertion appears to conflict with your earlier

"you can just add a: Cc: stable <[email protected]> to the signed-off-by
area, and we (the stable tree developers) will get an automated email when it goes into Linus's tree, with the git changelog entry."

#6 lore raw
Quoted 28 lines · Andrew Morton
Quoted 16 lines · On Thu, 14 Feb 2008 13:45:42 -0800 Greg KH <[email protected]> wrote:
Quoted 15 lines · Thomas Gleixner
Quoted 13 lines · Greg KH
Quoted 12 lines · Thomas Gleixner

Linus,

please pull hrtimer fixes from:

ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git master

The first patch fixes an overflow problem, which is caused by missing checks in the relative to absolute time conversion in the futex code. It got caught by the WARN_ON() in clockevents_program_event().

The second patch prevents a false positive of the same WARN_ON().

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Fixes are confirmed to solve http://lkml.org/lkml/2008/2/10/137

Are one of these needed in the stable tree?

Yes, both are for stable as well. The report was against 2.6.24 stable

Cool. But the stable team deals with individual patches, not git pulls. Can you send us the individual patches when they hit Linus's tree?

Quoted 5 lines

Confused. That assertion appears to conflict with your earlier

"you can just add a: Cc: stable <[email protected]> to the signed-off-by
area, and we (the stable tree developers) will get an automated email when it goes into Linus's tree, with the git changelog entry."

Hm, no, we still deal with patches, and unless Thomas had added that to his patches, we would not have seen it. He was asking us to pull a git tree :)

I guess I need to write up a "best way to deal with the stable tree" type email and send it out to try to remove any confusion here. But that will have to wait until tonight, it's a nice day out, a rarity this time of year, and I'm supposed to not be working today, time to go take the kids and play outside...

thanks,

greg k-h