From patchwork Wed Apr 25 13:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134300 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp863636lji; Wed, 25 Apr 2018 06:24:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx49dYZAINCBq8PkN6VEkvF8ZGsZ/Ry5svDPvCVUBTglra7jyIu4bUBsRUodAbHXUlGIS/Zat X-Received: by 2002:a17:902:40d:: with SMTP id 13-v6mr23768307ple.117.1524662678582; Wed, 25 Apr 2018 06:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524662678; cv=none; d=google.com; s=arc-20160816; b=Yw2Dc5DrBk7M7oyKGCVtZnvs9a+kdWVkILDaFDP2+GEMzqP59xvPh4Ba/g66loS1/D NzkMCW67myQcPthmMYY0lVMojm5+owjV2BL9NyDTWBJ6/g0OdRvg+Pr5iqqwqLukfled vDsfsH9wqgZWwJ4muviiqKorR+4ZIkyGMrah7ct/uJT/hWuQDZ8ez87OPO2NQnNoRFsV 0UzMrh9+qt5VI1yhhGj8K8Uj05u/3MLUpqPXtDbhYbKAqhGRLKSIYadOSrnPyKqKfUtl eKWpTwn7V4ZlnGmx9N/B6385ft7ngi2Hf85GGsfqz72V+94w+VY/+jppClpFh29AaYlm j9gQ== 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=ieMx5zliTjmujhTfjI2LSb4TlY9qzLdIBt1TEl1MEfHLk5BrhXWEiIIXAw815RakHH EOl2ho+DNYn3iGkKd9UPLPgsDqMFXjV+Ke2wKwlCmDUe3vgT+KuT8UIxXYfMiterHScm fvRB4Hi/s0CJ21WztV+omhO+VQiP1RFHyCAtR8qT5ZvNOMsNgW43rGszFm/DnQM9j9fP KjKUSbG+6rHi6TKcnQbMwur6qKSHBXJZZdmDyObI7d1rFKuD6kNE20BOIJRX11kD6yvz fTm5ZQyJkYCkp6+bup2suYEkT5rJ3LgxwoN5Lu4kGXlOD5cMtnN+hrFUrsfjMpD9joIx 4ZTA== 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 k14si9426898pgt.27.2018.04.25.06.24.38; Wed, 25 Apr 2018 06:24:38 -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 S1754524AbeDYNYg (ORCPT + 29 others); Wed, 25 Apr 2018 09:24:36 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:53435 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754112AbeDYNXA (ORCPT ); Wed, 25 Apr 2018 09:23:00 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0LrKaC-1eF0jH1cgm-0136Ul; Wed, 25 Apr 2018 15:22:59 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann Subject: [PATCH v4 11/16] y2038: xtensa: Extend sysvipc data structures Date: Wed, 25 Apr 2018 15:22:37 +0200 Message-Id: <20180425132242.1500539-12-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:VnC7RDmdkuVwMXDa/0Q3iXctakzxttaWlKnKAZHLtOh1npkakHR mGropsslwQUd3aRNbNpX62dY1pA8PhYRWroOflFFwcnbXANTxsf9ccWlLcCjh2yx7o7uYYB 5xrezUuzuek2HDdIa9kcA/ju+JzunDume8fuppxUlB0zYjHHMqNXzNwBO2QGlaMPOP8yikk y7hfnGYjwyt5n6kh/tsDA== X-UI-Out-Filterresults: notjunk:1; V01:K0:3iyvHuc8Wpo=:qn6ghZj72LMHyh7O2c839d p4imYCRwxxRn705vMAdesOIetG02uBq2KuwGKkvtIqkEukInCzD7YzzmLgvmhShbfiE51tmg5 N48AwaFKdLYfuuhylZ8sPFf2TH8miVToZULQzxl7hUh9rcG30vh/vacM9aBYz3DIuyKXQtJG6 7GO3JiCS5C7ReMVXkTbNkJtwzU8Sj5OYFAqj/RPwvuFgpaS6vZsiPg48bVOu2cLfQAKeB+z8u Dw0ytmQ8a4tATVlyKnF3SIEx+R4szeSPK68e7nDtg/ZKkLNgXhFA53EUGlExElFiGhcrF9hNW kUXtfJNOHuU9F28IvtSHMhU8ITLJhD5PKAip3qRImP/r5FpPuojkcI/jQyXBxW85MrZ50vO/U PuDm0V06KBKPuuEo9Jl3udB5cbp8JPyroEqjqz/M672bKWX5oi3Wcrl7WYW8g48Jf3baRP4T8 TT6JDV7cbtco60A5ZnbqKuXXqiwvbhdlERTBaDeg7nymNJtnQB4fZajHnOOD0sfNQuy7fk5KE OsdemVJYBIrRyp3aR8JWDHlTyKX4sOl5uf9hOGqdr+vBZ84j2OREm5rxF865luU3c4eabXHKS KPGr10vCETz0nTN8Y3PvZ6eTYQxqonp/EVfF+G6d08yWfyQaQ2suM0boDHu8Wwsg5ofWa8lM3 eLhcS2Kg3I0poJ1hMY2LS7BcwwLTu/vBBVwyC2teofLEazB1vW/D1m10fJpgOx3DKrpMP4OEz acszHjXQ6esp9dLqwvk0LCeXqynT2NcV9yoNOg== 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;