From patchwork Thu Apr 19 14:37:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133822 Delivered-To: patch@linaro.org Received: by 10.80.173.174 with SMTP id a43csp882238edd; Thu, 19 Apr 2018 07:40:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9vjijm4kCrwk8IC40hanC1W2CgttEhssgT6acdnmGMU/zpaKN5aMFtPu0pXyeGrjsRKhp X-Received: by 2002:a17:902:8f86:: with SMTP id z6-v6mr6531952plo.316.1524148848424; Thu, 19 Apr 2018 07:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524148848; cv=none; d=google.com; s=arc-20160816; b=D4ROtEmQHSayLO0L5PVc4SZYzmfOxA5+PgHqaLlPtFhc3i84hZNkOo79hIMX+1RrW+ qMntNS7Ka5tCP16XVZt/9FAr6dKIVzX+L7gCzcwn75816PSlkyUU8I6Rle4Hk24MVoEA Mv+XFTbGgRwwDY1BhNSJo05JZsMob9q7mPJkz6C7ENfQcphjRl3gxpUDYCnk8O23SP59 AiD3JMGQfjQbv7XIyUUs68+k6DkvKNRcQeaSRfUSzQ07qJlpckpIW1q1GfOwedT2rz+b iGEW36OyFM9MlXmLNMXGGnGMgsAOC4EVR2Ba+yOqE+ZsUeQ2R2R46uR3pA2qDdh9CoM5 wm6w== 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=VkhIOswts4DnNqqUrvXQBK3Vl82L9paoZ0X6sX7YKdvE3KhW2kv3wNCRfFcQqX8MS8 lVJQLyCcE+ES90ABaRSr8xZMRb4UpVMzEhEXSWvY71YsAUapWPui9TLKPDcjB3dk+Ftv k9nL14jHTGVDpgFEdTqpvYVH22lCx54SGkBLvk2GW0SMH1bI3rL4/cSIgV6ZDroKYqOg HSbH8LumKrsb5IoclFymBWXo1F8GSmqjTjQatbjj4A36Bw5mZ0JpSlDyB0tIRjQzr0dU bKVsQd9vMo1bj3GglxDT8J22ebxnKn3fIkrm2LL7YypEGnd3aFv8bneAawHXlCvwaL5Q a4Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sGyShwoq; spf=pass (google.com: domain of libc-alpha-return-91713-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91713-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 n66si2675876pga.299.2018.04.19.07.40.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 07:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91713-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=sGyShwoq; spf=pass (google.com: domain of libc-alpha-return-91713-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91713-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=MLsWib0/0gtaL6f6lgsHOrzCMgRpZeT CoBleEnKGYjjBsKgaLUS+GK8QdVyavHMc87B8cR6TNq3TGNjgO5rOY3gYbLCJSXJ 734g/jglmbotZi1TbsFNTOIg+1OEfnwUfKB+/Bf8HU8dYA/SsmZypYFz1tfF1CWD 0OiNOALtopAA= 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=sGySh woqQL+TMS2WxImIQvr+eSH80CQgoApT8SPOohGCjIdarAcIBjaSeMVil5SfCnqNl uPiJCN+gaxJ52LpkY/7b4A2r8XKjTj5XFq4ko7w49N2CpgxMpB2DGDpypNASv4BX CgKf5BvINiMMQbvoy2alSXhzDHfIT/Qab8SSIA= Received: (qmail 114517 invoked by alias); 19 Apr 2018 14:39:15 -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 114318 invoked by uid 89); 19 Apr 2018 14:39:14 -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: 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 09/17] y2038: sparc: Extend sysvipc data structures Date: Thu, 19 Apr 2018 16:37:29 +0200 Message-Id: <20180419143737.606138-10-arnd@arndb.de> In-Reply-To: <20180419143737.606138-1-arnd@arndb.de> References: <20180419143737.606138-1-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; V01:K0:tjx1+eikukE=:Slz+bhRUHETkkn0fu6Yz+T zlm3HMb0f2eiL1n7nMnE66+dnT0+kodfO9CE9zFhcjggmTnNky/uXNH7cWkaTq4ncvBaNn7PY QwR7/Rne8xmQFEekwu+rhYXZ4ZiuIp1j+YakxTSakv0LmsfNSsK+C82EVDoCDHWxlZZ+1ycgy BSkRvgQ30iMFGxw8TGQwhZezM0cX0gR8BTVpAIcUdGSz57tPIfJBGIr2TwMzHClAQ6kyu4RNZ o7kfPYv76cit+UcP/Ira7IV4r2klbI7XIrpo96WHKnq5OzUWaceoKKPWgMH9/jeXWMLk/H/8H nRoH/H5gKp0s42LQzrDMqIdrzvmb9GQnk2V1CfRFUOqAMFcAaNFdKzXxfFYwgsMg0YGcfnCyY m3A8imOoAZT9g3MdUZ2xNw1SjJVvwgdZLkXpHBxm4C9JOUDCVJnL4iyPhtrRjnEnVVUkZqiO0 LVdcFmnNy8gYTpENMNe+Syhbd+3ZS7/dF1GwjLEIuAVf5zFTmnzmhYBIGhwHzxB07+ipSrb4u 0VZddSZ3fbfftJjQkMzk6MLkTWJBUV1Vwmqz1FcrdsDF8KjMxNenvfshQmA6IXYGCaYZ/J8dv HHDBOEbTorKtmFOFGF6NlCIluwJugCYUkzAcs8af9A2Ys3VhTrCohTUUbNQJDiFOL4daE0IeI t8CdSuP3hfR3w9PqZt+xsEixRQcgEZPITcCS5olHmG4dNJpAg/N/ODVkoxrfAdoGlYnyBRDJ5 FAZCsyXfR4KyfgOS2c9jCC66hD1rRhdxZSpeLA== 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 */