From patchwork Mon Jul 16 16:11:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142055 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604632ljj; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWe++esZGnzzFuxZvbDZN/qtlhQ6panj08e/QEeRI8mqXb9Dhg3Ft/A1IiC3860yNxxO/J X-Received: by 2002:a17:902:7147:: with SMTP id u7-v6mr16930194plm.154.1531757555595; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757555; cv=none; d=google.com; s=arc-20160816; b=WhYLjiqylw0Ff2P/vB5v7oI+lbySRUxsK2gRm3H0LZJ2s7RQPNOFGkYVeJMSzBe03n iXRcuN27kmm7a0qZp2XEAhaa5dRcJE2IaEJuE4XJYC+XsvSIZf0kn5fehX3ReQFiQk3M CGbOeGOyUbbnf7inBMY8607HJePkibIcwniCliW8Goec2A5Jl9BkdgaFNeaxov92xC0w tOd7DBB9yKYvrvqHMTXRBcQurlYbjvwYzQpsN/9iA53ilyzaRM1kxOzNdrF+vOi2VnLz I4eYeNmWPuTZHktYXNtBrWVDFhyYkczDwoHL3u3N12SelLiS4qABjugQxYNn0fsJK5OL zBIA== 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=LberCnEAn4JaP0Ytk0nK3DG8wyhMR7evDpijrNoo0Qw=; b=CEn3asyxEpVWdpaNK5xcDk0hKiRXcCtbT1MgESl1+mf4rk/BAos/+VzuggMtQZikpG JdLLlFT5m70a3TO7m+q4LaVWbutoW92KjB72R1/LpTll+GwxRjiboQREzVtvaUY8IJox 8laPPY6nGZoV0kAslGNaq50NLT1QvZMjLgQtPhPUrYmizEO6u0eUI0uc3b7fgc0GUL0L bwK/YTejHz10IhlHTkZRBnzT0GYxkr9dn0ocM7qJnkHOOOwoMCb/i1Dfo7w19+x8ezh/ SS0WOd1yTecBlN36OykfHgB6046CB683N2xJSVUy+z3tadaQHt79Ueh9vc4cIwLABXcX 7fmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 k7-v6si27948588pgq.548.2018.07.16.09.12.35; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731244AbeGPQkk (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:44122 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730304AbeGPQkI (ORCPT ); Mon, 16 Jul 2018 12:40:08 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MXjQA-1fa8I82Vni-00WYn2; Mon, 16 Jul 2018 18:11:14 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit Date: Mon, 16 Jul 2018 18:11:02 +0200 Message-Id: <20180716161103.16239-17-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:SAw4Tq8XH8G7p6wFx6/YJEqMJS4uan6mPWN7tCANUAclCm7NaZm 1O0r8bOsQH6rFOQl6RQaviKDTtceSd1QtRHZGSXWAduVCOMT0h0WvVWpiIZdwFCwb5HASPl sZs1aMvIoIFMX5QATXkwz2f1P2g2lqLiwOE47RpaofeESpmUfFKxQPkvZkQqpxfPvZahY+C XFixwTiat7NepiKvS4pBg== X-UI-Out-Filterresults: notjunk:1; V01:K0:eAH8wR4ZJM8=:sQCIqnNciQq60hbr1xpRVw QrdjgdyK+B0vdv04NTerCH7hhqqcrHL1zHegu+mDmzE6oj55fOjpQdYbvKKqrFnM03NoDO/Mn R2bAkJs8x1sGXPY+UERzpbF0YPJEwa+uGmQ7toRtk1g0pTx03wF89VU02ZXlKFN0WQJoImZf4 CZWY9v/+DWHPpoXPXU++8gVUSnJhL1G3xTlGVCzQitjEm4hHd6BbtX/hWdSLqCzs+jK6hvUK6 tvlSoV/V5zgU9kx5YOxz91GDkyBXy86Xvw85rP8BRtVpAXfKSW7leAdAsssQskyC8xUdYjrSI TV228l3QZb45vITMsq6yFFGzXBurOJT/dHVrDl4I2Orc1IgBEiVGyEPF0ihbat48iZ6weG/wf B00TMgXWGNp6YRaa5SYvjoPzYltRDKh7JSP0tifnAHikQ02ZrMY4ywxTVWPlp+YxpBLTRr7yZ YQlsDSwy0BrS3MvGj9rg/gSrsoGQcSosS12PONaGoTZwU/bXfxrW9M+GGYkqUkmvbFnEUvahC VtQdLfRud3Vagbv5jXNEwXuk+AV0wrBQ7cyKCwW8LGvoiD2VS40lHWPPfeNsGJZLERihaXTtA bfQg9acjudVdJrs+at8F4xiG20bq8b+85LXlIGm4m+stv8BN53Qvien+X6Hir40uIpPndpO6b RN5MpLESG0HcZLwnZmjWwn//fELXwHNpnXga0hidsWEov1Vhbrx1Dbz9sVPbY8oZTByw= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 0418a499b9f3..8d4382d5182f 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3027,7 +3027,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 @@ -3125,7 +3140,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)