This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit
- From: Arnd Bergmann <arnd at arndb dot de>
- To: y2038 at lists dot linaro dot org, linux-kernel at vger dot kernel dot org
- Cc: Arnd Bergmann <arnd at arndb dot de>, linux-api at vger dot kernel dot org, linux-arch at vger dot kernel dot org, libc-alpha at sourceware dot org, tglx at linutronix dot de, netdev at vger dot kernel dot org, deepa dot kernel at gmail dot com, viro at zeniv dot linux dot org dot uk, albert dot aribaud at 3adev dot fr, Peter Zijlstra <peterz at infradead dot org>, Darren Hart <dvhart at infradead dot org>, "Eric W. Biederman" <ebiederm at xmission dot com>, Dominik Brodowski <linux at dominikbrodowski dot net>
- Date: Wed, 25 Apr 2018 18:03:10 +0200
- Subject: [PATCH 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit
- References: <20180425160311.2718314-1-arnd@arndb.de>
Once sys_rt_sigtimedwait() gets changed to a 64-bit time_t, we have
to provide compatibility support for existing binaries. Using the
compat_sys_rt_sigtimedwait() entry point is convenient because it allows
to share the implementation with 64-bit architectures.
Unfortunately, the get_compat_sigset() and copy_siginfo_to_user32()
functions are used in that function, but we can replace them with
trivial helpers that do the same thing as before.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
kernel/signal.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index d8d68a9556ae..72609c6835fd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3104,7 +3104,22 @@ int copy_siginfo_from_user32(struct siginfo *to,
}
return 0;
}
-#endif /* CONFIG_COMPAT */
+
+#else /* !CONFIG_COMPAT */
+
+/* 32-bit architectures only need to convert compat_time_t, not siginfo or sigset_t */
+
+#define compat_siginfo siginfo
+#define compat_sigset_t sigset_t
+#define copy_siginfo_to_user32 copy_siginfo_to_user
+static inline int get_compat_sigset(sigset_t *set, const sigset_t __user *compat)
+{
+ if (copy_from_user(set, compat, sizeof *set))
+ return -EFAULT;
+
+ return 0;
+}
+#endif /* !CONFIG_COMPAT */
/**
* do_sigtimedwait - wait for queued signals specified in @which
@@ -3202,7 +3217,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
return ret;
}
-#ifdef CONFIG_COMPAT
+#ifdef CONFIG_COMPAT_32BIT_TIME
COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
struct compat_siginfo __user *, uinfo,
struct compat_timespec __user *, uts, compat_size_t, sigsetsize)
--
2.9.0