From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by sourceware.org (Postfix) with ESMTPS id 323E63894E5D for ; Wed, 29 Apr 2020 21:09:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 323E63894E5D Received: by mail-qt1-x843.google.com with SMTP id o10so3211775qtr.6 for ; Wed, 29 Apr 2020 14:09:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RGbN6EWjzNDgmTqj0rA7eG+IYcsme/Pbeqnrhrs96uc=; b=M/1GEhri+kXTpkbaXQtDcCjRr4RHRWYXCaLcOUEFOB88wubLvjnOuevbLQH6LPQ6yg udk+Qo/iAD58rMID84Q3jLNY9xJeHZghpKje2UF26wvxpDvecwsPZLCfNOcAz30i04Eq WVzcU2iC8tHwT7NSsvfiepzN/k+l53qTmTpNL8a1KsmBFic0iORKgWxrQDLNikUJORzK Lgb0AjkrEZ39eCd61+nBPfnZYCVECxeMXOSseiXtGAref63fJCuITe0FAGdkjKke9ysh EnR5gsvhiLnsOIc85mjgIUR25Vb4Dnoorq0onu2BQiSTYA/H5jSEFNsOLKqmxSJbQ8G1 uwAQ== X-Gm-Message-State: AGi0Pubmci+SiKN7aKKar+FqEM3VKjIefo4KSIGEx2QWIt6Pw5tIBZLr zJYqQxLcuqYUrsUoldDK+siHnIYdeRU+9Q== X-Google-Smtp-Source: APiQypJ3MvytKq+g2tLUFrIGfncwSVqgVt9sDpPExnKTlH6I13QGAaOimw3lTyN5U0H+X38ubNmS4Q== X-Received: by 2002:aed:30ad:: with SMTP id 42mr290643qtf.88.1588194557429; Wed, 29 Apr 2020 14:09:17 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id x18sm228395qkn.107.2020.04.29.14.09.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2020 14:09:16 -0700 (PDT) From: Adhemerval Zanella Subject: Re: [PATCH v6 3/3] sysv: linux: Pass 64-bit version of semctl syscall To: libc-alpha@sourceware.org, Alistair Francis , Alistair Francis , Arnd Bergmann References: <20200428220507.3409362-1-alistair.francis@wdc.com> <20200428220507.3409362-4-alistair.francis@wdc.com> Autocrypt: addr=adhemerval.zanella@linaro.org; prefer-encrypt=mutual; keydata= mQINBFcVGkoBEADiQU2x/cBBmAVf5C2d1xgz6zCnlCefbqaflUBw4hB/bEME40QsrVzWZ5Nq 8kxkEczZzAOKkkvv4pRVLlLn/zDtFXhlcvQRJ3yFMGqzBjofucOrmdYkOGo0uCaoJKPT186L NWp53SACXguFJpnw4ODI64ziInzXQs/rUJqrFoVIlrPDmNv/LUv1OVPKz20ETjgfpg8MNwG6 iMizMefCl+RbtXbIEZ3TE/IaDT/jcOirjv96lBKrc/pAL0h/O71Kwbbp43fimW80GhjiaN2y WGByepnkAVP7FyNarhdDpJhoDmUk9yfwNuIuESaCQtfd3vgKKuo6grcKZ8bHy7IXX1XJj2X/ BgRVhVgMHAnDPFIkXtP+SiarkUaLjGzCz7XkUn4XAGDskBNfbizFqYUQCaL2FdbW3DeZqNIa nSzKAZK7Dm9+0VVSRZXP89w71Y7JUV56xL/PlOE+YKKFdEw+gQjQi0e+DZILAtFjJLoCrkEX w4LluMhYX/X8XP6/C3xW0yOZhvHYyn72sV4yJ1uyc/qz3OY32CRy+bwPzAMAkhdwcORA3JPb kPTlimhQqVgvca8m+MQ/JFZ6D+K7QPyvEv7bQ7M+IzFmTkOCwCJ3xqOD6GjX3aphk8Sr0dq3 4Awlf5xFDAG8dn8Uuutb7naGBd/fEv6t8dfkNyzj6yvc4jpVxwARAQABtElBZGhlbWVydmFs IFphbmVsbGEgTmV0dG8gKExpbmFybyBWUE4gS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qkvA+gNqSaK1NM9tY0eQ4iJpo+aoX8HAcn4sZzt2pfUB9vQMTBJ2d4+m/qO6+ cFTAceXmIoFsN8+gFN3i8Is3u12u8xGudcBPvpoy4OoG Message-ID: <3bec18bd-cbee-5853-2d36-df377b6cf7cf@linaro.org> Date: Wed, 29 Apr 2020 18:09:13 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428220507.3409362-4-alistair.francis@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-25.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 21:09:21 -0000 On 28/04/2020 19:05, Alistair Francis via Libc-alpha wrote: > The semctl_syscall() function passes a union semun to the kernel. The > union includes struct semid_ds as a member. On 32-bit architectures the > Linux kernel provides a *_high version of the 32-bit sem_otime and > sem_ctime values. These can be combined to get a 64-bit version of the > time. > > This patch adjusts the struct semid_ds to support the *_high versions > of sem_otime and sem_ctime. For 32-bit systems with a 64-bit time_t > this can be used to get a 64-bit time from the two 32-bit values. > > Due to alignment differences between 64-bit and 32-bit variables we > also need to set nsems to ensure it's correct. I think this approach might trigger an issue on semid_ds definition for time64 that I only noticed now. Since the idea of semctl is not use a different entrypoint neither to add aditional flag when issuing the syscall (either semctl or ipc), with this change we need to assure that __TIMESIZE == 32 sem_otime alignment matches __TIMESIZE == 64 one. However for semid_ds and msqid_ds time_t members can't not properly aligned to be expanded to 64-bit (shmid_ds has a shm_segsz field before the timestamp fields) due to the ipc_perm header consisting of 9 32-bit words except on parisc/powerpc/sparc. The alignment difference will make semctl once programs states build against a semid_ds with time_t being an 64-bit type. So we have 2 options here: 1. Keep the semid_ds layout as the kernel expected one and add the newer time64 timestamps at the *end*, and redefine the command arguments that passes a struct semid_ds to use (IPC_STAT, SEM_STAT, SEM_STAT_ANY) to indicate that the semid_ds is a time64 one. The IPC_64 bit might be a feasible hack since kernel won't use on possible new commands. 2. Add a new semctl64 to handle the time64 one semid_ds. > --- > .../unix/sysv/linux/hppa/struct__semid_ds32.h | 32 +++++++++++++ > .../unix/sysv/linux/mips/struct__semid_ds32.h | 30 ++++++++++++ > .../sysv/linux/powerpc/struct__semid_ds32.h | 32 +++++++++++++ > sysdeps/unix/sysv/linux/semctl.c | 47 +++++++++++++++++-- > .../sysv/linux/sparc/struct__semid_ds32.h | 32 +++++++++++++ > sysdeps/unix/sysv/linux/struct__semid_ds32.h | 32 +++++++++++++ > .../unix/sysv/linux/x86/struct__semid_ds32.h | 32 +++++++++++++ > 7 files changed, 233 insertions(+), 4 deletions(-) > create mode 100644 sysdeps/unix/sysv/linux/hppa/struct__semid_ds32.h > create mode 100644 sysdeps/unix/sysv/linux/mips/struct__semid_ds32.h > create mode 100644 sysdeps/unix/sysv/linux/powerpc/struct__semid_ds32.h > create mode 100644 sysdeps/unix/sysv/linux/sparc/struct__semid_ds32.h > create mode 100644 sysdeps/unix/sysv/linux/struct__semid_ds32.h > create mode 100644 sysdeps/unix/sysv/linux/x86/struct__semid_ds32.h > > diff --git a/sysdeps/unix/sysv/linux/hppa/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/hppa/struct__semid_ds32.h > new file mode 100644 > index 0000000000..9eceaaff2d > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/hppa/struct__semid_ds32.h > @@ -0,0 +1,32 @@ > +/* HPPA implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#if __WORDSIZE == 32 > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime_high; /* last semop() time high */ > + __syscall_ulong_t sem_otime; /* last semop() time */ > + __syscall_ulong_t sem_ctime_high; /* last time changed by semctl() high */ > + __syscall_ulong_t sem_ctime; /* last time changed by semctl() */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t __glibc_reserved3; > + __syscall_ulong_t __glibc_reserved4; > +}; > +#endif No need to define it for __WORDSIZE == 32, the ABI just supports it anyway. > diff --git a/sysdeps/unix/sysv/linux/mips/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/mips/struct__semid_ds32.h > new file mode 100644 > index 0000000000..2e3e2fc562 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/mips/struct__semid_ds32.h > @@ -0,0 +1,30 @@ > +/* MIPS implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#if __WORDSIZE == 32 > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime; /* last semop time */ > + __syscall_ulong_t sem_ctime; /* last change time */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t sem_otime_high; > + __syscall_ulong_t sem_ctime_high; > +}; > +#endif Ok, it cover mips64-n32 as well. > diff --git a/sysdeps/unix/sysv/linux/powerpc/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/powerpc/struct__semid_ds32.h > new file mode 100644 > index 0000000000..f509db5a02 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/powerpc/struct__semid_ds32.h > @@ -0,0 +1,32 @@ > +/* PowerPC implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#if __WORDSIZE == 32 > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime_high; /* last semop() time high */ > + __syscall_ulong_t sem_otime; /* last semop() time */ > + __syscall_ulong_t sem_ctime_high; /* last time changed by semctl() high */ > + __syscall_ulong_t sem_ctime; /* last time changed by semctl() */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t __glibc_reserved3; > + __syscall_ulong_t __glibc_reserved4; > +}; > +#endif Ok. > diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c > index 30571af49f..0634cc1abe 100644 > --- a/sysdeps/unix/sysv/linux/semctl.c > +++ b/sysdeps/unix/sysv/linux/semctl.c > @@ -22,8 +22,13 @@ > #include > #include > #include > +#include > #include /* For __kernel_mode_t. */ > > +#define IPC_TIME64 \ > + (__WORDSIZE == 32 && __TIMESIZE == 64 \ > + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) I think it would be better to move this definition to the common ipc_priv.h header since it will most likely be used on msgctl and shmctl y2038 support as well. > + > /* Define a `union semun' suitable for Linux here. */ > union semun > { > @@ -44,13 +49,47 @@ union semun > static int > semctl_syscall (int semid, int semnum, int cmd, union semun arg) > { > + int ret; > +#if IPC_TIME64 I think we shoul add a comment stating why we need a auxiliary buffer for STAT/STAT_ANY operations. Something like: A temporary buffer is used to avoid both an issue where the export semid_ds might not have follow kernel expected layout (due sem_{o,c}time alignment in 64-bit time case) and the issue where some kernel version might not clear the high bits when returning then sem_{o,c}time information. > + struct __semid_ds32 tmp; > + struct semid_ds *orig; > + bool restore = false; > + if (cmd == IPC_STAT || cmd == SEM_STAT || cmd == SEM_STAT_ANY) > + { > + tmp = (struct __semid_ds32) { > + .sem_perm = arg.buf->sem_perm, > + .sem_otime = arg.buf->sem_otime, > + .sem_ctime = arg.buf->sem_ctime, > + .sem_nsems = arg.buf->sem_nsems, > + }; We need to fully initialize the temporary struct to avoid a kernel issue fixed in 4693916846269d633a3664586650dbfac2c5562f (4.14) where kernel does not clear the timestamps high bits. > + orig = arg.buf; > + arg.buf = (struct semid_ds*)&tmp; Space before &tmp. > + restore = true; > + } > +#endif > + > #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS > - return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd | __IPC_64, > - arg.array); > + ret = INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd | __IPC_64, > + arg.array); > #else > - return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd | __IPC_64, > - SEMCTL_ARG_ADDRESS (arg)); > + ret = INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd | __IPC_64, > + SEMCTL_ARG_ADDRESS (arg)); > #endif Ok. > + > +#if IPC_TIME64 > + if (ret >= 0 && restore) > + { > + arg.buf = orig; > + arg.buf->sem_perm = tmp.sem_perm; > + arg.buf->sem_otime = tmp.sem_otime > + | ((time_t) tmp.sem_otime_high << 32); > + arg.buf->sem_ctime = tmp.sem_ctime > + | ((time_t) tmp.sem_ctime_high << 32); > + arg.buf->sem_nsems = tmp.sem_nsems; I think it would be better to use __time64_t explicit here. > + } > +#endif > + > + return ret; > } > > int > diff --git a/sysdeps/unix/sysv/linux/sparc/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/sparc/struct__semid_ds32.h > new file mode 100644 > index 0000000000..f641825d37 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/sparc/struct__semid_ds32.h > @@ -0,0 +1,32 @@ > +/* Sparc implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#if __WORDSIZE == 32 > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime_high; /* last semop() time high */ > + __syscall_ulong_t sem_otime; /* last semop() time */ > + __syscall_ulong_t sem_ctime_high; /* last time changed by semctl() high */ > + __syscall_ulong_t sem_ctime; /* last time changed by semctl() */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t __glibc_reserved3; > + __syscall_ulong_t __glibc_reserved4; > +}; > +#endif Ok. > diff --git a/sysdeps/unix/sysv/linux/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/struct__semid_ds32.h > new file mode 100644 > index 0000000000..51ff83206d > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/struct__semid_ds32.h > @@ -0,0 +1,32 @@ > +/* Generic implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#if __WORDSIZE == 32 > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime; /* last semop() time */ > + __syscall_ulong_t sem_otime_high; /* last semop() time high */ > + __syscall_ulong_t sem_ctime; /* last time changed by semctl() */ > + __syscall_ulong_t sem_ctime_high; /* last time changed by semctl() high */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t __glibc_reserved3; > + __syscall_ulong_t __glibc_reserved4; > +}; > +#endif Ok. > diff --git a/sysdeps/unix/sysv/linux/x86/struct__semid_ds32.h b/sysdeps/unix/sysv/linux/x86/struct__semid_ds32.h > new file mode 100644 > index 0000000000..f65c9fc877 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/x86/struct__semid_ds32.h > @@ -0,0 +1,32 @@ > +/* x86 implementation of the semaphore struct __semid_ds32. > + Copyright (C) 1995-2020 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#ifdef __i386__ > +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows > + the kernel to use {o,c}time{_high} values to support a 64-bit time_t. */ > +struct __semid_ds32 { > + struct ipc_perm sem_perm; /* operation permission struct */ > + __syscall_ulong_t sem_otime; /* last semop() time */ > + __syscall_ulong_t sem_otime_high; /* last semop() time high */ > + __syscall_ulong_t sem_ctime; /* last time changed by semctl() */ > + __syscall_ulong_t sem_ctime_high; /* last time changed by semctl() high */ > + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ > + __syscall_ulong_t __glibc_reserved3; > + __syscall_ulong_t __glibc_reserved4; > +}; > +#endif > Ok.