* [PATCH v2 0/7] Change k_clock interfaces to use timespec64
@ 2017-03-26 19:04 Deepa Dinamani
2017-03-26 19:04 ` [PATCH v2 1/7] time: Delete do_sys_setimeofday() Deepa Dinamani
0 siblings, 1 reply; 2+ messages in thread
From: Deepa Dinamani @ 2017-03-26 19:04 UTC (permalink / raw)
To: tglx, linux-kernel
Cc: arnd, y2038, netdev, Richard Cochran, john.stultz, linux-alpha
The series is aimed at replacing struct timespec which is not
y2038 safe with y2038 safe struct timespec64 for k_clock interfaces.
The series also replaces struct itimerspec which uses struct timespec
internally with struct itimerspec64 for the k_clock interfaces.
The series does not change the syscall interface.
This will be done in a follow up series.
A few existing checkpatch-noted style issues, such as the 80 line
character limit, have been left as-is to facilitate easier review.
Changes since v1:
* Address review comments for change logs and coding style.
* Fix kbuild test error for alpha.
Deepa Dinamani (7):
time: Delete do_sys_setimeofday()
time: Change posix clocks ops interfaces to use timespec64
Change k_clock clock_get() to use timespec64
Change k_clock clock_getres() to use timespec64
Change k_clock clock_set() to use timespec64
Change k_clock timer_set() and timer_get() to use timespec64
Change k_clock nsleep() to use timespec64
arch/alpha/kernel/osf_sys.c | 4 +-
drivers/char/mmtimer.c | 28 ++++++-------
drivers/ptp/ptp_clock.c | 18 ++++----
include/linux/hrtimer.h | 2 +-
include/linux/posix-clock.h | 10 ++---
include/linux/posix-timers.h | 20 ++++-----
include/linux/timekeeping.h | 20 +++------
kernel/compat.c | 10 +++--
kernel/time/alarmtimer.c | 24 +++++------
kernel/time/hrtimer.c | 10 +++--
kernel/time/posix-clock.c | 10 ++---
kernel/time/posix-cpu-timers.c | 66 +++++++++++++++--------------
kernel/time/posix-stubs.c | 20 ++++++---
kernel/time/posix-timers.c | 95 ++++++++++++++++++++++++------------------
kernel/time/time.c | 4 +-
15 files changed, 179 insertions(+), 162 deletions(-)
--
2.7.4
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: netdev@vger.kernel.org
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 1/7] time: Delete do_sys_setimeofday()
2017-03-26 19:04 [PATCH v2 0/7] Change k_clock interfaces to use timespec64 Deepa Dinamani
@ 2017-03-26 19:04 ` Deepa Dinamani
0 siblings, 0 replies; 2+ messages in thread
From: Deepa Dinamani @ 2017-03-26 19:04 UTC (permalink / raw)
To: tglx, linux-kernel; +Cc: y2038, john.stultz, arnd, linux-alpha
struct timespec is not y2038 safe on 32 bit machines
and needs to be replaced with struct timespec64.
do_sys_timeofday() is just a wrapper function.
Replace all calls to this function with direct
calls to do_sys_timeofday64() instead and delete
do_sys_timeofday().
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-alpha@vger.kernel.org
---
arch/alpha/kernel/osf_sys.c | 4 +++-
include/linux/timekeeping.h | 15 ---------------
kernel/compat.c | 4 ++--
kernel/time/posix-stubs.c | 5 ++++-
kernel/time/posix-timers.c | 5 ++++-
kernel/time/time.c | 4 ++--
6 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 0b96109..9de47a9 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1016,6 +1016,7 @@ SYSCALL_DEFINE2(osf_gettimeofday, struct timeval32 __user *, tv,
SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
struct timezone __user *, tz)
{
+ struct timespec64 kts64;
struct timespec kts;
struct timezone ktz;
@@ -1023,13 +1024,14 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
if (get_tv32((struct timeval *)&kts, tv))
return -EFAULT;
kts.tv_nsec *= 1000;
+ kts64 = timespec_to_timespec64(kts);
}
if (tz) {
if (copy_from_user(&ktz, tz, sizeof(*tz)))
return -EFAULT;
}
- return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
+ return do_sys_settimeofday64(tv ? &kts64 : NULL, tz ? &ktz : NULL);
}
asmlinkage long sys_ni_posix_timers(void);
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b598cbc..3617a78 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -19,21 +19,6 @@ extern void do_gettimeofday(struct timeval *tv);
extern int do_settimeofday64(const struct timespec64 *ts);
extern int do_sys_settimeofday64(const struct timespec64 *tv,
const struct timezone *tz);
-static inline int do_sys_settimeofday(const struct timespec *tv,
- const struct timezone *tz)
-{
- struct timespec64 ts64;
-
- if (!tv)
- return do_sys_settimeofday64(NULL, tz);
-
- if (!timespec_valid(tv))
- return -EINVAL;
-
- ts64 = timespec_to_timespec64(*tv);
- return do_sys_settimeofday64(&ts64, tz);
-}
-
/*
* Kernel time accessors
*/
diff --git a/kernel/compat.c b/kernel/compat.c
index 19aec5d..e29a01a 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -109,7 +109,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
struct timezone __user *, tz)
{
struct timeval user_tv;
- struct timespec new_ts;
+ struct timespec64 new_ts;
struct timezone new_tz;
if (tv) {
@@ -123,7 +123,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
return -EFAULT;
}
- return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+ return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
}
static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv)
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c
index cd6716e..95a1b1f 100644
--- a/kernel/time/posix-stubs.c
+++ b/kernel/time/posix-stubs.c
@@ -49,13 +49,16 @@ SYS_NI(alarm);
SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
const struct timespec __user *, tp)
{
+ struct timespec64 new_tp64;
struct timespec new_tp;
if (which_clock != CLOCK_REALTIME)
return -EINVAL;
if (copy_from_user(&new_tp, tp, sizeof (*tp)))
return -EFAULT;
- return do_sys_settimeofday(&new_tp, NULL);
+
+ new_tp64 = timespec_to_timespec64(new_tp);
+ return do_sys_settimeofday64(&new_tp64, NULL);
}
SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 50a6a47..f215ef7 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -214,7 +214,10 @@ static int posix_clock_realtime_get(clockid_t which_clock, struct timespec *tp)
static int posix_clock_realtime_set(const clockid_t which_clock,
const struct timespec *tp)
{
- return do_sys_settimeofday(tp, NULL);
+ struct timespec64 tp64;
+
+ tp64 = timespec_to_timespec64(*tp);
+ return do_sys_settimeofday64(&tp64, NULL);
}
static int posix_clock_realtime_adj(const clockid_t which_clock,
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 25bdd25..6574bba 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -193,8 +193,8 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz
SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
struct timezone __user *, tz)
{
+ struct timespec64 new_ts;
struct timeval user_tv;
- struct timespec new_ts;
struct timezone new_tz;
if (tv) {
@@ -212,7 +212,7 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
return -EFAULT;
}
- return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+ return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
}
SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
--
2.7.4
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-26 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-26 19:04 [PATCH v2 0/7] Change k_clock interfaces to use timespec64 Deepa Dinamani
2017-03-26 19:04 ` [PATCH v2 1/7] time: Delete do_sys_setimeofday() Deepa Dinamani
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).