From patchwork Wed Apr 25 15:06:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134328 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp982985lji; Wed, 25 Apr 2018 08:07:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jrvQrdAkUv4JZ6CJQbg8khy1TzHDQoXcWkJgGcbuQIVpNBCsRmm5+mbq1EKg2EQaFHnCc X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr30186354pln.114.1524668850667; Wed, 25 Apr 2018 08:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668850; cv=none; d=google.com; s=arc-20160816; b=tpLpfJiQG5dB6ZaLPd6hiARTbOJF23X+Hl4Mhrk69chJBo/V6FZiBtB7/oDFO+0gR9 t1CLRHiiNCsBq79P9sKMXv4bq3Sc1J1Bw3Ig/ZXNi0isQ2d2e7kAzOR/9H7uobEC4eax Mu4He/sjvM9eFqGAkW62XyMojI3P5dIRHwVEhcyOaaD1hChNSuofqF63ePONSCE4J+eB oINebVn0cpC6snH0lmulZv6IuOdA3kDi23TIpDqlQ0Fs133/CmR7SjlIrc0PsodaTQpw 4cpflFfUbQCWDq8hj63uIaUyQplvRiCsqA3XD0MkCSLeWbKicvlmwnNYHraf0HanHzC5 VWyw== 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=tDLLq1rZ8gjNjajzQVh83qrIv0Gx3AhXHDdxzmCdFao=; b=vCgNLohz+9uvJDJlnxNHJzb7EOJo3JObIVl93RfHygQD0iAd56TmCfP4PjZ0c+l7II XMfuD5TtcSeeLk4eOwKw9hzYsqMmgwDgkJomWYU6Qq8s3TXREu3b6r4prWk2fc6s0/eK EfsMzLYjAABLRLMw/XMyQsgzkYJtDqgVfmRdfQmNEaLhwItdOpA8a8B6No3GSZ1qidiM qRw5qhC4CMIIqDPJ6m/I4oic29STZrqh4wbdN9RvzvjK6dxGlrXks5iNaFF0DlJekjig hgk+M7fjebEHzmqWREaQ/6j3Fncn+4BhgaD089SGd2qsGNBgkGlR2HQRvRKOLzfrNIIG lVHA== 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 s21si16715800pfi.87.2018.04.25.08.07.23; Wed, 25 Apr 2018 08:07:30 -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 S1754890AbeDYPHU (ORCPT + 29 others); Wed, 25 Apr 2018 11:07:20 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:50445 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754807AbeDYPHN (ORCPT ); Wed, 25 Apr 2018 11:07:13 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0LpTKI-1ei3ec2fKg-00fSwT; Wed, 25 Apr 2018 17:06:28 +0200 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 11/16] y2038: xtensa: Extend sysvipc data structures Date: Wed, 25 Apr 2018 17:06:01 +0200 Message-Id: <20180425150606.954771-11-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425132242.1500539-1-arnd@arndb.de> References: <20180425132242.1500539-1-arnd@arndb.de> X-Provags-ID: V03:K1:i9UA0urn16lH5JDePVWaotJn6MyPgLR5FfVVrzw5nnNPxOm4u+m riIT88wp+mhan2hKzci9CR3aFUrUbzlqeokKS47rOWVrdtHsVQuvjSOnovuLXAj+H7J7Aw9 RyM3AfCErlZJqOrqV2ujx3kKosgfMIKHftIfYa4cI56loqLmcCuYokhVYKrtE4ew0SIDzXE PFRkWR80Y2WN+Q+3jvDqA== X-UI-Out-Filterresults: notjunk:1; V01:K0:MMC6hV4Smk4=:Ri6ksbuau+5BNTCbTyMUCj d/CCHE71Lb4RthMXlTF73W2Kb6JRAMhq60rPHWcJDIY3WZJO4TZJtgqueFD//r5L4fZ1zNMnu iOtCjozl35j0/FyW63KO86fBfoXTgu6DtOJhB6IRVxZl1kXXmPNWAOLuvNtdGWL1si5cTlh9g 1aDEQlN6RFs2S2yBmVL+YGXOfcbqNc+TAcYLBAX2jft4Sk17RthUFG5u/hWMwv4YyjekLzTbt sprBskLIXjTTaT4PZdRjfXoMbcP/6qwRCj6/KA+SWVTXU5S3N9/hBYu1SWwumjWSZVBHLR1tN ea3HFSRM2gCMzepL5PV9Kdgo4BZkNQJrLrozrqPrbGJMDPweuUA1N35bu4k3m+Rn90FWW7qnr vUJ6DJZZ9o4fFnCYxppPvtV6rpVnSXFA/4a8rZbKiw///CwHqyq8/RopFnz+gcZamMxa/dq0r UDDMQhnnWaKK+JoYaEBYBSLzJQGKnUBIr2RqYW1pKaYF0hlVS2ro7iYl1TmnfseQ0EE8TyH3W wDSds8RLaUBjYs1q7tP1jpd9toP1fVzntejOnWOhNsTsFE23jHdXhumBPAMcF7eoCtXtAWYnM I49KOYJ8dW8/bRY8anU+WLYJpeuneNl4AE6tiOX0sa/o5DQREOgZsIWQx5IdZl8FY3AJpJXji 9dc6tTPNfpO5OekU6oMM8YMTOf61mTSHD7Ap9iH192PGQ1xnwO74HnAPgg9tFE8noJemzUatP zkbAELc0yLPQMjgoPlTnk47Z8iuZZt11Ms/ejw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org xtensa, 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. xtensa tries hard to define the structures so they work in both big-endian and little-endian systems with padding on the right side. However, they only succeeded for for two of the three structures, and their struct shmid64_ds ended up being defined in two identical copies, and the big-endian one is wrong. 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/xtensa/include/uapi/asm/msgbuf.h | 25 ++++++++++++----------- arch/xtensa/include/uapi/asm/sembuf.h | 17 ++++++++-------- arch/xtensa/include/uapi/asm/shmbuf.h | 37 ++++++++--------------------------- 3 files changed, 28 insertions(+), 51 deletions(-) -- 2.9.0 diff --git a/arch/xtensa/include/uapi/asm/msgbuf.h b/arch/xtensa/include/uapi/asm/msgbuf.h index 36e2e103ca38..d6915e9f071c 100644 --- a/arch/xtensa/include/uapi/asm/msgbuf.h +++ b/arch/xtensa/include/uapi/asm/msgbuf.h @@ -7,7 +7,6 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values * * This file is subject to the terms and conditions of the GNU General @@ -21,19 +20,19 @@ struct msqid64_ds { struct ipc64_perm msg_perm; #ifdef __XTENSA_EB__ - unsigned int __unused1; - __kernel_time_t msg_stime; /* last msgsnd time */ - unsigned int __unused2; - __kernel_time_t msg_rtime; /* last msgrcv time */ - unsigned int __unused3; - __kernel_time_t msg_ctime; /* last change time */ + 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 */ #elif defined(__XTENSA_EL__) - __kernel_time_t msg_stime; /* last msgsnd time */ - unsigned int __unused1; - __kernel_time_t msg_rtime; /* last msgrcv time */ - unsigned int __unused2; - __kernel_time_t msg_ctime; /* last change time */ - unsigned int __unused3; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_stime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_rtime_high; + unsigned long msg_ctime; /* last change time */ + unsigned long msg_ctime_high; #else # error processor byte order undefined! #endif diff --git a/arch/xtensa/include/uapi/asm/sembuf.h b/arch/xtensa/include/uapi/asm/sembuf.h index f61b6331a10c..09f348d643f1 100644 --- a/arch/xtensa/include/uapi/asm/sembuf.h +++ b/arch/xtensa/include/uapi/asm/sembuf.h @@ -14,7 +14,6 @@ * between kernel and user space. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values * */ @@ -27,15 +26,15 @@ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #ifdef __XTENSA_EL__ - __kernel_time_t sem_otime; /* last semop time */ - unsigned long __unused1; - __kernel_time_t sem_ctime; /* last change time */ - unsigned long __unused2; + 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 - unsigned long __unused1; - __kernel_time_t sem_otime; /* last semop time */ - unsigned long __unused2; - __kernel_time_t sem_ctime; /* last change time */ + 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 __unused3; diff --git a/arch/xtensa/include/uapi/asm/shmbuf.h b/arch/xtensa/include/uapi/asm/shmbuf.h index 26550bdc8430..554a57a6a90f 100644 --- a/arch/xtensa/include/uapi/asm/shmbuf.h +++ b/arch/xtensa/include/uapi/asm/shmbuf.h @@ -4,10 +4,10 @@ * * The shmid64_ds structure for Xtensa architecture. * Note extra padding because this structure is passed back and forth - * between kernel and user space. + * between kernel and user space, but the padding is on the wrong + * side for big-endian xtensa, for historic reasons. * * Pad space is left for: - * - 64-bit time_t to solve y2038 problem * - 2 miscellaneous 32-bit values * * This file is subject to the terms and conditions of the GNU General Public @@ -20,42 +20,21 @@ #ifndef _XTENSA_SHMBUF_H #define _XTENSA_SHMBUF_H -#if defined (__XTENSA_EL__) struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - unsigned long __unused1; - __kernel_time_t shm_dtime; /* last detach time */ - unsigned long __unused2; - __kernel_time_t shm_ctime; /* last change time */ - unsigned long __unused3; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_atime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_dtime_high; + unsigned long shm_ctime; /* last change time */ + unsigned long shm_ctime_high; __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ unsigned long shm_nattch; /* no. of current attaches */ unsigned long __unused4; unsigned long __unused5; }; -#elif defined (__XTENSA_EB__) -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - unsigned long __unused1; - __kernel_time_t shm_dtime; /* last detach time */ - unsigned long __unused2; - __kernel_time_t shm_ctime; /* last change time */ - unsigned long __unused3; - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused4; - unsigned long __unused5; -}; -#else -# error endian order not defined -#endif - struct shminfo64 { unsigned long shmmax;