From: tip-bot for Al Viro <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: viro@ZenIV.linux.org.uk, viro@ZenIV.linux.org.uk,
tglx@linutronix.de, linux-kernel@vger.kernel.org,
peterz@infradead.org, mingo@kernel.org, hpa@zytor.com,
john.stultz@linaro.org
Subject: [tip:timers/core] posix-timers: Store rmtp into restart_block in sys_clock_nanosleep()
Date: Tue, 13 Jun 2017 15:06:20 -0700 [thread overview]
Message-ID: <tip-99e6c0e6ec349575886ca7daffc9cb7ec583176f@git.kernel.org> (raw)
In-Reply-To: <20170607084241.28657-5-viro@ZenIV.linux.org.uk>
Commit-ID: 99e6c0e6ec349575886ca7daffc9cb7ec583176f
Gitweb: http://git.kernel.org/tip/99e6c0e6ec349575886ca7daffc9cb7ec583176f
Author: Al Viro <viro@ZenIV.linux.org.uk>
AuthorDate: Wed, 7 Jun 2017 09:42:30 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 14 Jun 2017 00:00:41 +0200
posix-timers: Store rmtp into restart_block in sys_clock_nanosleep()
... instead of doing that in every ->nsleep() instance
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170607084241.28657-5-viro@ZenIV.linux.org.uk
---
kernel/time/alarmtimer.c | 8 +-------
kernel/time/posix-cpu-timers.c | 12 +++---------
kernel/time/posix-timers.c | 10 +++++-----
kernel/time/posix-timers.h | 2 +-
4 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index ac6e9bc..d859a36 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -753,8 +753,7 @@ static long __sched alarm_timer_nsleep_restart(struct restart_block *restart)
* Handles clock_nanosleep calls against _ALARM clockids
*/
static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
- struct timespec64 *tsreq,
- struct timespec __user *rmtp)
+ struct timespec64 *tsreq)
{
enum alarmtimer_type type = clock2alarm(which_clock);
struct restart_block *restart = ¤t->restart_block;
@@ -762,11 +761,6 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
ktime_t exp;
int ret = 0;
- if (flags & TIMER_ABSTIME)
- rmtp = NULL;
-
- restart->nanosleep.rmtp = rmtp;
-
if (!alarmtimer_get_rtcdev())
return -ENOTSUPP;
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 239fff9..ec6258c 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -1328,16 +1328,11 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
static long posix_cpu_nsleep_restart(struct restart_block *restart_block);
static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
- struct timespec64 *rqtp, struct timespec __user *rmtp)
+ struct timespec64 *rqtp)
{
struct restart_block *restart_block = ¤t->restart_block;
int error;
- if (flags & TIMER_ABSTIME)
- rmtp = NULL;
-
- restart_block->nanosleep.rmtp = rmtp;
-
/*
* Diagnose required errors first.
*/
@@ -1388,10 +1383,9 @@ static int process_cpu_timer_create(struct k_itimer *timer)
return posix_cpu_timer_create(timer);
}
static int process_cpu_nsleep(const clockid_t which_clock, int flags,
- struct timespec64 *rqtp,
- struct timespec __user *rmtp)
+ struct timespec64 *rqtp)
{
- return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);
+ return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp);
}
static long process_cpu_nsleep_restart(struct restart_block *restart_block)
{
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 1a9f59f..a3e5c01 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1041,11 +1041,8 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
* nanosleep for monotonic and realtime clocks
*/
static int common_nsleep(const clockid_t which_clock, int flags,
- struct timespec64 *tsave, struct timespec __user *rmtp)
+ struct timespec64 *tsave)
{
- if (flags & TIMER_ABSTIME)
- rmtp = NULL;
- current->restart_block.nanosleep.rmtp = rmtp;
return hrtimer_nanosleep(tsave, flags & TIMER_ABSTIME ?
HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
which_clock);
@@ -1070,8 +1067,11 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
t64 = timespec_to_timespec64(t);
if (!timespec64_valid(&t64))
return -EINVAL;
+ if (flags & TIMER_ABSTIME)
+ rmtp = NULL;
+ current->restart_block.nanosleep.rmtp = rmtp;
- return kc->nsleep(which_clock, flags, &t64, rmtp);
+ return kc->nsleep(which_clock, flags, &t64);
}
/*
diff --git a/kernel/time/posix-timers.h b/kernel/time/posix-timers.h
index b086f5b..bfd9e15 100644
--- a/kernel/time/posix-timers.h
+++ b/kernel/time/posix-timers.h
@@ -10,7 +10,7 @@ struct k_clock {
int (*clock_adj)(const clockid_t which_clock, struct timex *tx);
int (*timer_create)(struct k_itimer *timer);
int (*nsleep)(const clockid_t which_clock, int flags,
- struct timespec64 *, struct timespec __user *);
+ struct timespec64 *);
long (*nsleep_restart)(struct restart_block *restart_block);
int (*timer_set)(struct k_itimer *timr, int flags,
struct itimerspec64 *new_setting,
next prev parent reply other threads:[~2017-06-13 22:09 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 8:41 [PATCHSET] sanitizing compat nanosleep and other timer-related syscalls Al Viro
2017-06-07 8:42 ` [PATCH 01/16] move copyout of timespec into do_cpu_nanosleep() Al Viro
2017-06-07 8:42 ` [PATCH 02/16] move copyout and freeze handling into alarmtimer_do_nsleep() Al Viro
2017-06-13 22:04 ` [tip:timers/core] alarmtimer: Move " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 03/16] hrtimer_nanosleep(): pass rmtp in restart_block Al Viro
2017-06-13 22:05 ` [tip:timers/core] hrtimer_nanosleep(): Pass " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 04/16] move copyout to do_nanosleel() Al Viro
2017-06-13 22:05 ` [tip:timers/core] hrtimer: Move copyout of remaining time to do_nanosleep() tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 05/16] clock_nanosleep(): stash rmtp into restart_block Al Viro
2017-06-13 22:06 ` tip-bot for Al Viro [this message]
2017-06-07 8:42 ` [PATCH 06/16] nanosleep/clock_nanosleep: teach to do compat copyouts Al Viro
2017-06-07 10:07 ` Peter Zijlstra
2017-06-13 22:06 ` [tip:timers/core] time/posix-timers: Move the compat copyouts to the nanosleep implementations tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 07/16] {clock_,}nanosleep(2): merge timespec copyout logics into a new helper Al Viro
2017-06-13 22:07 ` [tip:timers/core] hrtimers/posix-timers: Merge nanosleep " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 08/16] kill ->nsleep_restart() Al Viro
2017-06-13 22:08 ` [tip:timers/core] posix-timers: Kill ->nsleep_restart() tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 09/16] move adjtimex-related compat syscalls to native counterparts Al Viro
2017-06-13 22:08 ` [tip:timers/core] ntp: Move adjtimex related " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 10/16] take compat timer_settime(2) to native one Al Viro
2017-06-13 22:09 ` [tip:timers/core] posix-timers: Take " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 11/16] take compat timer_gettime(2) " Al Viro
2017-06-13 22:09 ` [tip:timers/core] posix-timers: Take " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 12/16] move compat itimer syscalls to native ones Al Viro
2017-06-13 22:10 ` [tip:timers/core] itimers: Move " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 13/16] clock_gettime/clock_settime/clock_getres: move to native syscalls Al Viro
2017-06-13 22:10 ` [tip:timers/core] posix-timers: Move compat versions of clock_gettime/settime/getres tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 14/16] timer_create(): move compat to native, get rid of set_fs() Al Viro
2017-06-13 22:11 ` [tip:timers/core] posix-timers: Move compat_timer_create() " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 15/16] time()/stime(): move compat to native Al Viro
2017-06-13 22:11 ` [tip:timers/core] time: Move compat_time()/stime() " tip-bot for Al Viro
2017-06-07 8:42 ` [PATCH 16/16] gettimeofday()/settimeofday(): move compat " Al Viro
2017-06-13 22:12 ` [tip:timers/core] time: Move compat_gettimeofday()/settimeofday() " tip-bot for Al Viro
2017-06-12 23:08 ` [PATCH 01/16] move copyout of timespec into do_cpu_nanosleep() Thomas Gleixner
2017-06-13 7:46 ` Thomas Gleixner
2017-06-13 22:04 ` [tip:timers/core] posix-cpu-timers: Move " tip-bot for Al Viro
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=tip-99e6c0e6ec349575886ca7daffc9cb7ec583176f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=viro@ZenIV.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).