Received: by 10.192.165.156 with SMTP id m28csp797227imm; Thu, 19 Apr 2018 07:44:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zcBPJK0XANCM9V+/tBxqYRzSjfaDWsVMVVYfSmTTspLm04EakLCBzvtX1J6ePlSlASglX X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr6515812pls.109.1524149042942; Thu, 19 Apr 2018 07:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524149042; cv=none; d=google.com; s=arc-20160816; b=KPLVbPtw1/nIZjodrVV0/ngi0DvDlms9RynhZN+pg0pdeK7Hzl9cy0a03tP898XBtZ sIuxEfiucXeRbYDyILgFEwZFePZr6M5soOs5wMGwjUvdE+TELbw9MctWLOcj+Rd/oJKW aB99Qs8KipRJbIE1fTNUhs2t2OAdKB62jhR4hcMfQhDVI5f10gIjQSVlCLsO/k0q1vcr /fS7coycvSVheUpdjV99eTCFwS1AmaFAO0mFvaUiD2MsSOJt3UEakA1Iw5sKLktONUi7 YgNJvPw6IOC+ZbaclEPzIZgfCTOmSTTD4Gs19Egft/7gmhLt0/w9dGTOj9uCzH9O1tC2 F/aA== 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=CLZOfbiWuiHqC0BeAcR402aTnRNG5tOEtrsqLfrGOcE=; b=n7ohFqKtk1TWYaK5Sm8FGtK+TprG1BwCVlpWTyY8iUaN/ee7e85ECYhz3MWpD7aFTu ySeFklzI8y18saoFCNLUPKnkOT9F/6d1evCzQ0wdm76mV59FcDXOy6nBZ/QYiqzbRVav f4Swt/ibrHPtVSHqzupqjpi8x9+Y/SlJDHuduMZGNQJYGisZdfee2wwbOe4kaT0+idBB l3Hav9+BE1KgYT8yJTFpoTYLhtkIjxG8oLRHqYPBywDKtgzIvE9uDAM2luq9qLt8N3S5 ZQebEzKObSgOa2ZupWEE+REcfBdOETiRBHiAR8mg12f61P41acsPWElpW0aegzpD13qg 3pww== 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 f3-v6si3659119pld.513.2018.04.19.07.43.49; Thu, 19 Apr 2018 07:44:02 -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 S1753723AbeDSOmi (ORCPT + 99 others); Thu, 19 Apr 2018 10:42:38 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:46887 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbeDSOiv (ORCPT ); Thu, 19 Apr 2018 10:38:51 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lvjxc-1eLaGC0etA-017R1Z; Thu, 19 Apr 2018 16:38:00 +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, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, ebiederm@xmission.com, albert.aribaud@3adev.fr, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, x86@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-mips@linux-mips.org, jhogan@kernel.org, ralf@linux-mips.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: [PATCH v3 15/17] y2038: ipc: Enable COMPAT_32BIT_TIME Date: Thu, 19 Apr 2018 16:37:35 +0200 Message-Id: <20180419143737.606138-16-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180419143737.606138-1-arnd@arndb.de> References: <20180419143737.606138-1-arnd@arndb.de> X-Provags-ID: V03:K1:hTc/tiy+Hysq7Qezx00qPc3pSW3JxV9JMzmbP4EF+StwAcj79kc 0TMq2vq1ymiJZHIxBh2mRObbcYc3Jl/AssGWTR0N0UAOSENbGWY4OOUG+WB7T8eJlbNuXDf EPrNYNJVCS55yz6uGdXKcbK+k0HzUyOwnxwmHsY8Ax5PT+eeh8wRjVS1rH45CgQHRkfp28a S/3OM/8MDTzrB+HtmZyrg== X-UI-Out-Filterresults: notjunk:1;V01:K0:28YI5D+IHS0=:xWOSR6zBUn8BQ/UqyYRXhL 2jZ4Ua5Tfz9y0nGYuNgtJ9AoCf9UVNlxLpbksG0+sz62morHm8WPh3bFcloBjOtBrSOUr/vPG DhWUmefNuknVVKQuU4o/SKwwfiH7kMuQX+ZjQP2U7OmH+OnsrEUi4pAU/GpmJDw1+qXMb8M5F W/gGGNG0MmcZT6KcXRkibJFlATILysA2vPaIC9NFHW18BEoIvPdnRMW/IdbxxuzO1KJl0Kpvw LA+SsUdEVQqcAZYYv2QeM7MpebnMa9uzx8iGyyOqpQODHQ5zsJbm+057hZLmy4BcDVwvJgegB p7ttbRHoJxZmSuD+hSWZQAXSoLqRHJ1fAzLcrROj0F7D7XmgC7Nk9duydcz2tasnKj5ewVXn1 VITs/xOJttlXqNsGlFsw2dzpOG7SlDOuQ9Ufo0iS0sCj+xqFCEVdlSjB/KmPTS7aEeZU2jnib tyDfbE5G2DAt7k6CngpfxCGzCvSIi/QnhVRFJfLoTm4e+a78viD7ju8kMhUGx8IMijdKR89Tk sG4xFXBUB2v2iQ/4IzISz2jPK67F5LyVl2AY7dyE1dunUwbATjPl6OAdKVp7Sb03hin35+S52 pqzB073jE4UpbbeZWd/xK6Xlv0xmOWQooe1DptZpGLTJpg1JvjE1+cvVF3AnA+S6AglSphNXY ehylfKumwMRdgYeuwfQGzJ7KEy+QNKGtTQh37Q8B+2nMycuNvNE/VU4vX1BmlewA11eET4EmW 3JshkqEEpZa2OxYUdnRuu9OsKgy5C8SQB1uUfw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Three ipc syscalls (mq_timedsend, mq_timedreceive and and semtimedop) take a timespec argument. After we move 32-bit architectures over to useing 64-bit time_t based syscalls, we need seperate entry points for the old 32-bit based interfaces. This changes the #ifdef guards for the existing 32-bit compat syscalls to check for CONFIG_COMPAT_32BIT_TIME instead, which will then be enabled on all existing 32-bit architectures. Signed-off-by: Arnd Bergmann --- ipc/mqueue.c | 80 +++++++++++++++++++++++++++++++----------------------------- ipc/sem.c | 3 ++- ipc/util.h | 2 +- 3 files changed, 44 insertions(+), 41 deletions(-) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 9610afcfa2e5..c0d58f390c3b 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1420,6 +1420,47 @@ COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name, return do_mq_open(u_name, oflag, mode, p); } +COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, + const struct compat_sigevent __user *, u_notification) +{ + struct sigevent n, *p = NULL; + if (u_notification) { + if (get_compat_sigevent(&n, u_notification)) + return -EFAULT; + if (n.sigev_notify == SIGEV_THREAD) + n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int); + p = &n; + } + return do_mq_notify(mqdes, p); +} + +COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, + const struct compat_mq_attr __user *, u_mqstat, + struct compat_mq_attr __user *, u_omqstat) +{ + int ret; + struct mq_attr mqstat, omqstat; + struct mq_attr *new = NULL, *old = NULL; + + if (u_mqstat) { + new = &mqstat; + if (get_compat_mq_attr(new, u_mqstat)) + return -EFAULT; + } + if (u_omqstat) + old = &omqstat; + + ret = do_mq_getsetattr(mqdes, new, old); + if (ret || !old) + return ret; + + if (put_compat_mq_attr(old, u_omqstat)) + return -EFAULT; + return 0; +} +#endif + +#ifdef CONFIG_COMPAT_32BIT_TIME static int compat_prepare_timeout(const struct compat_timespec __user *p, struct timespec64 *ts) { @@ -1459,45 +1500,6 @@ COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, } return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p); } - -COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, - const struct compat_sigevent __user *, u_notification) -{ - struct sigevent n, *p = NULL; - if (u_notification) { - if (get_compat_sigevent(&n, u_notification)) - return -EFAULT; - if (n.sigev_notify == SIGEV_THREAD) - n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int); - p = &n; - } - return do_mq_notify(mqdes, p); -} - -COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, - const struct compat_mq_attr __user *, u_mqstat, - struct compat_mq_attr __user *, u_omqstat) -{ - int ret; - struct mq_attr mqstat, omqstat; - struct mq_attr *new = NULL, *old = NULL; - - if (u_mqstat) { - new = &mqstat; - if (get_compat_mq_attr(new, u_mqstat)) - return -EFAULT; - } - if (u_omqstat) - old = &omqstat; - - ret = do_mq_getsetattr(mqdes, new, old); - if (ret || !old) - return ret; - - if (put_compat_mq_attr(old, u_omqstat)) - return -EFAULT; - return 0; -} #endif static const struct inode_operations mqueue_dir_inode_operations = { diff --git a/ipc/sem.c b/ipc/sem.c index b951e25ba2db..cfd94d48a9aa 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -70,6 +70,7 @@ * The worst-case behavior is nevertheless O(N^2) for N wakeups. */ +#include #include #include #include @@ -2193,7 +2194,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, return ksys_semtimedop(semid, tsops, nsops, timeout); } -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT_32BIT_TIME long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, unsigned int nsops, const struct compat_timespec __user *timeout) diff --git a/ipc/util.h b/ipc/util.h index 975c6de2df9d..0aba3230d007 100644 --- a/ipc/util.h +++ b/ipc/util.h @@ -265,10 +265,10 @@ long ksys_shmdt(char __user *shmaddr); long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); /* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ -#ifdef CONFIG_COMPAT long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, unsigned int nsops, const struct compat_timespec __user *timeout); +#ifdef CONFIG_COMPAT long compat_ksys_semctl(int semid, int semnum, int cmd, int arg); long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr); long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz, -- 2.9.0