* [PATCH v3 0/7] Introduce struct __kernel_timex
@ 2018-07-07 5:42 Deepa Dinamani
2018-07-07 5:42 ` [PATCH v3 7/7] timex: change syscalls to use " Deepa Dinamani
0 siblings, 1 reply; 4+ messages in thread
From: Deepa Dinamani @ 2018-07-07 5:42 UTC (permalink / raw)
To: tglx, linux-kernel
Cc: linux-arch, palmer, arnd, y2038, catalin.marinas, linux-alpha,
netdev, linux-api, linux-riscv, davem
The series introduces struct __kernel_timex as a substitute for
the non y2038 safe struct timex.
The series is based on the original series posted by Arnd Bergmann
in [1].
The overview of the series is as below:
1. Prepare for the compat timex interfaces to be used unconditionally.
2. Introduce struct __kernel_timex.
3. Use struct __kernel_timex in place of struct timex.
4. Switch syscalls to use struct __kernel_timex.
[1] https://sourceware.org/ml/libc-alpha/2015-05/msg00070.html
Changes since v2:
* Use only generic compat.h for riscv
Changes since v1:
* Fix riscv asm/compat.h to pick up generic compat types
Deepa Dinamani (7):
arm64: Make basic compat_* types always available
sparc: Make thread_info.h available directly
riscv: Delete asm/compat.h
timex: prepare compat helpers for y2038 changes
time: Add struct __kernel_timex
timex: use __kernel_timex internally
timex: change syscalls to use struct __kernel_timex
arch/alpha/kernel/osf_sys.c | 2 +-
arch/arm64/include/asm/compat.h | 22 ++++-----
arch/riscv/include/asm/Kbuild | 1 +
arch/riscv/include/asm/compat.h | 29 ------------
arch/sparc/include/asm/compat.h | 2 +
drivers/ptp/ptp_clock.c | 2 +-
include/asm-generic/compat.h | 8 +++-
include/linux/compat.h | 33 --------------
include/linux/compat_time.h | 34 ++++++++++++++
include/linux/posix-clock.h | 2 +-
include/linux/syscalls.h | 5 +--
include/linux/timex.h | 9 +++-
include/uapi/linux/timex.h | 41 +++++++++++++++++
kernel/compat.c | 63 --------------------------
kernel/time/ntp.c | 12 ++---
kernel/time/ntp_internal.h | 2 +-
kernel/time/posix-clock.c | 2 +-
kernel/time/posix-timers.c | 14 ++----
kernel/time/posix-timers.h | 2 +-
kernel/time/time.c | 80 ++++++++++++++++++++++++++++++---
kernel/time/timekeeping.c | 4 +-
21 files changed, 199 insertions(+), 170 deletions(-)
delete mode 100644 arch/riscv/include/asm/compat.h
base-commit: 526674536360a4c508e84f67314c2028e45e1bf2
--
2.17.1
Cc: catalin.marinas@arm.com
Cc: davem@davemloft.net
Cc: linux-alpha@vger.kernel.org
Cc: linux-api@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: netdev@vger.kernel.org
Cc: palmer@sifive.com
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 7/7] timex: change syscalls to use struct __kernel_timex
2018-07-07 5:42 [PATCH v3 0/7] Introduce struct __kernel_timex Deepa Dinamani
@ 2018-07-07 5:42 ` Deepa Dinamani
2018-07-12 8:29 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Deepa Dinamani @ 2018-07-07 5:42 UTC (permalink / raw)
To: tglx, linux-kernel; +Cc: arnd, y2038, linux-api
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 7/7] timex: change syscalls to use struct __kernel_timex
2018-07-07 5:42 ` [PATCH v3 7/7] timex: change syscalls to use " Deepa Dinamani
@ 2018-07-12 8:29 ` Christoph Hellwig
2018-07-12 14:40 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2018-07-12 8:29 UTC (permalink / raw)
To: Deepa Dinamani; +Cc: tglx, linux-kernel, arnd, y2038, linux-api
On Fri, Jul 06, 2018 at 10:42:47PM -0700, Deepa Dinamani wrote:
> struct timex is not y2038 safe.
> Switch all the syscall apis to use y2038 safe __kernel_timex.
So you switch existing syscalls to use a different structure.
If this actually happens to be safe it needs a big explanation
in the commit log.
> -#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
And this unconditionally defines clock_adjtime, but doesn't actually
seem to add callers, which looks rather odd. Same for other bits
in the patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 7/7] timex: change syscalls to use struct __kernel_timex
2018-07-12 8:29 ` Christoph Hellwig
@ 2018-07-12 14:40 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2018-07-12 14:40 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Deepa Dinamani, Thomas Gleixner, Linux Kernel Mailing List,
y2038 Mailman List, Linux API
On Thu, Jul 12, 2018 at 10:29 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Jul 06, 2018 at 10:42:47PM -0700, Deepa Dinamani wrote:
>
>> -#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
>
> And this unconditionally defines clock_adjtime, but doesn't actually
> seem to add callers, which looks rather odd. Same for other bits
> in the patch.
It really just moves compat_sys_clock_adjtime() into the same
#ifdef CONFIG_COMPAT_32BIT_TIME that hides the surrounding
functions.
Currently CONFIG_COMPAT_32BIT_TIME is used only as a subset
of CONFIG_COMPAT, and the plan was to have 32-bit architectures
enable it later so they could get access to all the functions
implementing 32-bit time with a patch similar to what I'm testing
with, see https://pastebin.com/F3QZdyin for the current draft that
I use for testing.
We already spent several review rounds coming just discussing the
naming of the macros etc before we decided on the
CONFIG_64BIT_TIME and CONFIG_COMPAT_32BIT_TIME
symbol, but if you have a better suggestion (as part of moving
away from the compat_ naming), we can change all that again.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-12 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-07 5:42 [PATCH v3 0/7] Introduce struct __kernel_timex Deepa Dinamani
2018-07-07 5:42 ` [PATCH v3 7/7] timex: change syscalls to use " Deepa Dinamani
2018-07-12 8:29 ` Christoph Hellwig
2018-07-12 14:40 ` Arnd Bergmann
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).