From: Deepa Dinamani <deepa.kernel@gmail.com>
To: tglx@linutronix.de, linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, y2038@lists.linaro.org, linux-api@vger.kernel.org
Subject: [PATCH v3 7/7] timex: change syscalls to use struct __kernel_timex
Date: Fri, 6 Jul 2018 22:42:47 -0700 [thread overview]
Message-ID: <20180707054247.19802-8-deepa.kernel@gmail.com> (raw)
In-Reply-To: <20180707054247.19802-1-deepa.kernel@gmail.com>
struct timex is not y2038 safe.
Switch all the syscall apis to use y2038 safe __kernel_timex.
Note that sys_adjtimex() does not have a y2038 safe solution.
The api is meant to be deprecated on 32 bit machines after y2038.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-api@vger.kernel.org
---
include/linux/syscalls.h | 5 ++---
kernel/time/posix-timers.c | 10 +---------
kernel/time/time.c | 9 +++++++--
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 3ee3b3f1302f..54688c7b4dae 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -54,7 +54,6 @@ struct __sysctl_args;
struct sysinfo;
struct timespec;
struct timeval;
-struct timex;
struct timezone;
struct tms;
struct utimbuf;
@@ -677,7 +676,7 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv,
struct timezone __user *tz);
asmlinkage long sys_settimeofday(struct timeval __user *tv,
struct timezone __user *tz);
-asmlinkage long sys_adjtimex(struct timex __user *txc_p);
+asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p);
/* kernel/timer.c */
asmlinkage long sys_getpid(void);
@@ -846,7 +845,7 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd,
struct file_handle __user *handle,
int flags);
asmlinkage long sys_clock_adjtime(clockid_t which_clock,
- struct timex __user *tx);
+ struct __kernel_timex __user *tx);
asmlinkage long sys_syncfs(int fd);
asmlinkage long sys_setns(int fd, int nstype);
asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index a2595cb0cb16..1b485422f9f3 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1084,7 +1084,7 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
}
SYSCALL_DEFINE2(clock_adjtime, const clockid_t, which_clock,
- struct timex __user *, utx)
+ struct __kernel_timex __user *, utx)
{
const struct k_clock *kc = clockid_to_kclock(which_clock);
struct __kernel_timex ktx;
@@ -1159,10 +1159,6 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
return err;
}
-#endif
-
-#ifdef CONFIG_COMPAT
-
COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
struct compat_timex __user *, utp)
{
@@ -1187,10 +1183,6 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
return err;
}
-#endif
-
-#ifdef CONFIG_COMPAT_32BIT_TIME
-
COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
struct compat_timespec __user *, tp)
{
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 2c5afb008b14..a374fdbb368b 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -263,7 +263,10 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
}
#endif
-SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
+
+#if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT)
+
+SYSCALL_DEFINE1(adjtimex, struct __kernel_timex __user *, txc_p)
{
struct __kernel_timex txc; /* Local copy of parameter */
int ret;
@@ -278,7 +281,9 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
return copy_to_user(txc_p, &txc, sizeof(struct __kernel_timex)) ? -EFAULT : ret;
}
-#ifdef CONFIG_COMPAT
+#endif
+
+#ifdef CONFIG_COMPAT_32BIT_TIME
COMPAT_SYSCALL_DEFINE1(adjtimex, struct compat_timex __user *, utp)
{
--
2.17.1
next prev parent reply other threads:[~2018-07-07 5:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-07 5:42 [PATCH v3 0/7] Introduce struct __kernel_timex Deepa Dinamani
2018-07-07 5:42 ` Deepa Dinamani
2018-07-07 5:42 ` Deepa Dinamani
2018-07-07 5:42 ` [PATCH v3 1/7] arm64: Make basic compat_* types always available Deepa Dinamani
2018-07-12 8:20 ` Christoph Hellwig
2018-07-07 5:42 ` [PATCH v3 2/7] sparc: Make thread_info.h available directly Deepa Dinamani
2018-07-07 5:42 ` [PATCH v3 3/7] riscv: Delete asm/compat.h Deepa Dinamani
2018-07-07 5:42 ` Deepa Dinamani
2018-07-12 8:14 ` Christoph Hellwig
2018-07-12 8:14 ` Christoph Hellwig
2018-08-03 1:26 ` Palmer Dabbelt
2018-08-03 1:26 ` Palmer Dabbelt
2018-08-03 7:39 ` Christoph Hellwig
2018-08-03 7:39 ` Christoph Hellwig
2018-08-05 21:29 ` Arnd Bergmann
2018-08-05 21:29 ` Arnd Bergmann
2018-07-07 5:42 ` [PATCH v3 4/7] timex: prepare compat helpers for y2038 changes Deepa Dinamani
2018-07-07 5:42 ` [PATCH v3 5/7] time: Add struct __kernel_timex Deepa Dinamani
2018-07-11 9:54 ` Arnd Bergmann
2018-07-12 8:26 ` Christoph Hellwig
2018-07-12 14:53 ` Arnd Bergmann
2018-07-07 5:42 ` [PATCH v3 6/7] timex: use __kernel_timex internally Deepa Dinamani
2018-07-07 14:23 ` Richard Henderson
2018-07-07 14:23 ` Richard Henderson
2018-07-12 8:27 ` Christoph Hellwig
2018-07-07 5:42 ` Deepa Dinamani [this message]
2018-07-12 8:29 ` [PATCH v3 7/7] timex: change syscalls to use struct __kernel_timex Christoph Hellwig
2018-07-12 14:40 ` Arnd Bergmann
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=20180707054247.19802-8-deepa.kernel@gmail.com \
--to=deepa.kernel@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=y2038@lists.linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.