From patchwork Wed Apr 25 16:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 26976 Received: (qmail 63510 invoked by alias); 25 Apr 2018 16:05:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63390 invoked by uid 89); 25 Apr 2018 16:05:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mout.kundenserver.de From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit Date: Wed, 25 Apr 2018 18:03:10 +0200 Message-Id: <20180425160311.2718314-17-arnd@arndb.de> In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; V01:K0:Oosdo68u2U4=:YgtEXDoXI5qJ6H7G2PvusM zIdSwc9AXiAlDF1nCmGGc96+LmtoSED9ItFomRSi9kelrWEktjQ8H6J5ZE+L+3kbeiAo0oBeW BUVQXpAkVA91FVuXpHZEYpNjvDqUl2oEQ/gScSkHwUc408RjWGqR4/0fw/TdhCQyEOHzt5oE0 QPy6eFTXhlB5ZzErWnDyqgJKq8SlEWtIu1o8kQEhObS6uWr+afe+3/dnbjZu+nboiE61wzu0V 6rdRvGZHFF4W1soGVrYynkr1Nit6lfBtWgIOuo1rNvZQI7nfFuZam6uoQPX+h9/kzPVcJcZLI MuDsfnOU+7Ctn1fX/k+qTLj0VpGSqdt+TVmkFVrjpg9DU0DzAE/0ky86dJ1NG2CfuZ26ZaOIM DEHLwf3s1FG2ji3Qbv0Io2Va0f3B+oMz8Lduw8p+7qY0WVqR6lWxF0GDHQt3uxn7SMYsqXgra hW1tbuWjj+dOxuuvezPAitiKDNqLfxogBt6O+58woFhcHS9sxJB0z7VkCZ37LKOSf6DySKaQ9 +goiy2827IoUnEA/gXcLC/3SDOCKlf6tEnA7zCxuD2WXTtBjDjPdgtNGUhqazlI3gtC0DT6eN rqLjL78uEml+wDejJRCqxZnJ3gPLKU5MmqT/1NCx3YeH+524gede1sflP6TGtLjRgI5Lkzdu/ 2fNVhnF22Kzyn3IpZGz/IVAOPzbeIknYUeVVLkV3JYMKhaSbDzMCcEVCo9XDEmn67FjA= 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 --- 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)