From patchwork Wed Mar 4 12:47:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 184172 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4851488ile; Wed, 4 Mar 2020 04:47:41 -0800 (PST) X-Google-Smtp-Source: ADFU+vvoFqDRn+1nT3KUwcA/Ts/ynjsT4KHpEpq/dlDH7Cs2lEh2nbVLFIjf2Ng2XxeUhLGrx+Gc X-Received: by 2002:a9d:75d7:: with SMTP id c23mr1286817otl.73.1583326060998; Wed, 04 Mar 2020 04:47:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583326060; cv=none; d=google.com; s=arc-20160816; b=zTnoJ4FsvKtj1Glm+AZmYQDbPO8KbHYVrrhI4i+gszU9rOZ4rzCGdy3EI5R2+thX+k qvTY3tDhIaZE420XGYHBo2e1PyHYBZm3r9W4JZijflLnVOjVlrjD1jN1vEqCtBW6AIg0 IZu5KgbLcICHTq0CN/Cs0Tebd4tmdAcwkpV7o9rYtdzsObbTduxkfldxqJiN5sJe+rYg E2C7JFpnHfPEBb4K93A6n9yt6lbdJBdGi8fkTLOsyymRfzvYVCHJTZF4tMF6zs7ZMXoV 6Dd/OIi4mAnE2xPCGsNE/RoD7Hz9KnirVNwkSEjtNEDJJsNrCLg3iqaeq4m8RHYYe+nt PL5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=vPCXv5u/N7CrrcN6swYWuUuSAtZfxEgwjU8FtImeW9Y=; b=kddPrqOrhc4N7Yl/WAyYEs2yVWhHIzHFjB4P1u9Upr16pIqibRbNNsvvQrPX3ZrO4n qHAszIdcOksnRiMgZG4nQUbyLDyEki7M4Cs1WOQB5PII9qOyXyC2NkAXY5gbzEfeAU37 CwOpUGwhxvgoSrfjcfzNhzFPOL6Xgc9L7NXPJCxBLojg2cYQ5AdMnzafGd4TM5CJbjbg qPO++STMJ2j+Vp3X2I9pRPO/ur/6aAo/RLX04zQ6J25P77LU2VBV2TJ9S/OJTEDfqYNC edyQaTp3KLPnuvyV+0K2bS1v454MWVsCG097kuRFpse6uNXifrKfoHavRrvehbSfhd+a zeHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=oXGxS1Be; dkim=pass header.i=@linaro.org header.s=google header.b=TacFPnJO; spf=pass (google.com: domain of libc-alpha-return-110256-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-110256-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d23si1121360oij.270.2020.03.04.04.47.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2020 04:47:40 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-110256-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=oXGxS1Be; dkim=pass header.i=@linaro.org header.s=google header.b=TacFPnJO; spf=pass (google.com: domain of libc-alpha-return-110256-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-110256-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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:subject:date:message-id; q=dns; s= default; b=DXywD1egKuOAGIFG4+RsxEBq7S1FOc40rb8MtzhpgBHOc16as4sTm M0UY21+Z9xG9niVB1Z8xpAElx3EatzJY3myb2HB3nzNkHYJChH4ZqMm2ZOGouaao lJoIibGGpOjxjAZMI4ZB/mjxuzh/4VzaSt+87PWvVk21PI87uU2TH0= 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:subject:date:message-id; s=default; bh=hK21Eh/QSij8HoTUOYi1ouHwd4c=; b=oXGxS1Bew731oPJGeghuCQZKVPgl yF6p87mN6OOBAhUTRn/cldd3nRo3OGD7dT+fe3tKQRLKO+yRBLXBbFAcb4hZaPIZ bM5uTfXJBDYFVZLvzUj6z3C4RZq970rVLHjw+fyh4yrkQKKRxRxiTnsBqtQUjOoZ bZw+CmO0cK5r7q4= Received: (qmail 6752 invoked by alias); 4 Mar 2020 12:47:32 -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 6720 invoked by uid 89); 4 Mar 2020 12:47:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f170.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=vPCXv5u/N7CrrcN6swYWuUuSAtZfxEgwjU8FtImeW9Y=; b=TacFPnJOvF9o+4NbDU/+DGo18Sy3ijfdig7TCYCeQ3dqFmaQ32i7QeTOt5C68KBwJA C5J50QL2yN3gKHvdqWfKl28ZRZ9I9x7il5pfbCAQfTLNwJLJPEA2+c6aVzH/rs+YOUDI WwKusCbvqJe1jpuQNhOj0XqaPWWnneAYSmONrx8DYouMvN+kWM8JY+pLT6oWrEr7Z6cj IzVuNCrp4vWEc21K//9Swkw2IFUk6s2TVPkwAw/RPMNldXV7HD1O8ciqL3QHw9Os7Z2x L6vGHfRTsPg5+4bft1US3HxczF/zuMRrO5mHsJ7ko7BpevkDozJPauDj+oyQmjPRiXTr iZ1Q== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 1/2] linux: Remove aarch64 ipc_priv.h Date: Wed, 4 Mar 2020 09:47:22 -0300 Message-Id: <20200304124723.1334-1-adhemerval.zanella@linaro.org> Changed from previous version: - Split the change on its own patch. --- The aarch64 ipc_priv.h is superflous since __ASSUME_SYSVIPC_DEFAULT_IPC_64 is now defined as default. --- sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h b/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h deleted file mode 100644 index 07a1c3a7d3..0000000000 --- a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Old SysV permission definition for Linux. AArch64 version. - Copyright (C) 2016-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 - . */ - -#include /* For __key_t */ - -#define __IPC_64 0x0 From patchwork Wed Mar 4 12:47:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 184173 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4851591ile; Wed, 4 Mar 2020 04:47:50 -0800 (PST) X-Google-Smtp-Source: ADFU+vtlB5dK+bCBqTcit8WPmhRBlmh2/4PQ5/C5ckwtNEEGCaQoMJ3HgzmWuFgDn/LUBsUlYHd9 X-Received: by 2002:a9d:5e8b:: with SMTP id f11mr2262899otl.110.1583326070398; Wed, 04 Mar 2020 04:47:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583326070; cv=none; d=google.com; s=arc-20160816; b=IcyQYKXSVK9Xe8joa0nEUDAL87Dgo+gUWqWqjDRk5Kmj5esaIn0BmxDaeOYj1iCqqb lTROT7Y0e8pSNy5qcsBfItn1mCSFVx2+3CXUgUY4iM2oiitFd5STeuCN2kWyHL/KKBY6 7j0NzqkbotCENaTJRsDvTlqndelmlerQIrkDKShEzezT4Q+SKGgMMUMRn3bQkim1ZMjR B5atT15FOi41O5GqnLOePBgcdQjCr7x8x+j6K/wuVYiVa0dvvoJHVV+3cjlU8zjNNsRt XsZUYuvkxKfP0uhmMU8ISK1U1N46RwVBJNLl/sJ8Bl9ivpp9m1jdslq2AcS7DHMTbFBz RSgQ== 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:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=pQgxWRBK+Uk8elIvwSuHLOHkFQtQDWO21bNIrkC6jFM=; b=VOFEmVEzCPrJfr2ujI/h7oV4oMCsm+U3Xs+AOgPSwTdQ+pm3PeZLBU7ejDdijGmRsu V3W6G9konA/7D+JD/De7numV7t6nWO65yA3QfPyjkGjcR5pshecOHo0pTUnZF9qZHkXJ xwMOdQ0TXZkrJQN4MC9Xnn/c3sN32B0LjHrLJWEyM+GpwoI2TCsO0nTfwSYOyIMzWkIO vpn9yosyKa+rJBBK84/ttx9vXKGRktAw2ECq8Go7BeXW/Ldbm5tGlHbBgBDlYypfqy2+ cBBpwJb5BisUWCRl+PR1RB2vbHuUdDo9E9Y86/yhwrzU2WKUK5THncS6yXUFEGxM+b4c jNpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=oplU7KBL; dkim=pass header.i=@linaro.org header.s=google header.b=n6E3qeTi; spf=pass (google.com: domain of libc-alpha-return-110257-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-110257-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u205si1083264oie.125.2020.03.04.04.47.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2020 04:47:50 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-110257-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=oplU7KBL; dkim=pass header.i=@linaro.org header.s=google header.b=n6E3qeTi; spf=pass (google.com: domain of libc-alpha-return-110257-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-110257-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=IZAZ0Yiy1uVtm2KaGIAGzuyakzwImIv /erFFef1mjnjZVNSkbRKAQk2avsP3lsntdce/IUhd4gQwu/6g0/FPHD5SljnZ/cG fLcRHYef/hZ7IVkuBM4qkjtX4FpoYFra6XuzF/fcQ4azl3LZfjpWESiqFN+M0yMs IKoPaszPdM4k= 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:subject:date:message-id:in-reply-to :references; s=default; bh=hvznsFUWMyUWVf6vpyJFnCFP6x4=; b=oplU7 KBLXuYmRJ8aLg6b5enKjAgO6hBfq6fCnCKNvtVQOtrjFLhCXJxKH3g04mSAG/rnZ 7In/3eIiveXwlSU77c2FdgzOFnI2pb++hhMyrcIG3oBMm0f6v9+QyS2geJYwLXPl S/1yl+Kpn2B8CP7/mRpTQ2wl6YxvEFmLxSLl28= Received: (qmail 6938 invoked by alias); 4 Mar 2020 12:47:33 -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 6876 invoked by uid 89); 4 Mar 2020 12:47:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*RU:209.85.222.195, HX-Spam-Relays-External:209.85.222.195 X-HELO: mail-qk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=pQgxWRBK+Uk8elIvwSuHLOHkFQtQDWO21bNIrkC6jFM=; b=n6E3qeTitXKNckKPdYHsUAiop84p2JNeAUM7afvnpn/YBtgob8ETWoBiIGsXbrmRGE PDEVMUhtwHcX+/wi24YOrgbTxke4I5j5vp1d+Z6tI8pYAXpGQNUB6BD01DHpRpEI34Zf VdZMSrsLVB7wQj2EbRtU4nVtysMDKKHBBWNcpyiSUwfWzbdHpoDlylch0OdEACA3vJfk jWm0Gx0QiIMinSeh7AYgzsozfqsYMwvwDORWffuK6ILTIkTSsvVjo5xixV0uoj0RfNi8 PcB+fzCrYOUWqwKH3+NTW/aND/4d6wrDHYiYXgucfkip0C8aVjIakZ7TgLE9OtR/Ro03 zWCA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 2/2] linux: Clear mode_t padding bits (BZ#25623) Date: Wed, 4 Mar 2020 09:47:23 -0300 Message-Id: <20200304124723.1334-2-adhemerval.zanella@linaro.org> In-Reply-To: <20200304124723.1334-1-adhemerval.zanella@linaro.org> References: <20200304124723.1334-1-adhemerval.zanella@linaro.org> Changes from previous version: - Fixed sizeof check and use __kernel_mode_t. -- The kernel might not clear the padding value for the ipc_perm mode fields in compat mode (32 bit running on a 64 bit kernel). It was fixed on v4.14 when the ipc compat code was refactored to move (commits 553f770ef71b, 469391684626, c0ebccb6fa1e). Although it is most likely a kernel issue, it was shown only due BZ#18231 fix which made all the SysVIPC mode_t 32-bit regardless of the kABI. This patch fixes it by explicit zeroing the upper bits for such cases. The __ASSUME_SYSVIPC_BROKEN_MODE_T case already handles it with the shift. (The aarch64 ipc_priv.h is superflous since __ASSUME_SYSVIPC_DEFAULT_IPC_64 is now defined as default). Checked on i686-linux-gnu on 3.10 and on 4.15 kernel. --- sysdeps/unix/sysv/linux/msgctl.c | 9 +++++++-- sysdeps/unix/sysv/linux/semctl.c | 9 +++++++-- sysdeps/unix/sysv/linux/shmctl.c | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c index 27879e76cd..eb28835b3a 100644 --- a/sysdeps/unix/sysv/linux/msgctl.c +++ b/sysdeps/unix/sysv/linux/msgctl.c @@ -61,7 +61,6 @@ __new_msgctl (int msqid, int cmd, struct msqid_ds *buf) int ret = msgctl_syscall (msqid, cmd, buf); -#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T if (ret >= 0) { switch (cmd) @@ -69,10 +68,16 @@ __new_msgctl (int msqid, int cmd, struct msqid_ds *buf) case IPC_STAT: case MSG_STAT: case MSG_STAT_ANY: +#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T buf->msg_perm.mode >>= 16; +#else + /* Old Linux kernel versions might not clear the mode padding. */ + if (sizeof ((struct msqid_ds){0}.msg_perm.mode) + != sizeof (__kernel_mode_t)) + buf->msg_perm.mode &= 0xFFFF; +#endif } } -#endif return ret; } diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c index 0c3eb0932f..0a79e8e4f5 100644 --- a/sysdeps/unix/sysv/linux/semctl.c +++ b/sysdeps/unix/sysv/linux/semctl.c @@ -92,7 +92,6 @@ __new_semctl (int semid, int semnum, int cmd, ...) int ret = semctl_syscall (semid, semnum, cmd, arg); -#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T if (ret >= 0) { switch (cmd) @@ -100,10 +99,16 @@ __new_semctl (int semid, int semnum, int cmd, ...) case IPC_STAT: case SEM_STAT: case SEM_STAT_ANY: +#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T arg.buf->sem_perm.mode >>= 16; +#else + /* Old Linux kernel versions might not clear the mode padding. */ + if (sizeof ((struct semid_ds){0}.sem_perm.mode) + != sizeof (__kernel_mode_t)) + arg.buf->sem_perm.mode &= 0xFFFF; +#endif } } -#endif return ret; } diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c index 39fa861e17..aed9e5260e 100644 --- a/sysdeps/unix/sysv/linux/shmctl.c +++ b/sysdeps/unix/sysv/linux/shmctl.c @@ -63,7 +63,6 @@ __new_shmctl (int shmid, int cmd, struct shmid_ds *buf) int ret = shmctl_syscall (shmid, cmd, buf); -#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T if (ret >= 0) { switch (cmd) @@ -71,10 +70,16 @@ __new_shmctl (int shmid, int cmd, struct shmid_ds *buf) case IPC_STAT: case SHM_STAT: case SHM_STAT_ANY: +#ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T buf->shm_perm.mode >>= 16; +#else + /* Old Linux kernel versions might not clear the mode padding. */ + if (sizeof ((struct shmid_ds){0}.shm_perm.mode) + != sizeof (__kernel_mode_t)) + buf->shm_perm.mode &= 0xFFFF; +#endif } } -#endif return ret; }