From patchwork Wed Apr 25 15:06:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134336 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp984497lji; Wed, 25 Apr 2018 08:08:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZotvkKD1a9uDrckzg+uY6V/fEhpoJByse3mBBfs6xri5C3taDWWu22togP2qwJQkZG35sYv X-Received: by 2002:a17:902:d882:: with SMTP id b2-v6mr5875755plz.381.1524668922611; Wed, 25 Apr 2018 08:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668922; cv=none; d=google.com; s=arc-20160816; b=L0Ivsrbzgmo3U4JMNCdBEWlIqhaIu97pTUXCfzvFLM3RQk2RAI+6HsdrTPEjeKtHcE SGVDP1ibjX5lEm9QBadmQUqWX06nxDLTWacp1mJgKR3ePoCtWVhOz9D0qo2hfvezVvjA wntDeNCIHZ69NdipsepcIxCo/TLHtC2SjXYVagH5X4/1D12u7puwjBGJ6v9AYiqZ/1KH z2ZIGDxxCk6a29M2RUN7nVCxfLpMCXj8YFwGDV5/8i5Llr4C5WBadHxfJaRzqM3EGr9+ MQh1PRsiNT7TPEhCZgdD7o5c2HP3mVUDEwfkFs8yUC/FCbFhZxWmSP5ZkbpllqFmXskT TKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=39/1bDfRnc2X5xw7srZoxuOsBDHzOzoOVHiQ+A0iwOk=; b=iw97cg1rBe3PhPGJ7EIGAZRDw4Wvr72LsAi9DDpy2JBJD8pyzChGcvKv+rW5Y/wcug FZo/6vrqHWp11Mgv/ML97rAktcdYxLhmP024Bnm2rITN9Ig0IUhVvi5zgrYWiZxRu5G+ MXOqWc03d/CsRF79qGN7S9xwPUPHvY7XNGWUKyma9PoQAEQmrcOkC57LXiYkirzbEIzV 9ocipeFRjzz5myRaib8BpvbAvIttiMWw8bSz85ovekmwVONo/59zxRsMAQjrO9KynQmw kzhw1SI3NHvqiwv5Go+KFadoYHzqWmX5QkYqOBW+QffZ4abBhDbARhv3rAdRaIw2eAtp jTOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CHolfk8m; spf=pass (google.com: domain of libc-alpha-return-91830-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91830-patch=linaro.org@sourceware.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g67si5015927pfe.4.2018.04.25.08.08.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:08:42 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91830-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CHolfk8m; spf=pass (google.com: domain of libc-alpha-return-91830-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91830-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=kg120zOJ+wgsbjK7HZxcNxVar7ccBwC AuCYhaV8EaJucz4Kdeiy0M0b0N65Ioxzai4r2TXZ2W6mv5QTP87ClvmJ/ekYFv5m LwjYsqMn7Hw91VoWKtyCagN4XOF1V/cYBFRgE6Cnl7DMrObZzrjtXg+XeSa25aqO /jG6fE54JaNQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=rMW8ob9KDX/zhNo9us3625nDdgc=; b=CHolf k8mN/z5qpq9A5XKEkbeKAsuq5ez5ddDClfbojDEFjNckybGB95kxBGZK5fyqsNkf 2k1RzGQAE7sxVvg8ayLFivP5cL1xuF7ZyfrjlPWtENMt0AKC7c/Xd+lmUceDvhta a9sMFtkxHWdjBNxBOMoxif12G2qkArJ/m/U5YA= Received: (qmail 38086 invoked by alias); 25 Apr 2018 15:07:35 -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 37954 invoked by uid 89); 25 Apr 2018 15:07:34 -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: 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, zackw@panix.com, noloader@gmail.com, Arnd Bergmann Subject: [PATCH v4 16/16] y2038: ipc: Redirect ipc(SEMTIMEDOP, ...) to compat_ksys_semtimedop Date: Wed, 25 Apr 2018 17:06:06 +0200 Message-Id: <20180425150606.954771-16-arnd@arndb.de> In-Reply-To: <20180425132242.1500539-1-arnd@arndb.de> References: <20180425132242.1500539-1-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; V01:K0:SqN+npyaZdU=:2iB9BZauhQXqPesFdfkWfK vCbG8Vgy9eKVJKuVzfB9K58T37/tMsSYEdG8+iCyMd15rkm5zdQlv62xWWqATm1JnamavSIrR dOIBdlGpcbYB4xH9Mife2fCp7OBJUH3fVTNw2V7ifw/08z4c/Q0kJqO0g3f1lO0QZaGLYiNBP ylTKkLgcQSoOLgoDIi5sXktp/Jm3z99JasrSdmPovzve8flXC5KzbkHAR733KaU2ECqObcoHb meEIjmuEZdgLNXT80vCxhv7U+vkPOyxO7bVv2yvkkFYKxFUZCqELNcKwQSrbjJ+7ihgT3FlRf YcR6DDqEuDIA/2lfvZSyPPc9fS0BhmVvIdNNZhTo8xgwxByxHSStmnsV8I4lu7boEPgxLJFCH BhhoAwnIYKFA7VJSoD/4At0rDW2ZqHODq0bKsw9DF9KJXXS5Uu/QyFiQayyFT0H09/lawzzhs InT5i4GoJlQ7sbmeSXkFJ88kG2DnxEiJrUDyiVrBe4TaBtn4RUGT4VTCseE1lYIYT7CwYriMX AGT9xePhRrwJvDom+Z4537rZjggZWKyX66M0PuTgsJnTJhwekmiFkBtjlI7QzjtBMNVa7OIR4 W4Jl92RwlQKgE0omplLfF7UPjdp4MFGW2JPNpMl5udI/k6mXxmq1YyXpYXE1eFwfFJBir05R9 stWRpssw1H+8rGSMKvynbFlVuAPL0Rfsppk30AIFUKlYX/4rXvMuReQesL/csKce2Ewll5K9z ENLb1unuxr5CX6vSUO1teYurJEtv+ALHyMGYCg== 32-bit architectures implementing 64BIT_TIME and COMPAT_32BIT_TIME need to have the traditional semtimedop() behavior with 32-bit timestamps for sys_ipc() by calling compat_ksys_semtimedop(), while those that are not yet converted need to keep using ksys_semtimedop() like 64-bit architectures do. Note that I chose to not implement a new SEMTIMEDOP64 function that corresponds to the new sys_semtimedop() with 64-bit timeouts. The reason here is that sys_ipc() should no longer be used for new system calls, and libc should just call the semtimedop syscall directly. One open question remain to whether we want to completely avoid the sys_ipc() system call for architectures that do not yet have all the individual calls as they get converted to 64-bit time_t. Doing that would require adding several extra system calls on m68k, mips, powerpc, s390, sh, sparc, and x86-32. Signed-off-by: Arnd Bergmann --- ipc/syscall.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/ipc/syscall.c b/ipc/syscall.c index 77a883ef2eca..65d405f1ba0c 100644 --- a/ipc/syscall.c +++ b/ipc/syscall.c @@ -30,9 +30,14 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, return ksys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL); case SEMTIMEDOP: - return ksys_semtimedop(first, (struct sembuf __user *)ptr, - second, - (const struct timespec __user *)fifth); + if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME)) + return ksys_semtimedop(first, ptr, second, + (const struct __kernel_timespec __user *)fifth); + else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) + return compat_ksys_semtimedop(first, ptr, second, + (const struct compat_timespec __user *)fifth); + else + return -ENOSYS; case SEMGET: return ksys_semget(first, second, third); @@ -130,6 +135,8 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, /* struct sembuf is the same on 32 and 64bit :)) */ return ksys_semtimedop(first, compat_ptr(ptr), second, NULL); case SEMTIMEDOP: + if (!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) + return -ENOSYS; return compat_ksys_semtimedop(first, compat_ptr(ptr), second, compat_ptr(fifth)); case SEMGET: