Oleg Nesterov
080344b988
hrtimer: fix *rmtp handling in hrtimer_nanosleep()
...
Spotted by Pavel Emelyanov and Alexey Dobriyan.
hrtimer_nanosleep() sets restart_block->arg1 = rmtp, but this rmtp points to
the local variable which lives in the caller's stack frame. This means that
if sys_restart_syscall() actually happens and it is interrupted as well, we
don't update the user-space variable, but write into the already dead stack
frame.
Introduced by commit 04c227140f
hrtimer: Rework hrtimer_nanosleep to make sys_compat_nanosleep easier
Change the callers to pass "__user *rmtp" to hrtimer_nanosleep(), and change
hrtimer_nanosleep() to use copy_to_user() to actually update *rmtp.
Small problem remains. man 2 nanosleep states that *rtmp should be written if
nanosleep() was interrupted (it says nothing whether it is OK to update *rmtp
if nanosleep returns 0), but (with or without this patch) we can dirty *rem
even if nanosleep() returns 0.
NOTE: this patch doesn't change compat_sys_nanosleep(), because it has other
bugs. Fixed by the next patch.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru >
Cc: Alexey Dobriyan <adobriyan@sw.ru >
Cc: Michael Kerrisk <mtk.manpages@googlemail.com >
Cc: Pavel Emelyanov <xemul@sw.ru >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Toyo Abe <toyoa@mvista.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
include/linux/hrtimer.h | 2 -
kernel/hrtimer.c | 51 +++++++++++++++++++++++++-----------------------
kernel/posix-timers.c | 14 +------------
3 files changed, 30 insertions(+), 37 deletions(-)
2008-02-10 10:48:03 +01:00
..
2008-02-08 09:22:32 -08:00
2008-02-06 10:41:15 -08:00
2008-02-01 16:42:02 -05:00
2008-02-07 08:42:23 -08:00
2008-02-08 13:30:02 -08:00
2008-02-07 10:30:48 +00:00
2008-01-31 19:28:09 -08:00
2008-01-31 19:27:40 -08:00
2008-01-31 19:27:36 -08:00
2008-01-31 19:27:39 -08:00
2008-02-01 16:42:06 -05:00
2008-02-06 10:41:19 -08:00
2008-02-05 09:44:13 -08:00
2008-02-05 14:35:47 -05:00
2008-02-01 16:42:15 -05:00
2008-02-05 03:20:13 -08:00
2008-02-01 14:35:07 -08:00
2008-02-08 09:22:30 -08:00
2008-02-06 10:41:02 -08:00
2008-02-06 10:41:10 -08:00
2008-01-30 13:30:18 +01:00
2008-02-07 03:38:22 -05:00
2008-02-05 14:33:32 +10:00
2008-02-05 14:33:32 +10:00
2008-02-06 10:12:18 -07:00
2008-02-06 06:54:17 -05:00
2008-02-08 09:22:38 -08:00
2008-02-04 13:16:39 +00:00
2008-02-01 14:23:55 -05:00
2008-02-08 12:41:03 +01:00
2008-01-29 21:55:15 +01:00
2008-02-07 08:42:25 -08:00
2008-01-28 23:58:26 -05:00
2008-02-05 09:44:20 -08:00
2008-02-01 23:09:24 +01:00
2008-02-07 08:42:18 -08:00
2008-02-07 08:42:22 -08:00
2008-02-03 17:45:46 +02:00
2008-01-30 13:30:02 +01:00
2008-02-06 10:41:03 -08:00
2008-02-09 23:24:09 +01:00
2008-01-30 13:32:42 +01:00
2008-02-06 22:57:58 -05:00
2008-02-07 04:16:34 -05:00
2008-01-30 13:31:10 +01:00
2008-02-08 09:22:24 -08:00
2008-02-03 17:45:46 +02:00
2008-02-03 15:42:53 +02:00
2008-02-08 15:33:33 -08:00
2008-02-03 04:28:53 -08:00
2008-02-08 02:10:01 +00:00
2008-02-05 09:44:10 -08:00
2008-02-08 02:09:56 +00:00
2008-02-05 09:44:11 -08:00
2008-02-06 10:12:18 -07:00
2008-02-08 09:22:24 -08:00
2008-02-08 09:22:37 -08:00
2008-02-07 08:42:06 -08:00
2008-02-07 08:42:27 -08:00
2008-02-08 09:22:30 -08:00
2008-02-07 09:02:26 -08:00
2008-02-07 08:42:30 -08:00
2008-02-07 18:04:10 -06:00
2008-02-07 08:42:25 -08:00
2008-02-03 17:45:46 +02:00
2008-02-07 08:42:27 -08:00
2008-01-28 23:58:27 -05:00
2008-01-29 00:19:52 -05:00
2008-01-29 00:19:52 -05:00
2008-02-10 01:11:44 -05:00
2008-02-08 09:22:42 -08:00
2008-02-06 10:41:05 -08:00
2008-02-01 17:45:14 +01:00
2008-02-08 12:42:01 +01:00
2008-02-05 09:44:17 -08:00
2008-02-06 10:41:00 -08:00
2008-02-07 08:42:34 -08:00
2008-02-05 13:31:39 -05:00
2008-02-03 15:42:53 +02:00
2008-02-01 23:09:34 +01:00
2008-02-05 09:44:19 -08:00
2008-01-30 13:30:27 +01:00
2008-02-10 10:48:03 +01:00
2008-02-08 09:22:23 -08:00
2008-02-05 09:44:23 -08:00
2008-02-07 20:39:44 -05:00
2008-02-06 02:57:51 +01:00
2008-02-01 16:13:16 -05:00
2008-01-28 15:08:27 -08:00
2008-01-28 15:07:58 -08:00
2008-01-28 15:07:57 -08:00
2008-02-05 16:20:22 -08:00
2008-01-28 15:08:44 -08:00
2008-01-31 19:28:31 -08:00
2008-01-30 13:34:11 +01:00
2008-02-05 09:44:20 -08:00
2008-02-06 22:39:45 +01:00
2008-02-07 12:57:44 -08:00
2008-02-06 10:41:02 -08:00
2008-02-05 09:44:11 -08:00
2008-01-30 13:30:32 +01:00
2008-02-08 09:22:26 -08:00
2008-02-08 09:22:23 -08:00
2008-01-31 19:28:20 -08:00
2008-02-08 09:22:42 -08:00
2008-02-06 10:41:07 -08:00
2008-02-07 08:42:33 -08:00
2008-02-07 08:42:34 -08:00
2008-01-28 23:58:27 -05:00
2008-02-06 10:41:21 -08:00
2008-02-08 09:22:29 -08:00
2008-02-08 09:22:39 -08:00
2008-02-08 09:22:41 -08:00
2008-02-07 08:42:25 -08:00
2008-02-06 10:41:11 -08:00
2008-02-07 14:54:45 -08:00
2008-01-30 18:01:22 +02:00
2008-01-30 18:01:22 +02:00
2008-01-30 18:01:18 +02:00
2008-01-30 18:01:22 +02:00
2008-02-07 09:49:38 +00:00
2008-02-04 23:49:57 +11:00
2008-02-06 06:59:32 -05:00
2008-01-30 13:33:13 +01:00
2008-02-03 17:45:46 +02:00
2008-02-06 10:41:03 -08:00
2008-02-06 10:41:01 -08:00
2008-02-06 10:41:01 -08:00
2008-02-09 11:08:33 -08:00
2008-02-09 11:08:34 -08:00
2008-02-05 09:44:23 -08:00
2008-02-07 17:47:41 -08:00
2008-02-08 09:22:42 -08:00
2008-02-05 09:44:18 -08:00
2008-02-05 09:44:08 -08:00
2008-02-08 09:22:24 -08:00
2008-02-08 09:22:31 -08:00
2008-02-08 09:22:41 -08:00
2008-01-31 19:28:24 -08:00
2008-01-28 15:02:22 -08:00
2008-01-31 19:28:23 -08:00
2008-01-30 02:06:07 -05:00
2008-02-01 11:45:47 +11:00
2008-01-30 02:05:24 -05:00
2008-01-30 02:06:08 -05:00
2008-02-01 16:42:05 -05:00
2008-02-01 18:30:53 -05:00
2008-02-05 09:44:24 -08:00
2008-02-06 16:29:59 +11:00
2008-02-05 09:44:19 -08:00
2008-02-06 10:41:08 -08:00
2008-02-02 11:32:01 -08:00
2008-02-01 15:04:29 -08:00
2008-02-05 09:44:12 -08:00
2008-02-02 02:44:34 +03:00
2008-02-06 10:41:04 -08:00
2008-02-07 23:11:56 -08:00
2008-02-03 04:28:41 -08:00
2008-02-08 09:22:23 -08:00
2008-02-08 09:22:28 -08:00
2008-02-05 16:21:04 -08:00
2008-01-31 19:28:35 -08:00
2008-02-05 09:44:22 -08:00
2008-02-03 17:45:46 +02:00
2008-02-06 10:41:20 -08:00
2008-02-05 21:15:50 -05:00
2008-02-05 09:44:20 -08:00
2008-02-08 09:22:31 -08:00
2008-02-08 09:22:24 -08:00
2008-02-08 09:22:26 -08:00
2008-02-07 08:42:28 -08:00
2008-02-03 16:12:47 +02:00
2008-02-06 10:41:06 -08:00
2008-02-08 09:22:42 -08:00
2008-02-05 09:44:22 -08:00
2008-01-30 13:31:47 +01:00
2008-02-03 15:42:53 +02:00
2008-02-08 09:22:41 -08:00
2008-02-07 08:42:18 -08:00
2008-01-31 19:26:46 -08:00
2008-02-07 08:42:19 -08:00
2008-02-05 03:17:22 -08:00
2008-02-08 09:22:29 -08:00
2008-02-05 10:59:07 -05:00
2008-02-05 09:44:20 -08:00
2008-01-30 08:17:26 +11:00
2008-02-07 08:42:34 -08:00
2008-02-05 09:44:09 -08:00
2008-02-08 09:22:30 -08:00
2008-02-07 08:42:30 -08:00
2008-02-08 09:22:41 -08:00
2008-02-08 09:22:27 -08:00
2008-02-03 15:12:15 +02:00
2008-02-04 23:49:56 +11:00
2008-02-07 17:47:41 -08:00
2008-02-03 17:45:46 +02:00
2008-02-06 10:41:16 -08:00
2008-01-30 13:33:17 +01:00
2008-01-31 19:28:30 -08:00
2008-02-03 17:45:46 +02:00
2008-01-30 13:31:20 +01:00
2008-01-30 13:31:20 +01:00
2008-02-08 09:22:31 -08:00
2008-02-07 08:42:34 -08:00
2008-02-01 18:30:53 -05:00
2008-02-05 09:44:17 -08:00
2008-02-07 08:42:19 -08:00
2008-02-09 11:08:33 -08:00
2008-02-05 09:44:07 -08:00
2008-02-05 09:44:20 -08:00
2008-02-09 04:01:48 -05:00
2008-02-01 17:45:14 +01:00
2008-02-01 17:45:14 +01:00
2008-02-09 11:08:34 -08:00
2008-02-08 09:22:29 -08:00
2008-02-08 09:22:37 -08:00
2008-02-10 10:48:03 +01:00
2008-02-07 08:42:16 -08:00
2008-02-08 09:22:39 -08:00
2008-02-08 09:22:34 -08:00
2008-02-08 09:22:36 -08:00
2008-02-01 14:34:49 -08:00
2008-02-01 14:35:07 -08:00
2008-02-01 14:34:58 -08:00
2008-02-08 09:22:23 -08:00
2008-02-04 23:50:13 +11:00
2008-02-04 23:50:01 +11:00
2008-02-04 23:50:03 +11:00
2008-02-04 23:50:02 +11:00
2008-02-04 23:50:12 +11:00
2008-02-04 23:50:00 +11:00
2008-02-04 23:50:03 +11:00
2008-02-05 09:44:14 -08:00
2008-02-06 10:41:03 -08:00
2008-02-06 10:41:15 -08:00
2008-02-05 09:44:07 -08:00
2008-02-03 15:42:53 +02:00
2008-02-05 09:44:19 -08:00
2008-02-05 09:44:20 -08:00
2008-01-31 19:27:03 -08:00