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: 134357 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1051747lji; Wed, 25 Apr 2018 09:05:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/AtI7PJTZs01z7FvrL1WbrezOa4y3nbilirJFRxScLsrzwOYTgKSlvAW4YHJiGbpVlxop X-Received: by 10.98.89.89 with SMTP id n86mr28558014pfb.158.1524672349856; Wed, 25 Apr 2018 09:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672349; cv=none; d=google.com; s=arc-20160816; b=h/b8fRai3yhEUeeranWPL8dhXayYk4MpKdU3Pcm4nHpCuU+WR52v1ym9cCuJXK+ccz 5hjFs9x3h3URbxcdEG0KIFC7NnUvD5i/K/VdyUvHJwedK6BNVZByQsJ3YnQQZOBpIA1j q2DMcHR5YFgv61scGb6Uz3ftNpbTFpUycsfMhsN9EvHPu8KYdfAFgqIsPcwzEVvDNJBX Kxoc2IPavLNH+0l7ldKIf7iKqk4TgL4MDy5wKUpIRqgLljkWw1wzoigT2eVPk0bD36Xm FxoH7cBb1NNVTa/moJuQfL1X7Cq76izNlhqVkow+HTZIvOUHOq4lrYQZbf4a0CHW16xq qnGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wF+p76L0GD+17hboodSoTXQq+yI0WScQEDNKiOtwDgo=; b=Pr2lMsyR07oq12xSu2hXJPerB3cPJ0WOiGKISiOGrO59rVHn+kU5BJaaMqQo2VvOwF HfW7jMCxg/HYA6dsIK3pG6KhuQPdSucULJPS6XLqqIDAC/Gh/UqY0UH3Wpo05iwCttQx ZYiuWm02b46lrgZecO6ZJ6a238uzoJbeVpPBBEvZTcmnOr4NoTqPhUqTDRk5eOdhX3S7 cuRq63HUIC8qfC10YuPrUR2VL9h7+ra/c4g64QWZimXjmxnbcUq0U/C4IFllp5A61FFc lrwJH2tjDmX2U19hU3/i+NOL+r3382YHGAB3EguBfF1dFkLVkyQdzkO0k5TMI2tW9pqu OlPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z187si9171792pgd.646.2018.04.25.09.05.39; Wed, 25 Apr 2018 09:05:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932173AbeDYQFZ (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:25 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:33469 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156AbeDYQFQ (ORCPT ); Wed, 25 Apr 2018 12:05:16 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LoYQs-1ejCo21Ubq-00gYgQ; Wed, 25 Apr 2018 18:03:40 +0200 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> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:aYuytPY9ZxuY2n95IiT46hqOMd4w2WVT4T3/vU3FunrNWAx6sgi 9glSg5Px0nJMoKgRir6IVo7LLENiyWtav5papzV4OdHi/NztYQMDOYJxGTS4BQJtrbUM0J/ +c6dN1cccrq2elFQL6bY2rE4X7bngj855m8S2B21QKwzOB5EQU8ObCfoZq4mkjlvrf6KmRt nS/7OgRQTKZ+kMseQwg3Q== 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= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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)