From patchwork Thu Apr 19 14:37:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133818 Delivered-To: patch@linaro.org Received: by 10.80.173.174 with SMTP id a43csp881875edd; Thu, 19 Apr 2018 07:40:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+JPvb2SuF8KcbCAd/OEH7IH1iRRFPYLjlMwWmTkz20hl8uqEuAZJkBSH33V86OANZ8bJwx X-Received: by 10.99.174.6 with SMTP id q6mr393526pgf.350.1524148827154; Thu, 19 Apr 2018 07:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524148827; cv=none; d=google.com; s=arc-20160816; b=kWkUxvXeoBsvu2LQMlbI75iiP2kE0BhBMB+MTkHn612fcoCo9QUTavBDf+dz0nY5Rn 5v53GL2PNU3yIdG4ZfVhW5IZMTIrW1Bd+dW6rlqNGnmZVQ8XFNhQy9WoqjbsB0CwB6Br Ovmqifseuiy/r9nXtWHX8KVkD7VqsaTdCn1+hcvEsnNPQfcI9SD/F+ASDFT7DR2do8IA iflZ//EQdf11SLBsV5n15ynfhMQcXArI9xk9ADA9uKaYwU9L6cjy53weCPkV5Wn/vRQT NY2xy2urHMOIBJly6s7Qp6FgR0ZK1mSC9hxZ2+PuZaXI7kEsfg5SoUxjjHo0w+P64c9x eFSw== 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=UBzRDlwPHIQ409lkdhtVRYuqTq2/VtvTzjteyodxr5Q=; b=0Gwf4nhMOjVbzqwNBzaOEw2FlVTjtdaZ+pLMPKfSXQflABxyqK9/95Img0Yxo82qSG oZ+Kr1Zek+pl5A97l5Tpt9lNVXwCaE9R7wRaR6TkP67TAOekRgy3qNX9u9tYLKO25VMs YoUf3qpOuiR56nIqOVCqVQDnpeqInetOW9FTueOajyqujI/x0PvyxiqcqV6LZRLt1xVf sMaNGLjnCbzO7bNXh+4selW51XGASY2PfizncYy+PPQ8rxtfNBsIfuPVVqKnGsaBsuEs BvIyHrOpapVC2Fm+oUXld1Q3j7XJE4JO84t7691wY7gKpNDCbU5QO7AAfxbE1AWs6q1/ 3XhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=O7e74nz5; spf=pass (google.com: domain of libc-alpha-return-91711-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91711-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 q3si3143495pgs.516.2018.04.19.07.40.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 07:40:27 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-91711-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=O7e74nz5; spf=pass (google.com: domain of libc-alpha-return-91711-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-91711-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=y3WPna56NuNW85f2rPCSd9gsTzElIyc 8BoWSlo2o1S61k7w6H3OAkfraOBkfyhl+IRedZZsWh2zm1meSKbsluXLpspFeAUW A1S+ARb8vCSAwrydw9eYNi3mmbmIa5+yWK08LHDXz1bQo3XmtOhlmIxUwzYw5wtJ RkeAAlTd/k2k= 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=LTP2UIANVjSLvuRmlyjpqGY/KUI=; b=O7e74 nz5IVH0Cd8La1hFEGEk061J7UStX97ZSdA/Og1YFkIqs3/vE2AMDyR3WEQz0wBDk uzGsq44nrsR9sU75ilCweSYcE3bFJ/W6Ui2V7F2HTQ2Ye9rc41hZQPy4Q8DaSfqc 6c27u9IVRxP/wdqdi63NplDDvoQErUSKQIy+m4= Received: (qmail 114340 invoked by alias); 19 Apr 2018 14:39:14 -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 113790 invoked by uid 89); 19 Apr 2018 14:39:10 -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 13/17] y2038: ipc: Report long times to user space Date: Thu, 19 Apr 2018 16:37:33 +0200 Message-Id: <20180419143737.606138-14-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:gxdyLn+WgI8=:QrwmH4QYo+vDf32UyJdn7U GSXwOq8Z1P7oZctcw2SmS9F5NIQmA0QoW4HwdLoapUoWwk/u8gl7dIE1rRkTMnaHq4j/fGxPo hOk4JleURV63Logc0B8S1Cg40e4uLjhoQb18E27t0iANqBK6qEIYhQBAFt/1v1Uf08kG2PFF2 jerMAjzenIdfTTE2EPhmO0I/q9a7+K+JH6t49M2eEwV+KnEPvip8TROI6rrgheWzfYTspKmZv oM3PjuC7K8J9PBGzlbyUC1Sbh5+c4uTdJpLR/1FP3PFCChiCP3+5aidqaKeksqFaQLlKZKHwA oKcXDoJ/VvjVfodTK0nC5V75BAkAzAsSAcfJZ57jU0jZgQ7NSJPiuUzrRO+flHJhgvwZWUKcz OqrkZR9cA6dn8Ixql3KIAGaFJQ+EgMsDxJIbjtJrm8aAMN6hzkL8CtGSS44JUx3Uut+nAJVXq zFn8dlpNU+5Q7RBIm9/uYgAJU+Tn9Iw2vOxrQrJQd9HrkgqTCwdKgJSYi+Ln7BRP2Njg54f3P gFgTEKRnrCf/3ipwryqF+06ElwS5qGmKFhUL1Lb+YKsyqgwMJ28krqyHeje9ZTYIe1wQfH2c1 zgGOg7RQd9CWXv4b8OKcv+BS+8IXsCi9pLW3AxaC2S64mz+5Fb9ymNfbH0GnQuyCTRO5FSu1R 1zHcMUlI33FRxF6KJmfI6q3XHKaFgG1XRS820YwMaFhxt2bTgWie/p3f0wWuDk6sCRdtde6/0 op3uJXKZvCvI42H8ci3022Ijj8oeqLWvpdeOow== The shmid64_ds/semid64_ds/msqid64_ds data structures have been extended to contain extra fields for storing the upper bits of the time stamps, this patch does the other half of the job and and fills the new fields on 32-bit architectures as well as 32-bit tasks running on a 64-bit kernel in compat mode. There should be no change for native 64-bit tasks. Signed-off-by: Arnd Bergmann --- ipc/msg.c | 14 +++++++++++--- ipc/sem.c | 14 +++++++++++--- ipc/shm.c | 14 +++++++++++--- 3 files changed, 33 insertions(+), 9 deletions(-) -- 2.9.0 diff --git a/ipc/msg.c b/ipc/msg.c index 574f76c9a2ff..3b6545302598 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -537,6 +537,11 @@ static int msgctl_stat(struct ipc_namespace *ns, int msqid, p->msg_stime = msq->q_stime; p->msg_rtime = msq->q_rtime; p->msg_ctime = msq->q_ctime; +#ifndef CONFIG_64BIT + p->msg_stime_high = msq->q_stime >> 32; + p->msg_rtime_high = msq->q_rtime >> 32; + p->msg_ctime_high = msq->q_ctime >> 32; +#endif p->msg_cbytes = msq->q_cbytes; p->msg_qnum = msq->q_qnum; p->msg_qbytes = msq->q_qbytes; @@ -646,9 +651,12 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in, struct compat_msqid64_ds v; memset(&v, 0, sizeof(v)); to_compat_ipc64_perm(&v.msg_perm, &in->msg_perm); - v.msg_stime = in->msg_stime; - v.msg_rtime = in->msg_rtime; - v.msg_ctime = in->msg_ctime; + v.msg_stime = lower_32_bits(in->msg_stime); + v.msg_stime_high = upper_32_bits(in->msg_stime); + v.msg_rtime = lower_32_bits(in->msg_rtime); + v.msg_rtime_high = upper_32_bits(in->msg_rtime); + v.msg_ctime = lower_32_bits(in->msg_ctime); + v.msg_ctime_high = upper_32_bits(in->msg_ctime); v.msg_cbytes = in->msg_cbytes; v.msg_qnum = in->msg_qnum; v.msg_qbytes = in->msg_qbytes; diff --git a/ipc/sem.c b/ipc/sem.c index c6a8a971769d..8935cd8cf166 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1214,6 +1214,7 @@ static int semctl_stat(struct ipc_namespace *ns, int semid, int cmd, struct semid64_ds *semid64) { struct sem_array *sma; + time64_t semotime; int id = 0; int err; @@ -1257,8 +1258,13 @@ static int semctl_stat(struct ipc_namespace *ns, int semid, } kernel_to_ipc64_perm(&sma->sem_perm, &semid64->sem_perm); - semid64->sem_otime = get_semotime(sma); + semotime = get_semotime(sma); + semid64->sem_otime = semotime; semid64->sem_ctime = sma->sem_ctime; +#ifndef CONFIG_64BIT + semid64->sem_otime_high = semotime >> 32; + semid64->sem_ctime_high = sma->sem_ctime >> 32; +#endif semid64->sem_nsems = sma->sem_nsems; ipc_unlock_object(&sma->sem_perm); @@ -1704,8 +1710,10 @@ static int copy_compat_semid_to_user(void __user *buf, struct semid64_ds *in, struct compat_semid64_ds v; memset(&v, 0, sizeof(v)); to_compat_ipc64_perm(&v.sem_perm, &in->sem_perm); - v.sem_otime = in->sem_otime; - v.sem_ctime = in->sem_ctime; + v.sem_otime = lower_32_bits(in->sem_otime); + v.sem_otime_high = upper_32_bits(in->sem_otime); + v.sem_ctime = lower_32_bits(in->sem_ctime); + v.sem_ctime_high = upper_32_bits(in->sem_ctime); v.sem_nsems = in->sem_nsems; return copy_to_user(buf, &v, sizeof(v)); } else { diff --git a/ipc/shm.c b/ipc/shm.c index 3cf48988d68c..0075990338f4 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -1002,6 +1002,11 @@ static int shmctl_stat(struct ipc_namespace *ns, int shmid, tbuf->shm_atime = shp->shm_atim; tbuf->shm_dtime = shp->shm_dtim; tbuf->shm_ctime = shp->shm_ctim; +#ifndef CONFIG_64BIT + tbuf->shm_atime_high = shp->shm_atim >> 32; + tbuf->shm_dtime_high = shp->shm_dtim >> 32; + tbuf->shm_ctime_high = shp->shm_ctim >> 32; +#endif tbuf->shm_cpid = pid_vnr(shp->shm_cprid); tbuf->shm_lpid = pid_vnr(shp->shm_lprid); tbuf->shm_nattch = shp->shm_nattch; @@ -1233,9 +1238,12 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in, struct compat_shmid64_ds v; memset(&v, 0, sizeof(v)); to_compat_ipc64_perm(&v.shm_perm, &in->shm_perm); - v.shm_atime = in->shm_atime; - v.shm_dtime = in->shm_dtime; - v.shm_ctime = in->shm_ctime; + v.shm_atime = lower_32_bits(in->shm_atime); + v.shm_atime_high = upper_32_bits(in->shm_atime); + v.shm_dtime = lower_32_bits(in->shm_dtime); + v.shm_dtime_high = upper_32_bits(in->shm_dtime); + v.shm_ctime = lower_32_bits(in->shm_ctime); + v.shm_ctime_high = upper_32_bits(in->shm_ctime); v.shm_segsz = in->shm_segsz; v.shm_nattch = in->shm_nattch; v.shm_cpid = in->shm_cpid;