From patchwork Wed Apr 25 15:05:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134339 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp984941lji; Wed, 25 Apr 2018 08:09:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ooE2r4DHBHe/oyKi+rCfJc39aVnWYfsyNyByYn0JZUUImZUSjkvKvLjoapzJukH/WN+dC X-Received: by 2002:a17:902:9898:: with SMTP id s24-v6mr29599541plp.51.1524668943379; Wed, 25 Apr 2018 08:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668943; cv=none; d=google.com; s=arc-20160816; b=Uhk+QMlNYOtcNUaCs3SqHr2TqqC+Q2KkfSp8hQTFeMMOLwIqSVdrsJKMLdWzIaadQ9 Q4z4PmtxI8r9pOt32F1nra1wHTA/ChNOBuMd5sMODP+vjgfb6WsWgfFQAockdZTJpS8g iLje1/2lOkAD424RZFggzHHvzE/vnocuNb+v/O3oYii2fi08tjUtYyXMQJkRJWk2l16q wZWMxMw19n1GNHZLFDjU3YhiBDgRFdAyWEzHUlJlsrGx9yRwuH+dUgHbs3o3XVgb07KG liUgFAQDax035jtOaTj5kHjEeP3DxanNj7Hdm+uKOs/uS3aHjbxrLpTuRJOyJ+R3tuWf Dxmw== 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=+iX10soMDLxfroW19wxglJfwum37fFCl0JU7rorTpaE=; b=svzwSW+xH3XvI92zh4c0/llipH0k1V1tw8NmxT/2dAYNnv+wV5StHvet1yCGdwwq6K n4Foq+F0z6x+kas5QAdqfrrTrM16Qd0rulR6gg4qHxVWZeOsPKquk5Nz8TCzSsx1BOrB BzxExj51Bu8EQV8+f7PjbxXxk144cSgtRJoA7RseUo4D39M/k4wr3XEiEhKhcAzPuWc1 Eyi6Ef/CK+soGmEu2G+l+RL3S2i8Hu84BRCj205IOwo/f2K6tNp4/N3M0tJuZwGJjuDT f1lbvHw+wk89ghhmBBxDzp5xPjtW4Ly4DaIxYaFVQzRvHnjR8G74uWQ3Z/vygpmOEDW0 +LFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CGlscmFt; spf=pass (google.com: domain of libc-alpha-return-91831-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91831-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 r77si15571474pfa.359.2018.04.25.08.09.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91831-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=CGlscmFt; spf=pass (google.com: domain of libc-alpha-return-91831-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91831-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=Dv5ZZnWyXC+hDfCb6SVlxZ2Vmn4Q806 XH6U94JSIp9aiNSAv/HsgAPxq3fOUnOO4JTQ43rzyWGuRS1Rulw2UrdOW+Ec1qyc rY77UVcLQBjCyCmeXbuQX9hB+hsJVX4WVzELMT0yswikM+Rys3y3b1bH58hD0EPT /6Cyx0GKeXIg= 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=qB5AfgEByYTW6aQb8uG9o/kUJcM=; b=CGlsc mFtHDd/ucPsvqfL0M/+ObB0OFWqHOEpA4hA0Ul/bfT3V0Jz2629Q2OxP/BTe/Zx8 OswCDul9xOr0gjSueUXZu5mE7LzJe8mZzSSW2rB8nnQkMXx7EhqcLSzqsG6YrFvr WALjqIs41CeaRT2fRJCYOXSn2PSbfIBEKaRPbA= Received: (qmail 38424 invoked by alias); 25 Apr 2018 15:07:37 -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 38314 invoked by uid 89); 25 Apr 2018 15:07:36 -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 02/16] y2038: x86: Extend sysvipc data structures Date: Wed, 25 Apr 2018 17:05:52 +0200 Message-Id: <20180425150606.954771-2-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:0Td6jEn/6kk=:Io2npe3+BCzZPd1rBwwJz5 i4e0YrozGCqkH6NOck6RGlipii1e0qfkFvTINUqi4LusfB9BRcXgGE4U6GNmIQO777JPUTUW1 eV9HN8hsQqHX7rytFkZtf6qs2FRu0jubK24HXT60/eZnQgZuQQoDbK5YbBhUjqADTAnpYj7Hy /ntWuezVNb832KbbSLyqVtBWPjMnqST28136Svr2OjgrM6t8GkV9n/XULuGOiMWoIcr9o7zup P22ZWSj6Nmh72zJHocLxjVMNYrPifBncvumAk6y0w7T7LQsBmBzzuyTdUxA2MHkhp5r9YDv+N kdLy0IiymTEcQnmVkEH71kiSvxecdy8FXNOTEMG38OzkQMdM0pQX8Mp2KWg+Mp+ch8lYF2jtH +euXRMGE66teCMuRFxE4uSmVCNXYw1ca/FxsDt17p4gCKpOcGJRgtKfYTw4PkRbr7LluF5O35 c2ST6xx1cEIPu0pwp0fc7aCrJ3ELyiWFEo5RA4pRqAuxnvaq3Gn4EWibmqs5rhs7eJygee5PA O5t9zqMEPW7C34j4plnS/ZHA1uQxwI4bDMV8YKeA/J9BXQvJRxEo3koBMu3oCAXgt4POgJSX6 c/btpd+Ip2uojMlqfDdBp4FMdXHWbJZ9hMDKqYQTXP1W0qpnXnYgVWaAtI+AsbsqeJPezYmFA IOOEqgiNYZmOu8BBynm6BxelZMTJHyn2MCPWDIED7emgwRdeznUEY90G9sVGxC6Gt4oe5BogN A9FIvXDyw7/t2LFgl3Wj+2/SRllgg02bKHRxZA== This extends the x86 copy of the sysvipc data structures to deal with 32-bit user space that has 64-bit time_t and wants to see timestamps beyond 2038. Fortunately, x86 has padding for this purpose in all the data structures, so we can just add extra fields. With msgid64_ds and shmid64_ds, the data structure is identical to the asm-generic version, which we have already extended. For some reason however, the 64-bit version of semid64_ds ended up with extra padding, so I'm implementing the same approach as the asm-generic version here, by using separate fields for the upper and lower halves of the two timestamps. Signed-off-by: Arnd Bergmann --- arch/x86/include/asm/compat.h | 32 ++++++++++++++++---------------- arch/x86/include/uapi/asm/sembuf.h | 11 ++++++++++- 2 files changed, 26 insertions(+), 17 deletions(-) -- 2.9.0 diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index 7cd314b71c51..fb97cf7c4137 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h @@ -134,10 +134,10 @@ struct compat_ipc64_perm { struct compat_semid64_ds { struct compat_ipc64_perm sem_perm; - compat_time_t sem_otime; - compat_ulong_t __unused1; - compat_time_t sem_ctime; - compat_ulong_t __unused2; + compat_ulong_t sem_otime; + compat_ulong_t sem_otime_high; + compat_ulong_t sem_ctime; + compat_ulong_t sem_ctime_high; compat_ulong_t sem_nsems; compat_ulong_t __unused3; compat_ulong_t __unused4; @@ -145,12 +145,12 @@ struct compat_semid64_ds { struct compat_msqid64_ds { struct compat_ipc64_perm msg_perm; - compat_time_t msg_stime; - compat_ulong_t __unused1; - compat_time_t msg_rtime; - compat_ulong_t __unused2; - compat_time_t msg_ctime; - compat_ulong_t __unused3; + compat_ulong_t msg_stime; + compat_ulong_t msg_stime_high; + compat_ulong_t msg_rtime; + compat_ulong_t msg_rtime_high; + compat_ulong_t msg_ctime; + compat_ulong_t msg_ctime_high; compat_ulong_t msg_cbytes; compat_ulong_t msg_qnum; compat_ulong_t msg_qbytes; @@ -163,12 +163,12 @@ struct compat_msqid64_ds { struct compat_shmid64_ds { struct compat_ipc64_perm shm_perm; compat_size_t shm_segsz; - compat_time_t shm_atime; - compat_ulong_t __unused1; - compat_time_t shm_dtime; - compat_ulong_t __unused2; - compat_time_t shm_ctime; - compat_ulong_t __unused3; + compat_ulong_t shm_atime; + compat_ulong_t shm_atime_high; + compat_ulong_t shm_dtime; + compat_ulong_t shm_dtime_high; + compat_ulong_t shm_ctime; + compat_ulong_t shm_ctime_high; compat_pid_t shm_cpid; compat_pid_t shm_lpid; compat_ulong_t shm_nattch; diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h index cabd7476bd6c..89de6cd9f0a7 100644 --- a/arch/x86/include/uapi/asm/sembuf.h +++ b/arch/x86/include/uapi/asm/sembuf.h @@ -8,15 +8,24 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values + * + * x86_64 and x32 incorrectly added padding here, so the structures + * are still incompatible with the padding on x86. */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifdef __i386__ + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#else __kernel_time_t sem_otime; /* last semop time */ __kernel_ulong_t __unused1; __kernel_time_t sem_ctime; /* last change time */ __kernel_ulong_t __unused2; +#endif __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ __kernel_ulong_t __unused3; __kernel_ulong_t __unused4; From patchwork Wed Apr 25 15:05:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134331 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp983460lji; Wed, 25 Apr 2018 08:07:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48cbZF/kaCcmq7Zmg3q/ucsF0QKvHpsL8UobJQ0wnn4O4BooBMxdKFVfkD0Ylouddcvqlr8 X-Received: by 10.98.19.151 with SMTP id 23mr18071671pft.222.1524668873026; Wed, 25 Apr 2018 08:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668873; cv=none; d=google.com; s=arc-20160816; b=LbV5OO2Ea7HXN1+IAzUb1W/kwhYDsmIVKEptSQOAT4WHec8pe4NiYCcXMZN69xs7i2 /UdwJXLVNXlGDJy9PgbZC2J1Y9dJYhB3qf3OVYrKz3ug7SR60VUr3j1ujm7s6IH0J/yR k4dPmgU+lh+cZogBuLJbgQtr8cjWEoGjoXRtm3A89m1BBQ4wNphpGonjgE4vZPsK44wE NC0VKqfciVTEblFE2iGYhKxE9q/Q5L2x4hjxf7d+H7Xf3El33xdhgWeQatslKNBQAjfL OGF3jdli8+LyXbyox/Xsp42UirJLQNSGxnExX00aSeN43vhoYpQPWVRoSWYu5bGobbMB iS0g== 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=Zyy+4cXFhgVVK8I1kRuewmcD1U57zCk+1InHA5hMdZ8=; b=oBjP5PE34llQ7TDvCBYxzWSKWZkD3s9WWobO/LSZcniW5aCqGIE/Tly7KTZhxBpx5E 75fWcmNOoCbMcBjrmAVQHCCk6gRDAavusFTkBRtNMFfPgDjPEEWwpyf+SgDC0iClNwUG 2oz9NOjRo515IZZYzaPpB8NaW40fYx7EVHEeXji8E/StTSufj7LB3yYWI+W2YyiFe0By saXOQwcZ6C2I+kU0u13UP510Ijx/skpRJ6Ikq1OLVr6nWw7WRGuiUSFhXgtB3IfS6/K+ YuuO1lkujJOxg1VBpwuwycxv7/cD0Wdzc4nXGfEB2waGanAb0zpKl2i5RNliKsFqfOja GBBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wI4O+DFC; spf=pass (google.com: domain of libc-alpha-return-91824-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91824-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 r5-v6si16713345plo.414.2018.04.25.08.07.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:07:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91824-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=wI4O+DFC; spf=pass (google.com: domain of libc-alpha-return-91824-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91824-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=f7zsBDqjAxwchsa5Zvs0WQlzQ1xNDiu 071zgX9Qyrs9knHUMv57VFnOYk0Tkh0j7b3NYBb9FGAKFeT1ES740uZn2UVQ36ui LasZqmGm0wjn4UwJzmrq0ODz2BQrKPyR+rXxf9GOpXcj1mYUuRzrH/sOhK2sCj+7 9wxuiyeD51U0= 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=FzkR6oWMFDCY967NqihUPxrPaCY=; b=wI4O+ DFCTsLOLVj/VYI/qbpr6WvrLbomCQ5t0lLod31QzqOdycWDPqed6SQsTwugMDUdw zFKAOpsU2RW6ijs67wlAeoRhx1nUixWfwaaX5pWvracpm5fMUWXVyaTB3UWkoHwO DfmnKWidv78j23I+vhMbC70uS/3muPd6xGUkeg= Received: (qmail 36945 invoked by alias); 25 Apr 2018 15:07:28 -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 36787 invoked by uid 89); 25 Apr 2018 15:07:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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 08/16] y2038: parisc: Extend sysvipc data structures Date: Wed, 25 Apr 2018 17:05:58 +0200 Message-Id: <20180425150606.954771-8-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:WXETWLqf7PE=:nQX1ie/0vIpYQcwoz1oR/v QFZ+kxGZHlnJnlHGzNlJNfAuPMD6ge7LL1AWEntrGNNhpiARQPBuLoVi9wDIkEUrddodDFvCr rjnsOkkm5b2n5p4uYgYtNahCdcvt11VXK1fw4dqPnE3HjObvGNpuBpem7bXSvgC1CqvJbBfb2 yc2tSIbSBVbb4HmjSjz89rnCVctveD/A98orc2CdyfI7lR1NXAqpilkZ3KOBI95NmML8gz76o Ix9TqRzipZ+ZOh4LWaIGlffm/c0asXsJ5BX9/tgARHznccPCo6mmFVt1MIlGTUqFi8EAJHuOc RjVZR1YIKbRDP0fnYaMzaZSASj3R7+iMMJixfYJwbT3Lng7ApEZj3xHOHh8EAQ0X8ZLwhAqJy 1ms4bkebar/X2EuBlfbx+7kDTugGDu6zItWG5wlFZFhd6OmglHtLm17xvHyBlKDnuqr21nM82 4bde562OGGbG6IESfLWKKM0I28v4VGWzMWU1VsFrgt7DzH4IeZrll+EVFJAuPNVV8r2LD7jh6 LMHR9jng6CBi1a3iH7BhRp56J9pYpeOx04D79x2Ujdq5SpXzwVmBXYuCNVV/1ePc3dClasbtu ZCd2MZimyULYMPwwlIlQGEnn1zO4SOpiE8lCUuGGYUqSr3t0qsQeDMC3vFYeCA8ZKLVdKuDZi 5UjEl6YNPTL2HkEpkzYBld5mhko+rMdhPIMTpYmKrIuEBYV6yN3UvlEnV0l4dpPovDjQmEjjb Nm6d958elN4IEz3PIxTcW+m59S4eR9+7QTfpBw== parisc, uses a nonstandard variation of the generic sysvipc data structures, intended to have the padding moved around so it can deal with big-endian 32-bit user space that has 64-bit time_t. Unlike most architectures, parisc actually succeeded in defining this right for big-endian CPUs, but as everyone else got it wrong, we just use the same hack everywhere. This takes just take the same approach here that we have for the asm-generic headers and adds separate 32-bit fields for the upper halves of the timestamps, to let libc deal with the mess in user space. Signed-off-by: Arnd Bergmann --- arch/parisc/include/asm/compat.h | 32 ++++++++++++++++---------------- arch/parisc/include/uapi/asm/msgbuf.h | 33 ++++++++++++++++----------------- arch/parisc/include/uapi/asm/sembuf.h | 16 ++++++++-------- arch/parisc/include/uapi/asm/shmbuf.h | 19 ++++++++----------- 4 files changed, 48 insertions(+), 52 deletions(-) -- 2.9.0 diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 0cdfec8857bd..ab8a54771507 100644 --- a/arch/parisc/include/asm/compat.h +++ b/arch/parisc/include/asm/compat.h @@ -138,10 +138,10 @@ struct compat_ipc64_perm { struct compat_semid64_ds { struct compat_ipc64_perm sem_perm; - unsigned int __unused1; - compat_time_t sem_otime; - unsigned int __unused2; - compat_time_t sem_ctime; + unsigned int sem_otime_high; + unsigned int sem_otime; + unsigned int sem_ctime_high; + unsigned int sem_ctime; compat_ulong_t sem_nsems; compat_ulong_t __unused3; compat_ulong_t __unused4; @@ -149,12 +149,12 @@ struct compat_semid64_ds { struct compat_msqid64_ds { struct compat_ipc64_perm msg_perm; - unsigned int __unused1; - compat_time_t msg_stime; - unsigned int __unused2; - compat_time_t msg_rtime; - unsigned int __unused3; - compat_time_t msg_ctime; + unsigned int msg_stime_high; + unsigned int msg_stime; + unsigned int msg_rtime_high; + unsigned int msg_rtime; + unsigned int msg_ctime_high; + unsigned int msg_ctime; compat_ulong_t msg_cbytes; compat_ulong_t msg_qnum; compat_ulong_t msg_qbytes; @@ -166,12 +166,12 @@ struct compat_msqid64_ds { struct compat_shmid64_ds { struct compat_ipc64_perm shm_perm; - unsigned int __unused1; - compat_time_t shm_atime; - unsigned int __unused2; - compat_time_t shm_dtime; - unsigned int __unused3; - compat_time_t shm_ctime; + unsigned int shm_atime_high; + unsigned int shm_atime; + unsigned int shm_dtime_high; + unsigned int shm_dtime; + unsigned int shm_ctime_high; + unsigned int shm_ctime; unsigned int __unused4; compat_size_t shm_segsz; compat_pid_t shm_cpid; diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h index b48b810e626b..6a2e9ab2ef8d 100644 --- a/arch/parisc/include/uapi/asm/msgbuf.h +++ b/arch/parisc/include/uapi/asm/msgbuf.h @@ -10,31 +10,30 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ struct msqid64_ds { struct ipc64_perm msg_perm; -#if __BITS_PER_LONG != 64 - unsigned int __pad1; -#endif +#if __BITS_PER_LONG == 64 __kernel_time_t msg_stime; /* last msgsnd time */ -#if __BITS_PER_LONG != 64 - unsigned int __pad2; -#endif __kernel_time_t msg_rtime; /* last msgrcv time */ -#if __BITS_PER_LONG != 64 - unsigned int __pad3; -#endif __kernel_time_t msg_ctime; /* last change time */ - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused1; - unsigned long __unused2; +#else + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused1; + unsigned long __unused2; }; #endif /* _PARISC_MSGBUF_H */ diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h index 746c5d86a9b1..3c31163b1241 100644 --- a/arch/parisc/include/uapi/asm/sembuf.h +++ b/arch/parisc/include/uapi/asm/sembuf.h @@ -10,21 +10,21 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#if __BITS_PER_LONG != 64 - unsigned int __pad1; -#endif +#if __BITS_PER_LONG == 64 __kernel_time_t sem_otime; /* last semop time */ -#if __BITS_PER_LONG != 64 - unsigned int __pad2; -#endif __kernel_time_t sem_ctime; /* last change time */ - unsigned long sem_nsems; /* no. of semaphores in array */ +#else + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused1; unsigned long __unused2; }; diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h index cd4dbce55d0b..c89b3dd8db21 100644 --- a/arch/parisc/include/uapi/asm/shmbuf.h +++ b/arch/parisc/include/uapi/asm/shmbuf.h @@ -10,25 +10,22 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ -#if __BITS_PER_LONG != 64 - unsigned int __pad1; -#endif +#if __BITS_PER_LONG == 64 __kernel_time_t shm_atime; /* last attach time */ -#if __BITS_PER_LONG != 64 - unsigned int __pad2; -#endif __kernel_time_t shm_dtime; /* last detach time */ -#if __BITS_PER_LONG != 64 - unsigned int __pad3; -#endif __kernel_time_t shm_ctime; /* last change time */ -#if __BITS_PER_LONG != 64 +#else + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ unsigned int __pad4; #endif __kernel_size_t shm_segsz; /* size of segment (bytes) */ From patchwork Wed Apr 25 15:05:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134332 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp983668lji; Wed, 25 Apr 2018 08:08:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/gudqTpdM8YshTwx8Qq+QdXnNNb/dQaoUShf3QRonZ0b6bmFOCjU3zs/ax3QHjEB0bOblE X-Received: by 10.98.13.151 with SMTP id 23mr28539483pfn.231.1524668882826; Wed, 25 Apr 2018 08:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668882; cv=none; d=google.com; s=arc-20160816; b=Ze+7pObyMlIWU/3SF4LPIXABjYGiwpnjFKpqtX7D29kMdcKr5KrE5I/1dtgohchfWy +uTpSSA5hxONnbQtOJeU+HB7hKvKzyEU55V37AUdKKq7rszBuxTAYm3jBccW/YK9PLXk MT0nsvwIpHY+MMjlQFEVP02pa3ZYWj7qdmdhc/2e1DQOJ/gVTQpDrIy/D4phU+dyHxzI PS/qS2i1mawBTnlc+PKWEhsB5+2XOJq9vi9p3LGYcHv0pJR8mSML/TvufOGxjFElCjsu Iu+Sm+27m6xWI4wVIkhkKTcsaybhm/xdC9N//anu3YRmBlFaVtHjyowEZHYJkkHBM323 PsZA== 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=l6l8hBD1LwMEc8rPECkl+yH6jwVWAzXXcGJGNxvajns=; b=TkRu4zloapiHLucDKpRdbCjN3m6LNvfG4gsagzZsPDld6znHOFmxXvOigG6XoGAruc UwvJkJql+GCUPx0iGLCnBVV19fQyFCahj3KBeUXwdE8MD4xr/XGG8KITQsD7yoU1QAnR LrXyuZu/OW9iv8K3tqEaWbJtj2SceCiptqhWMu6FD31xuxtZmqcivkEVYFKhGYA4inSK p+0fzlZWKakJv4pNokFM+rU7i1b8UrwVY1PkSTlhuXuz5xlB9S1dLaaNat6HeWghCY6X GF+Qu8r4FAlFKo1pI0LmpVPSPB8597IAnOU25hhAByWpOUf2vte9W37vXC6KNZcUv4T5 RJig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Jf1SznNg; spf=pass (google.com: domain of libc-alpha-return-91825-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91825-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 d65si8322192pfd.182.2018.04.25.08.08.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91825-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=Jf1SznNg; spf=pass (google.com: domain of libc-alpha-return-91825-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91825-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=thf33PLpOqVzM5TL1SsLPf/GSe2AnBe SiqulLFfbjxcjMKdsJg3koGgDsOfq6e6WajCuGdkJtv6Q+LKIsxWdd3ufrtIZvmF s1RpRX48u2vPRLviP68skG6DD5QKYAK+snPROb+bW8Z9SSs3hqccq2A+wuI7dcdR hoQaXpxA27vg= 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=WzFCdhXG/KupnfNewxAJL5y1h5A=; b=Jf1Sz nNg1GNUIL/0zSwLm1vnyCMCqrcLmMOQtvN9vNThDuxrQzJG/9DyGzLylt53gxt77 Jo/FfZyyO9Db57nQglVJiSiPrrt04k9p/1J+2/YdaVOB+SluigQ+FB4wGUS2Fjpa IyW9ODSS3rRkaxtWvBoCtAEVurndwH49a8iE/A= Received: (qmail 37003 invoked by alias); 25 Apr 2018 15:07:28 -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 36860 invoked by uid 89); 25 Apr 2018 15:07:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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 09/16] y2038: sparc: Extend sysvipc data structures Date: Wed, 25 Apr 2018 17:05:59 +0200 Message-Id: <20180425150606.954771-9-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:PzUKc9u1xWE=:XSzvdo2ti9w1jTjjG84qD8 bgcxcjXkHeYnWMkiVkviKTVKqnEooE2t5/dtXsk9b3Gp+T9iwDA8/ZZaWKWwj20DFyDAXSPpl Rs2T4F7pbInrLiO7/lhJ267ijTKYt32D6OWJtu+fYu7j0tAdN4rLPntey1EIzvhBP01M1oTHU wzr+tRnQFMyj02t7ZDpmKvtw28IbXhZAwQPMEk1EwNWiuCT9Xka07B7FP1FvYF/nJc0oZtLNr Q9c1JFrbon/lQntY6JpzRLeRO1FIDZN+00236diQ2JeKmjMf6bZw/AfscQCF+0UMDl6tDuE9I AhzPKHojPGBBvzhr0RvJHLPeZ2R/tciXru29074ksukjNBuFr5T2XgrD/0qWdY6h2Ji9hsaAz ytskhtHM07AdJOdFnupXQ+gNeovUA/ROBZE4jp9Ijh2d/fv74O3pLh22J/7YLq9T2KrNoNNv5 DETxa1Y3d2LAkqtWKVdHvgjV8BMnOZgcFru6oOuR9rMDbhJQkve4BvZ34276UYVR9A4UIPLTN +VCNLalDLgYhpyl8f0m2wq2NpWUUogjvIJ6ljBqS9q3m03EAldcjmolb9jkXG8ks0/KmbG8vd uy3Ed2FxUadDu5J/76Ifv8evBZkS2pNtgWDqyREOTKL5QoJiLy+w2ACXkOctimtNZm3sXvW+x ImNJj34NfFLB/3t3Z8HraD43bPBvi8nyR4sfnxv6FgRSKakPoCXwB3jXMxX5YEO9iCx4whmH6 5xdHo46wYuFxkn6qj7uAhPjkY05n2hk+7FFTSw== sparc, uses a nonstandard variation of the generic sysvipc data structures, intended to have the padding moved around so it can deal with big-endian 32-bit user space that has 64-bit time_t. Unlike most architectures, sparc actually succeeded in defining this right for big-endian CPUs, but as everyone else got it wrong, we just use the same hack everywhere. This takes just take the same approach here that we have for the asm-generic headers and adds separate 32-bit fields for the upper halves of the timestamps, to let libc deal with the mess in user space. Signed-off-by: Arnd Bergmann --- arch/sparc/include/asm/compat.h | 32 ++++++++++++++++---------------- arch/sparc/include/uapi/asm/msgbuf.h | 22 +++++++++------------- arch/sparc/include/uapi/asm/sembuf.h | 16 +++++++--------- arch/sparc/include/uapi/asm/shmbuf.h | 21 +++++++++------------ 4 files changed, 41 insertions(+), 50 deletions(-) -- 2.9.0 diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 1910c44521e3..4eb51d2dae98 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h @@ -192,10 +192,10 @@ struct compat_ipc64_perm { struct compat_semid64_ds { struct compat_ipc64_perm sem_perm; - unsigned int __pad1; - compat_time_t sem_otime; - unsigned int __pad2; - compat_time_t sem_ctime; + unsigned int sem_otime_high; + unsigned int sem_otime; + unsigned int sem_ctime_high; + unsigned int sem_ctime; u32 sem_nsems; u32 __unused1; u32 __unused2; @@ -203,12 +203,12 @@ struct compat_semid64_ds { struct compat_msqid64_ds { struct compat_ipc64_perm msg_perm; - unsigned int __pad1; - compat_time_t msg_stime; - unsigned int __pad2; - compat_time_t msg_rtime; - unsigned int __pad3; - compat_time_t msg_ctime; + unsigned int msg_stime_high; + unsigned int msg_stime; + unsigned int msg_rtime_high; + unsigned int msg_rtime; + unsigned int msg_ctime_high; + unsigned int msg_ctime; unsigned int msg_cbytes; unsigned int msg_qnum; unsigned int msg_qbytes; @@ -220,12 +220,12 @@ struct compat_msqid64_ds { struct compat_shmid64_ds { struct compat_ipc64_perm shm_perm; - unsigned int __pad1; - compat_time_t shm_atime; - unsigned int __pad2; - compat_time_t shm_dtime; - unsigned int __pad3; - compat_time_t shm_ctime; + unsigned int shm_atime_high; + unsigned int shm_atime; + unsigned int shm_dtime_high; + unsigned int shm_dtime; + unsigned int shm_ctime_high; + unsigned int shm_ctime; compat_size_t shm_segsz; compat_pid_t shm_cpid; compat_pid_t shm_lpid; diff --git a/arch/sparc/include/uapi/asm/msgbuf.h b/arch/sparc/include/uapi/asm/msgbuf.h index b601c4f4d956..ffc46c211d6d 100644 --- a/arch/sparc/include/uapi/asm/msgbuf.h +++ b/arch/sparc/include/uapi/asm/msgbuf.h @@ -8,25 +8,22 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ - -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif - - struct msqid64_ds { struct ipc64_perm msg_perm; - PADDING(__pad1) +#if defined(__sparc__) && defined(__arch64__) __kernel_time_t msg_stime; /* last msgsnd time */ - PADDING(__pad2) __kernel_time_t msg_rtime; /* last msgrcv time */ - PADDING(__pad3) __kernel_time_t msg_ctime; /* last change time */ +#else + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ unsigned long msg_qbytes; /* max number of bytes on queue */ @@ -35,5 +32,4 @@ struct msqid64_ds { unsigned long __unused1; unsigned long __unused2; }; -#undef PADDING #endif /* _SPARC_MSGBUF_H */ diff --git a/arch/sparc/include/uapi/asm/sembuf.h b/arch/sparc/include/uapi/asm/sembuf.h index f49b0ffa0ab8..f3d309c2e1cd 100644 --- a/arch/sparc/include/uapi/asm/sembuf.h +++ b/arch/sparc/include/uapi/asm/sembuf.h @@ -8,25 +8,23 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - PADDING(__pad1) +#if defined(__sparc__) && defined(__arch64__) __kernel_time_t sem_otime; /* last semop time */ - PADDING(__pad2) __kernel_time_t sem_ctime; /* last change time */ +#else + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused1; unsigned long __unused2; }; -#undef PADDING #endif /* _SPARC64_SEMBUF_H */ diff --git a/arch/sparc/include/uapi/asm/shmbuf.h b/arch/sparc/include/uapi/asm/shmbuf.h index 286631db705c..06618b84822d 100644 --- a/arch/sparc/include/uapi/asm/shmbuf.h +++ b/arch/sparc/include/uapi/asm/shmbuf.h @@ -8,24 +8,23 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ -#if defined(__sparc__) && defined(__arch64__) -# define PADDING(x) -#else -# define PADDING(x) unsigned int x; -#endif - struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ - PADDING(__pad1) +#if defined(__sparc__) && defined(__arch64__) __kernel_time_t shm_atime; /* last attach time */ - PADDING(__pad2) __kernel_time_t shm_dtime; /* last detach time */ - PADDING(__pad3) __kernel_time_t shm_ctime; /* last change time */ +#else + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ +#endif size_t shm_segsz; /* size of segment (bytes) */ __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ @@ -46,6 +45,4 @@ struct shminfo64 { unsigned long __unused4; }; -#undef PADDING - #endif /* _SPARC_SHMBUF_H */ From patchwork Wed Apr 25 15:06:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134333 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp983873lji; Wed, 25 Apr 2018 08:08:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+vav9sKhhsSgLTq4zbmDi3KhRX2YW0/tDvlr1enAsFncV2EGyFOItZO70W2nwdHQrKYUN X-Received: by 2002:a17:902:8481:: with SMTP id c1-v6mr29195302plo.310.1524668892081; Wed, 25 Apr 2018 08:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668892; cv=none; d=google.com; s=arc-20160816; b=p2C7dwom3V5d+POOIz3AP5RoiPzfBtorKeontzM9nIsKawoFlPEd5tmT66Z/uwPgkC FlVlDQgxGeU9yoItpadRFqyiu8H77gpyXiJlVNcxNddVRJBd4j4/Eh+PhCATllCHGt2V IGrTOphyF2nI2SsHA+3nzQ6vn6iQSzPu0Bcs28jYhSnhjtRMd3bsQtJhttf+wXZ8umoB ZuFWBmFwUstCy8xNX7XxSum/V9skgqeHl7FsJhhg9V09AQWNe1oKe9iSxMWwV4iUeLrs pPxFmkkIHyKW5/ucDQoBIWHiofbC2lm77KZ+HWffke/Oay46LOSUta4bgFevGAEXs25T HC4g== 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=Wg9nx2Y4STPDXVNbfVvjsEPGIiZUgNxg/aEdD3j8C7w=; b=lFroHSnrOMYSfnOa+cOKKCpQW1Smch1aLAz0HHd8AxlOU/JDrBj61gFmMbwVZ1Nslx fq8tSHwJeyxaeyVSIGHsG1scLS3NpJc27B+dac2QCjTnS7M+Av7fyOvD8/SnMNuam9+N tVovVDAUK3OcIS/qPmkgDHL580JmDp6V7UVwF0KUoIg91oGPMN+VKUALgUp70pb8eVt/ fjp6pzX+3x3t+Wj1reLcdyuVJcyfbfoWR0Z4oaWH/zGmH+CSe1/lNZ8sEPs7Tz8Uh2jN NjAkxlMC0rvWPgv2Zb8dq6LbiyocTPljUSI4n58UAeAG5xcDt0I2M0TWeAlsMk/ESbSZ PxIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Jpm67sC8; spf=pass (google.com: domain of libc-alpha-return-91826-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91826-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 o7si4051691pga.92.2018.04.25.08.08.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91826-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=Jpm67sC8; spf=pass (google.com: domain of libc-alpha-return-91826-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91826-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=NggdYQcYN2z+KTUFhYpa9EOzD2oJI9T SGFRRh8SVlnjsCHGxWC+fb1NtbPNB2+zuewYNrhdhX6Ftw8V6co+i9cJwri87zZx Cw5/wQBmDoGkTGZp2k7K9HWtR7TgMPnK4EUdwW2wag9iClKlJ2GZwxosbbDm93J4 bKNpcGg1kibo= 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=Ev2nKhmlzAgzFe9geVFtI1ddv+c=; b=Jpm67 sC8KeNbQzE6aGft0yLmfg/CV9c6hqu+BUbApmODoTGmv6RACLm6gj4LlaTOOMgjD 5PBsvrI31CHc+z3z+yECPI/aNU6XYTK3BwWMR7GRoi9RlfGqpO/XGpbMpVZ6bMHc mWmo79HJCRLFokETwNyy2TRz3SqNzT+z3xZZ+c= Received: (qmail 37293 invoked by alias); 25 Apr 2018 15:07:30 -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 37189 invoked by uid 89); 25 Apr 2018 15:07:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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 10/16] y2038: powerpc: Extend sysvipc data structures Date: Wed, 25 Apr 2018 17:06:00 +0200 Message-Id: <20180425150606.954771-10-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:SmonRXXo8Ic=:apgSAv9A4yY7Lucdjcl/es qXlEtAygRHBR+0td32zGr1ZY1WD3e4pPUWQsZXmgOF6NXUHz9N98WkSktEOUFCXh2QtDxS/Pd pr2QASNIqQT2s8g7yLU2iXFyDNm6xGccSom33N9AMTPSpCEYYHqcyR9XSBvTQ9ner9TmHvCPc zAhkHjQ7RXnX5qFrvQxpq8QRJ/Z4wFjQxrdV3aWy/Vl7GPz/LjorzJ/1WtIVyGfhb/OjlADSQ yUaSRdK/mn7HgbGT+1Sj/m4Ogm/yPhlc23+dQDpVlZwu1b11A4eahwi0B+EQr8hdYtGopWQa7 5i6KwSL0YqpTMCQkaPEyF5KJm3ZwsFsleiplyIeEjiIqlpvnULfcNfAkkJYnfvn8nzlsdUbuM hRRAk2RuoO7tXjqfVkC6Hm+94tVkgaV6ztyzytdFBhnMH1aDCEgkB6n0g7goZBubQCwSLi3tO tcCBQMjre4VB2xetZnHpJ7A5rupBoDZY98T8jW155KfpUKlipIG2qeONELG3cN8PnKEvebUbR Vz5234JkaGt2h3opNutvUUaxB5Y7h4pVAuOzrybHFGMw8ng/pig6IDz4ozsJbVOjuIzslg5rU lAKjO52Ogppsk7D/VOgiOz1neLcjzYwHsgXa0jKPYzWCZd32BMB/Xna0bYwIFqwVPloW8HsBM MngPg9ZbtgJgGBZrjzYxmf1SgIXsGY9ZjKaKIV1EPFkno0Big5kKjwSmXkGMgXv/ZRVC4TOpy L5r/bECriMwSbFDokJafYEsQrPHtI55fx7QUGg== powerpc, uses a nonstandard variation of the generic sysvipc data structures, intended to have the padding moved around so it can deal with big-endian 32-bit user space that has 64-bit time_t. powerpc has the same definition as parisc and sparc, but now also supports little-endian mode, which is now wrong because the padding is made for big-endian user space. This takes just take the same approach here that we have for the asm-generic headers and adds separate 32-bit fields for the upper halves of the timestamps, to let libc deal with the mess in user space. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/asm/compat.h | 32 ++++++++++++++++---------------- arch/powerpc/include/uapi/asm/msgbuf.h | 18 +++++++++--------- arch/powerpc/include/uapi/asm/sembuf.h | 14 +++++++------- arch/powerpc/include/uapi/asm/shmbuf.h | 19 ++++++++----------- 4 files changed, 40 insertions(+), 43 deletions(-) -- 2.9.0 diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index b4773c81f7d5..85c8af2bb272 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h @@ -162,10 +162,10 @@ struct compat_ipc64_perm { struct compat_semid64_ds { struct compat_ipc64_perm sem_perm; - unsigned int __unused1; - compat_time_t sem_otime; - unsigned int __unused2; - compat_time_t sem_ctime; + unsigned int sem_otime_high; + unsigned int sem_otime; + unsigned int sem_ctime_high; + unsigned int sem_ctime; compat_ulong_t sem_nsems; compat_ulong_t __unused3; compat_ulong_t __unused4; @@ -173,12 +173,12 @@ struct compat_semid64_ds { struct compat_msqid64_ds { struct compat_ipc64_perm msg_perm; - unsigned int __unused1; - compat_time_t msg_stime; - unsigned int __unused2; - compat_time_t msg_rtime; - unsigned int __unused3; - compat_time_t msg_ctime; + unsigned int msg_stime_high; + unsigned int msg_stime; + unsigned int msg_rtime_high; + unsigned int msg_rtime; + unsigned int msg_ctime_high; + unsigned int msg_ctime; compat_ulong_t msg_cbytes; compat_ulong_t msg_qnum; compat_ulong_t msg_qbytes; @@ -190,12 +190,12 @@ struct compat_msqid64_ds { struct compat_shmid64_ds { struct compat_ipc64_perm shm_perm; - unsigned int __unused1; - compat_time_t shm_atime; - unsigned int __unused2; - compat_time_t shm_dtime; - unsigned int __unused3; - compat_time_t shm_ctime; + unsigned int shm_atime_high; + unsigned int shm_atime; + unsigned int shm_dtime_high; + unsigned int shm_dtime; + unsigned int shm_ctime_high; + unsigned int shm_ctime; unsigned int __unused4; compat_size_t shm_segsz; compat_pid_t shm_cpid; diff --git a/arch/powerpc/include/uapi/asm/msgbuf.h b/arch/powerpc/include/uapi/asm/msgbuf.h index 65beb0942500..2b1b37797a47 100644 --- a/arch/powerpc/include/uapi/asm/msgbuf.h +++ b/arch/powerpc/include/uapi/asm/msgbuf.h @@ -10,18 +10,18 @@ struct msqid64_ds { struct ipc64_perm msg_perm; -#ifndef __powerpc64__ - unsigned int __unused1; -#endif +#ifdef __powerpc64__ __kernel_time_t msg_stime; /* last msgsnd time */ -#ifndef __powerpc64__ - unsigned int __unused2; -#endif __kernel_time_t msg_rtime; /* last msgrcv time */ -#ifndef __powerpc64__ - unsigned int __unused3; -#endif __kernel_time_t msg_ctime; /* last change time */ +#else + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ unsigned long msg_qbytes; /* max number of bytes on queue */ diff --git a/arch/powerpc/include/uapi/asm/sembuf.h b/arch/powerpc/include/uapi/asm/sembuf.h index 8f393d60f02d..3f60946f77e3 100644 --- a/arch/powerpc/include/uapi/asm/sembuf.h +++ b/arch/powerpc/include/uapi/asm/sembuf.h @@ -15,20 +15,20 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values + * - 2 miscellaneous 32/64-bit values */ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #ifndef __powerpc64__ - unsigned long __unused1; -#endif + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#else __kernel_time_t sem_otime; /* last semop time */ -#ifndef __powerpc64__ - unsigned long __unused2; -#endif __kernel_time_t sem_ctime; /* last change time */ +#endif unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused3; unsigned long __unused4; diff --git a/arch/powerpc/include/uapi/asm/shmbuf.h b/arch/powerpc/include/uapi/asm/shmbuf.h index deb1c3e503d3..b591c4d7e4c5 100644 --- a/arch/powerpc/include/uapi/asm/shmbuf.h +++ b/arch/powerpc/include/uapi/asm/shmbuf.h @@ -16,25 +16,22 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values */ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ -#ifndef __powerpc64__ - unsigned long __unused1; -#endif +#ifdef __powerpc64__ __kernel_time_t shm_atime; /* last attach time */ -#ifndef __powerpc64__ - unsigned long __unused2; -#endif __kernel_time_t shm_dtime; /* last detach time */ -#ifndef __powerpc64__ - unsigned long __unused3; -#endif __kernel_time_t shm_ctime; /* last change time */ -#ifndef __powerpc64__ +#else + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ unsigned long __unused4; #endif size_t shm_segsz; /* size of segment (bytes) */ From patchwork Wed Apr 25 15:06: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: 134340 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp985119lji; Wed, 25 Apr 2018 08:09:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/8wuww1Kc4/W4VFsT/kwAyddza9viC0utH3vlYFRziN+qzPFcm+OfNSO1YJESuvmCB63wZ X-Received: by 2002:a17:902:5ac6:: with SMTP id g6-v6mr28466838plm.262.1524668953487; Wed, 25 Apr 2018 08:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668953; cv=none; d=google.com; s=arc-20160816; b=aKHy2B92u5DlhYqCVIb0h7P6Ybl+znqdU3njScHeN5xr/orWtkqZei3yoili0V96rk KFpI1pqMx9PDI+QBlNn6db+kouqRE376ilOzl5msfeveVAkqOImzxKn29OuNWd441Q13 5a3YT2D6qooRYYLa1Yxq6A+3S43p7qbG9MFLBZHyRjF6VhARRjZkuhF5m+qvokdLrHZs o95m+bhM3082DQNcXb2wXdf6xhFGVlqUSBQmAl/YaaOjBd8QooadLup/wHXzgZG+B4fs E36TxJwd3m7esydrRqQwT66QImqW4wrqOyi/fphvuse5XUdEC0+xIFSwCrLl5fVIytyI UdEg== 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=FNvNZqL1QVz9jPezmoJv0nLyoBHEtt5FGAOH7Fqlq3E=; b=n5tqN0tq8FCnb5BH6Rqqey1O1h5FmD/4tNt2Z4z5pRfgiSEfiyJbZapitd0FBBDq6Q hRYlwkET6mFJ2mtYSb5f+tSjmccDJYLbF+pveYlImOd1gRZa39X7tktzUdl4V+04Rny5 /IiMlTzqIztsyoafifnAQD8JyLmuElAuPlleTamIlNOhDwPbCR0zYQ6dUMYV95aeeZzU k3mrozcjBXfF3LbZ9L35GkiHNns7+oFAFFicjqkYKzBol6iMsbMfQgZ5UinpmurteFoA DMSUSJo7cLZTSMDsX7yheZuGPmM/DCIEKiAHNXcXpe2KIJr2R1vTQ41OqUTHP2NbbsUE 3ybA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=AitX7DX2; spf=pass (google.com: domain of libc-alpha-return-91832-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91832-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 v72si16114149pfa.59.2018.04.25.08.09.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91832-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=AitX7DX2; spf=pass (google.com: domain of libc-alpha-return-91832-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91832-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=MPV+HgVGwX5W5oZ/LrRONhHJpW4zWhy R2iM8xO6nXv8PknjaAB1ZYCkfhMK2KHQ/UgQD7y3ACqbxIxl4LWuHwdvyuvJtx3s bMlelAFNo5N/r5cAW9FN9IU0SgH1S1jNAMm7HoIhdNvwdaU3Pj+30FIs9mY6W/gz +OChQZCT9Bd4= 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=q9icjhybE9xwgfSYwzjHhuyay+Y=; b=AitX7 DX24YJgDs0BrUAUQD3/k7j3dCRoDEmPO9m7j3dnsUeKMuJMbGrc3dPDyzGLGyu5u RmqWi4h+dteMWTog0/S/P337wMyQLJr8AKTm0yMgJ+2gH4QBoY1XZFeh8VkbVGUD 7SPXdklTVn8Ueya5L9k2GLH+x3HSFgK06wo6bU= Received: (qmail 38642 invoked by alias); 25 Apr 2018 15:07:38 -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 38472 invoked by uid 89); 25 Apr 2018 15:07:37 -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=sem, alter 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 12/16] y2038: ipc: Use ktime_get_real_seconds consistently Date: Wed, 25 Apr 2018 17:06:02 +0200 Message-Id: <20180425150606.954771-12-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:0GSuoYBPUu8=:6g+iRgz4GwUCeThNrGE2z3 e5yCaRxYlrxkQzxmVsoSjSFE42YUQ8t0EWyPkirJ/KVZL311TBsZ1DV5hlPGAiqW1wn6AF2b/ 5pZhWVcEHnwZc3LoOAiv8jOVPGWKqn9vtzFDVh1MILW5P/aI+hgkkAkdUbb/gtZKRJl+T0Sdz IKKUt4m8K6iTVf2PNyuURPbRXpmEKKgDY+Xvg7nD/AInU1yWBl50P6ZHn27pFxabilKMAAMv1 CrTTanhr5fbqdHBWO5pYjuLKu1wImmriVlgOXGb3QeyblAoF1s/bRIkhtUbWcHasOwNYaTDro 74W9zY+f9AkA6NTFOVBoc8GMsQIZjRBcCohGQYZOQEAEMTkBFXXkBQGPD8kn2FVGW0iQP7Nl2 R4HufrR6SgAHOR5wKSqU0gV1Lm9Wn4liVRusifOP/44KOYpT9HnA7vXc/ZoCNZxP1zQUe0qr3 fMiOxINmEDPJpnJscmfHvyK5Nz1Vona6HvPjRCsssd3yFWv8fuymJ5YHrJOe4lGow+QnjrjTw C0jLvEA84OGpeigtHVObbvRvVWXXOrI6iBR2TUVjUMQIdouVlkMAvKW8oG+rkm9KQERRIpzPP hf9JfXuIOqzo6yHu+ism732mxmt3W/Pt/28DpyOLJn9nm2yjJURGqLl2kZSy8YmCl/jW5vtuG vyJj82jleHLbv1ZxYlyLpsgdQxwSHt9mo7QD+zI8Oe3Yu4b0Wl5xfRI6JIuSQma4mLSLKIfzR CRIiPvDtxAIfucxJSDnZi23h4PEwCn0Uz74Riw== In some places, we still used get_seconds() instead of ktime_get_real_seconds(), and I'm changing the remaining ones now to all use ktime_get_real_seconds() so we use the full available range for timestamps instead of overflowing the 'unsigned long' return value in year 2106 on 32-bit kernels. Signed-off-by: Arnd Bergmann --- ipc/msg.c | 6 +++--- ipc/sem.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/ipc/msg.c b/ipc/msg.c index 56fd1c73eedc..574f76c9a2ff 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -758,7 +758,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg, WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG)); } else { ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk)); - msq->q_rtime = get_seconds(); + msq->q_rtime = ktime_get_real_seconds(); wake_q_add(wake_q, msr->r_tsk); WRITE_ONCE(msr->r_msg, msg); @@ -859,7 +859,7 @@ static long do_msgsnd(int msqid, long mtype, void __user *mtext, } ipc_update_pid(&msq->q_lspid, task_tgid(current)); - msq->q_stime = get_seconds(); + msq->q_stime = ktime_get_real_seconds(); if (!pipelined_send(msq, msg, &wake_q)) { /* no one is waiting for this message, enqueue it */ @@ -1087,7 +1087,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in list_del(&msg->m_list); msq->q_qnum--; - msq->q_rtime = get_seconds(); + msq->q_rtime = ktime_get_real_seconds(); ipc_update_pid(&msq->q_lrpid, task_tgid(current)); msq->q_cbytes -= msg->m_ts; atomic_sub(msg->m_ts, &ns->msg_bytes); diff --git a/ipc/sem.c b/ipc/sem.c index 06be75d9217a..c6a8a971769d 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -104,7 +104,7 @@ struct sem { /* that alter the semaphore */ struct list_head pending_const; /* pending single-sop operations */ /* that do not alter the semaphore*/ - time_t sem_otime; /* candidate for sem_otime */ + time64_t sem_otime; /* candidate for sem_otime */ } ____cacheline_aligned_in_smp; /* One sem_array data structure for each set of semaphores in the system. */ @@ -984,10 +984,10 @@ static int update_queue(struct sem_array *sma, int semnum, struct wake_q_head *w static void set_semotime(struct sem_array *sma, struct sembuf *sops) { if (sops == NULL) { - sma->sems[0].sem_otime = get_seconds(); + sma->sems[0].sem_otime = ktime_get_real_seconds(); } else { sma->sems[sops[0].sem_num].sem_otime = - get_seconds(); + ktime_get_real_seconds(); } } From patchwork Wed Apr 25 15:06:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134338 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp984722lji; Wed, 25 Apr 2018 08:08:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/58jvEDl3Vh7HIC7E8Zv2cAwg9CDxhqir19en9Ems0dQlEpI0PVSrsV+xANa20VCEEeCmn X-Received: by 10.99.60.12 with SMTP id j12mr24779607pga.203.1524668933139; Wed, 25 Apr 2018 08:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668933; cv=none; d=google.com; s=arc-20160816; b=ucU/9MVsIUiZkXlRYfE8MFuVJkoA4lGSREgIyBHplxIDhvjKc6oa+JbYLBXWuifxYy hDJEpROt1nq5PYduM/n+kDoj4xRrSORxmD/33HgYeV5HB9NBsl69HWdKnLCUptY6trfy FgWtfZKDrop8ioKZGK/AJ0lFUTat59eZWAMWVBkV1xuBsRI6yShj0/2UTE6/kVp5aJNl Q2azs0JFAfI4ChL33kzWuEXxQcdwL0FjiIC++CvCaaXvVySpFKIG58wEuIPOlOfG3tVx OcLxJ2TF3aQl0Ly/djUcjJClvuByHmSWV94vaO9Q/EXYG0yl+ZSYzwEigDooxYW87sw9 tcyQ== 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=O5FDEUvv+T9xGV1OaSiciU6iSJkdzsowujXxm6xlkpI=; b=eosSkxhqyQHzUY3d1lcAqOr2GHF8BSVE4XfenYi7QevEfO6poxG4G8392GbBLJTx3i mD/qLnPknCpAPgSzzLhzzGptvE+7RYIe+/SbZcMfI1RHlZFSQdEIlJABhfAx2vCyVS9q 3ucjj9yqfa0c1EbE8X8dCCqeoXZfF1PmSUaXvm7aRTDfef6scEeFNqMf2rOF2a3iaXAX DkCpYIjCU750jQh951+CYL5sqYVRIdNfYN6YH2IkazYJgzlcIhiaAPITMQWS4pENxkLr h6yC0yopQntaTC4+0lBOTzaeowuaKNZtbZxjZQfwRx9SDwAfAOVUigDI3Gx2YtPwqYRJ Tpog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=HvFQ6/aQ; spf=pass (google.com: domain of libc-alpha-return-91829-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91829-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 t190si3906887pgb.623.2018.04.25.08.08.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91829-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=HvFQ6/aQ; spf=pass (google.com: domain of libc-alpha-return-91829-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91829-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=r0jGCr3Dfj3m9MsGKrZLjPPSEKW8LL/ mOuhzswOomjlnev+1E0Vf6auM5DO3KqF+OQOTC21LizmU/79wUEzRRI1eBLaTQYs 3aQdTG98Hjs82VjXzPsFzE2b52Wjvf28Jj8BexNGVSMG/mnqeuFrY1pWkfr3Dsac JSbwNNItkg08= 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=3sNX3cMGJYLMXj5xEAI9EeM2OMk=; b=HvFQ6 /aQRMxcG9Hj+pplAFdrNdwFLYgpKLeNvJEMLoy0/N16Ztt1KFt1EwKyif910SF61 ohNP6GwRv2tURugSftmh1PNafCoQyOVrqpC7iw1XR1f1ugB1ShEB25HXRoIGSnbf Q3nl7n9LYC90CEklfprj3WOysoGHgTcDhApozI= Received: (qmail 38007 invoked by alias); 25 Apr 2018 15:07:34 -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 37749 invoked by uid 89); 25 Apr 2018 15:07:33 -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 14/16] y2038: ipc: Use __kernel_timespec Date: Wed, 25 Apr 2018 17:06:04 +0200 Message-Id: <20180425150606.954771-14-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:BJXUDQ6Vvto=:iFZRn5T++Cyo0hzYvieKxi Ok5PngjIt0vhLUEbGiUjM/SlfiQ5tCzDqq375Cr2Rph9Zv9x0mr1syd10p7LKMtRWHWbGKwf6 Z4+7h7MCrn0+YL0b7oxUtgxxv54/8r0fjP5Hzz1zAFl4mrbgIrdiL/VZp5w2xDFY7c7ReWwsj /fRzQYXKkfRqlHYI3pUhDWW4AXEti+yFtXik5o28vdGYBwFrBQ+DLp6BaJZv8DovmZcYIPdcT rFjEOiY1bfWKgfI+JAHkyodQWDzRJShBR6cJRDEzv5U9Kb1JqQMocf/a/ORBCN0FpIDO6wBls zKwWGUazjo1e5JlASCCKCAaB6CfAiDICLHR3YFTfRHhdFAW+cPwCHuR/rXuQP5dxqf1sMHrzQ gH43ULgvkBOedwCl6Dl/NFLAuEJ6o3B3DnC3x25FlQks1H3a92c1Cuv0Y8TFU50u9GiQkTtRi Dznbz8ZwrcUyncvhH5yp+QBLEX5iRqda/coMPqXqKjNeQTkq8MUZkgzOP6YTo4SjP238pd9tF 1/e5QuKpH8SjunVfmQ82mYZZ83hBkabum39IAi3bmL3L+RtniK71/sVhDdZw8P24OzbVXmKBL PYKhk1N0qJUaXGbsSy3F2QuTY7fybJLnlXolQibwapDSpXLk2q4guJy67YYrw43FhcYMKq2Yd jld6R9gbggwVYyWntTBG6EB+kGuf64QdQAinoNjAhS5D9DlnDoDWxCmZDJ2juli2d6SlM5GDM zr0tmga1eO6+Zdmn0Vyv6ZlG8kh2VpTPSlv3uA== This is a preparatation for changing over __kernel_timespec to 64-bit times, which involves assigning new system call numbers for mq_timedsend(), mq_timedreceive() and semtimedop() for compatibility with future y2038 proof user space. The existing ABIs will remain available through compat code. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 6 +++--- ipc/mqueue.c | 6 +++--- ipc/sem.c | 4 ++-- ipc/util.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.9.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index c9a2a2601852..b92cb79d38c3 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -680,8 +680,8 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info); /* ipc/mqueue.c */ asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr); asmlinkage long sys_mq_unlink(const char __user *name); -asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); -asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); +asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct __kernel_timespec __user *abs_timeout); +asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct __kernel_timespec __user *abs_timeout); asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); @@ -698,7 +698,7 @@ asmlinkage long sys_semget(key_t key, int nsems, int semflg); asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg); asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, unsigned nsops, - const struct timespec __user *timeout); + const struct __kernel_timespec __user *timeout); asmlinkage long sys_semop(int semid, struct sembuf __user *sops, unsigned nsops); diff --git a/ipc/mqueue.c b/ipc/mqueue.c index a808f29d4c5a..9610afcfa2e5 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -691,7 +691,7 @@ static void __do_notify(struct mqueue_inode_info *info) wake_up(&info->wait_q); } -static int prepare_timeout(const struct timespec __user *u_abs_timeout, +static int prepare_timeout(const struct __kernel_timespec __user *u_abs_timeout, struct timespec64 *ts) { if (get_timespec64(ts, u_abs_timeout)) @@ -1128,7 +1128,7 @@ static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, size_t, msg_len, unsigned int, msg_prio, - const struct timespec __user *, u_abs_timeout) + const struct __kernel_timespec __user *, u_abs_timeout) { struct timespec64 ts, *p = NULL; if (u_abs_timeout) { @@ -1142,7 +1142,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, size_t, msg_len, unsigned int __user *, u_msg_prio, - const struct timespec __user *, u_abs_timeout) + const struct __kernel_timespec __user *, u_abs_timeout) { struct timespec64 ts, *p = NULL; if (u_abs_timeout) { diff --git a/ipc/sem.c b/ipc/sem.c index 8935cd8cf166..b951e25ba2db 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -2176,7 +2176,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops, } long ksys_semtimedop(int semid, struct sembuf __user *tsops, - unsigned int nsops, const struct timespec __user *timeout) + unsigned int nsops, const struct __kernel_timespec __user *timeout) { if (timeout) { struct timespec64 ts; @@ -2188,7 +2188,7 @@ long ksys_semtimedop(int semid, struct sembuf __user *tsops, } SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, - unsigned int, nsops, const struct timespec __user *, timeout) + unsigned int, nsops, const struct __kernel_timespec __user *, timeout) { return ksys_semtimedop(semid, tsops, nsops, timeout); } diff --git a/ipc/util.h b/ipc/util.h index acc5159e96d0..975c6de2df9d 100644 --- a/ipc/util.h +++ b/ipc/util.h @@ -251,7 +251,7 @@ static inline int compat_ipc_parse_version(int *cmd) /* for __ARCH_WANT_SYS_IPC */ long ksys_semtimedop(int semid, struct sembuf __user *tsops, unsigned int nsops, - const struct timespec __user *timeout); + const struct __kernel_timespec __user *timeout); long ksys_semget(key_t key, int nsems, int semflg); long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg); long ksys_msgget(key_t key, int msgflg); From patchwork Wed Apr 25 15:06:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134335 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp984082lji; Wed, 25 Apr 2018 08:08:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/sc41PKyZJMFQ+fJ6IRtEMqHFf+kDjBTZJose9z6J478rtHtG0u1CNoB7y/1JHmuciTUCd X-Received: by 10.99.116.76 with SMTP id e12mr23912926pgn.270.1524668902803; Wed, 25 Apr 2018 08:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668902; cv=none; d=google.com; s=arc-20160816; b=Bw6+I6i9oyE19BHIQTgE0/Y0X3rJSMsRI0SPzGPnOCufnoFPXzX4dr91Tosu3zDZee 2B8oB4+M8OMjFQsD7ax/8kZ1ZxY2dSnGEua2sFddnpUV49N5yMHv3Za4UN9HJwIdZeDL f6QDcZR/cHYLgQiwlBI5kEYCMxWL/bNFE23qCaLZKFCEJkR3+JNpL1W1qRuG6EenBUFf AAvx1t5/4GUGXS7WUz/oqMncTaF2rMsGv+xEiygcm9Z1zKnaMN1Tl2BrJyFeUCdDkQM8 s2HdtauGeF2E4i8e5zwxs8WM3xy+rb9PcrUBsRDRhT3bU8TvCYl7Jwz1MzN//oCM8aUD 9y1A== 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=CLZOfbiWuiHqC0BeAcR402aTnRNG5tOEtrsqLfrGOcE=; b=CpDqvTOOFln+6Qh/WCc1XHpiWkKh5FY7hNRe/TjUuCctoB5j8dYFmZVIXiJct6Eqn6 vDD9ONpzP8grji48Y/5WWQnofvWqQWZeLDdQRvwdGw8lGB8xKq6mZ5fkee99+bHb15Lu NEQ6pCxP3Z9wvAXvxy20e7tI4B2HNIEhBBcIVitYVzkDnCrkW7t6svHUcCaVWBFBv2r1 rD6ynNW4y1WTijvdcIQJ1s9k8Yp4TJkj8T6LXnXRO9Ogg7efcwx4FQDHGbzZRpBxntPR 477jJZ6ovfIZlLG1VsuVB0wIgNjDNA9+WAdyQzS7/I6OvmQJmbsQjLOJiXJkcFwEje3G JNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Ad/YeJrS; spf=pass (google.com: domain of libc-alpha-return-91827-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91827-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 k14si12780720pgs.418.2018.04.25.08.08.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91827-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=Ad/YeJrS; spf=pass (google.com: domain of libc-alpha-return-91827-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91827-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=flrhNI8dalr08psPEp8p+ogWZ3GckFu aHKrHd43DEpVEs+JLDBFYkSqEAMd1nLkKWhaei8gFr3Cc8uf54GAtZoj+kWqiYui SSezcgHbSO8hBIM+vtYAdITdIQ0EgRO0nmmj0i4HW2T+ML/NC8IqgqXeslJPEsod BtYvqPBDRBlQ= 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=vYCyqrcdCyHZrtSS3fnisIu9TL4=; b=Ad/Ye JrS3qn5qi3ERVr3a5kiRiGMvPf/SDvhHYJ0hy3VlIOQI45cTGt71KkI+poeOu47r GApfjZqBkhzFbOYLNe+T/aZkMPEHH7PUQn+b1OguIn5QRcGL3qCLgTi29HcmB1Xi s6cibgDKczqzZPiplOVjEjFHc1sl+1/EH9Zd/A= Received: (qmail 37601 invoked by alias); 25 Apr 2018 15:07:32 -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 37379 invoked by uid 89); 25 Apr 2018 15:07:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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=useing 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 15/16] y2038: ipc: Enable COMPAT_32BIT_TIME Date: Wed, 25 Apr 2018 17:06:05 +0200 Message-Id: <20180425150606.954771-15-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:fHlRHjI2exs=:6M9QJXCnsgLzIIphLgy2Mg YVxcYM5K2sxLJCbBcNLIEfEm0dZiVNxOGDaS1/tNQZig/GW7QaBsq65EJeoiMh5ANiszKwmGv wTStsLMoac0cyQOkfsKsFG4EvjKg6jj5dLzoMHzLdeW1Qvbg2L7hXV5hKkJZoEbVEzC7J9fTW aY2PtJzJ01sQdOWT5/1B8dTg6/LhNzIMqJ0X9aQh2cgGO/F9mhpaqh0SxDbmCTQJY2GDtXHCL htrKOesBEzylpopwX8XepplncHCjgdiZp48PDjU2UiIS2zV4/OCkNDWsv8vViZoGhYYs0dKR7 wHAKXu3YZF2nGbOLAuCgtQWKpgW+dNHS/UcyI8AnIzxofWzobwN2mvKjtLCsEApml2GU/MVGZ uC1cn1PDIB24E8wrxMXL/BB2e/c1TZ0gTX566qKcjbEKqLVVhYDuRoSbf/dLMADW5ifO3oNxJ X+75Wo26Nwg3enfLOEnQoIDOiApg3aDX/Hvb3NcF03X1gCwfXN9EkrVpsUBL2gXJVByvnsgXl TfdZuMHxP1cZl2/0gxO207YGyol6t4tI20S7ZiWJFjuIOOcl29wIUNvJBya/Ud6rsmHjJgiIq w9Gv1HoW9mEXNMB21iKjsdfsE29wux5c06ucCZfCF/9bpF6cjbVu00eaA+hO5bMxADjmph76l QpOpMaklFhjnFMco8gwZLO7I/gcmX59r2XxFkLiDQ274yR89JITAwFmvkSDsDGVCecaPRLoVO 9CMDmxE/+QSAlEcRDnuhAnjqQImcb4Gav8AdDw== 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(-) -- 2.9.0 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, 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: