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 X-Patchwork-Id: 1248985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-110256-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=igZMimJ8; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=TacFPnJO; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48XYZ30tjYz9sP7 for ; Wed, 4 Mar 2020 23:47:38 +1100 (AEDT) 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=VIqmytKAa1TWZHxRo9OPLyCKu8vSJzy6RwDn+y7FR4sv+iCkRk93h j2ZtI1MrQZe++rkUY3Rwu6U9SIIh0iU5wvT/EvVPNrRxYTgoHPhX7Ablg6YqSt2A urdaG5N9wk4iIf/FZ1QB9DziXHcUXQuPO0Dmo43CBrbhjrGygW6G9E= 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=igZMimJ8EUvdrgXnwKYdbZWh0I39 U0CDlNvtZpUiZ51I+wmXazNLhTTFL9L1Gps9DzvVMPHo5Kp1N0BWLjNLvcuHmSh2 7HKzurh85hNUTBA9MrCdT9wyhbw/3pKU8BZYLSmPP8EPHgfDPTpKgsh2Iuq1PTnS IyrcWw+xGTaOnYk= 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== 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 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 X-Patchwork-Id: 1248986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-110257-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=mPh5//Un; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n6E3qeTi; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48XYZC1HZBz9sQt for ; Wed, 4 Mar 2020 23:47:46 +1100 (AEDT) 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=G80ndkinBOLWXBl16H5Nwwo5ccYJuby QgmWkRihzLfEvHOdJa7+KiPiKZqSfKaVUaAPHsEWfWAHQa0ZpuVjRYpAQP44plHx bNTa8CFJsE5AhtnOBFd4zXB+9YVEI7hp5skWSXFIvS6ehjYZ37jZ0D/hYfMM7iRy PJDhUUqi73pM= 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=mPh5/ /Unrse6hjOkiDYQxlxFSFe5wUzTc+A7rbTK9ceyOVXe0pf1XnpzYs0i6jtOI+yt1 yi20TTao+Xk0PrAXEmJJmLPClKf/YSFwTWJkTeMJ3gNtjox6g+0hQWxswvhGskKd /t2c1G03AbZb0+rcGQnrEMBQYkFqlXf+XdYs3I= 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== 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(-) 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; }