From patchwork Thu Apr 19 14:37:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133812 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp715060ljf; Thu, 19 Apr 2018 07:39:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49d/Miq9N8tUFiquvOO3iNgiL7lbgARrKInbMKY7MuNPqJpj1+Zn0mdkiYayjivrt8lfWzg X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr6327044plb.226.1524148780502; Thu, 19 Apr 2018 07:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524148780; cv=none; d=google.com; s=arc-20160816; b=oL6VgZ79vC6NofUp2AxqSx7kIjjg5Do3JRNEbiy9NMmj7hKkJCVDSVf+nou2gShuLS k64YgkXcYDgM1MUIeAindg5TbIoxXHCsa6Vatx0BOQ7RnGAbcZiBtaIf/30qy7zqdSi3 poo179BINX5hhA3TixJFD3ZfLj1AO8uV/Y1zZnzBYs2BWvZEjT88F3Bj08qKpDe7CZju bnHLy+42BooMF/b4j4ugthuXp/dM/YVUzgIngzI9U8XrbsN/0qKNasnR9t3dOMol3Lo0 5Eii3LMEhDvBOkGajLeTAeBRYIXCwzaJXbE9sHFSyWXhbLvgsnH6j3kNQqzGwr7Yrseu Yndw== 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=Wg9nx2Y4STPDXVNbfVvjsEPGIiZUgNxg/aEdD3j8C7w=; b=CBL404RL4J3iA1GzV4RiwQ7l9/oHEPguI9tfdlFr/OXqABSkNpiErUBK7fI041uBj5 xCB1IB9sAc1R90JlzFpXCrEyjH+oGo3xu6hYc61yL31qpX3NvnfrHZaDn8qwNhaqHTIR vRRKzx7ZUhhKguecZWTLkrcTO8BZ7EixxFCxoQh6TI2mTnD6QCDTaDhESpdeGgLB5T2t L7lMY5Lp1k4plwvzzxA02aw6pn8nmRlqH5UHnbeWMjAM/I+uA6nRCFhNuqQchN8ycPEy 20RkuD2MA7ry1jrjJgJ1hijE0ifD0Nw0fD7GLyNIqk/KhBnPNnRO2VMH9J1cgXkUIL3S Fplg== 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 e7-v6si3611326plk.397.2018.04.19.07.39.40; Thu, 19 Apr 2018 07:39:40 -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 S1753673AbeDSOjh (ORCPT + 29 others); Thu, 19 Apr 2018 10:39:37 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:50171 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753575AbeDSOjW (ORCPT ); Thu, 19 Apr 2018 10:39:22 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LrsLe-1eQWCo03SQ-013bHD; Thu, 19 Apr 2018 16:37:56 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, ebiederm@xmission.com, albert.aribaud@3adev.fr, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, x86@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-mips@linux-mips.org, jhogan@kernel.org, ralf@linux-mips.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: [PATCH v3 10/17] y2038: powerpc: Extend sysvipc data structures Date: Thu, 19 Apr 2018 16:37:30 +0200 Message-Id: <20180419143737.606138-11-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180419143737.606138-1-arnd@arndb.de> References: <20180419143737.606138-1-arnd@arndb.de> X-Provags-ID: V03:K1:RCd5sWbjjJLXnkZMtAoyJ7y6nM6w16+IHNA/SHAoP8x60OtCrTu xYFyOL2cctNKPSsJ8+XehyGvZPwhGChyhaG42mejxHzZ7wQIsPQlBHYy+tjfj//5BKnTfw8 c278yelwa7Kw0L0KGB3DSeI8npmUvt+YbhkskWKB8QOdYYFzL12DeEO4l1ORZxP8X+ASpAN RwRe6y47/RGushgpBSa1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:B6FxIiDaqlM=:VUZGWFRlSa4W6ocQ75t4iQ e7eZ0H2yFtpKT/Hei9Z/XXGMzg8BdMKRE3qOc160oCcx6HKvgXffELdPmEZHyptm5VR3Qpc9x 5X5H/mE316Qn7VJe6fVAwTzt7OvEx5ZAIQaecMyw3S0SLE1fTHa8OqvlcSUUMB4l966PGutpQ vklonlggKU2uv1IdxG0sePYqkVB4bkmIZ7e/gUN3Dqg12RJcmAkDrqj2VQfpHTz976S499zI6 8zOtarGa2yM4RbKfzc8UPTt0TN96v7aN7prKTII7g1Wmr5zfKDtV5cIrWe8oi45iAZrGpTdgO mhLH5uLEpkXjU8NFRnWS4iSYaSf+h347t9iiSoZEZ9HV9uqWROOfWg39XmqBB7Pl+PQIFglJS p8ZUbFxSSwqjTo4ROK6tbMhTwVKgchC3ugzrh8PaUExk+LhaReoYW/AjzKYbPHJ6XHFt38+x+ M8HcliNtW60eRPgJiRmQKm5HzLzbxKI7vrSaDYlflrsHv8zjsDD6wxp3Il+iyDi3T7i8dn+G0 p94W1U92xw0yFbUmdQv3sjb33kZ9Ba/gbAhQCK7dxIniDyp6E0A0n3Nq0MnjrWUtrZmoVSg8W Aoxa2WnvY/uU/wgbmdNWcfASCqgsMg4IS5UxE8QaZSc+6mqDORWqxaVHeQZFP6qK4NEidQXrX Fs0vNJtvOo+0S1uESzlMTAfovL228Z7E9/QRhlarn2ok1MqelqE1cgQ2PUfDZvHpAnGeS7jmk iRn9GrDYuVhYupMujd+JGspAP617wW8JgSSCeg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) */