From patchwork Fri May 1 22:17:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 38903 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1364D3938C15; Fri, 1 May 2020 22:17:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1364D3938C15 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588371470; bh=ScMbIo1rgf3JMzdmX/Zw0F0+BHalHzejrWPNnxWIYH4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VjCvnRTTGls268K9yfNqFvUkeCKWAvXnNhICFk7VYxoVfVXohx6zRd4r4N5Rq4QrL 64uIAg8dUlUeCEdMkkZOBgeQiJknBYK3Xpmh5O1cjBpCJyrVQpNzJ/S4aJbyt80Pwl 4OoIV8PLxjZFW6Z3SVNHBk0iR8y2eOv94wbwDplo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by sourceware.org (Postfix) with ESMTPS id 665C83938C15 for ; Fri, 1 May 2020 22:17:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 665C83938C15 Received: by mail-pl1-x643.google.com with SMTP id s20so4107786plp.6 for ; Fri, 01 May 2020 15:17:47 -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:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ScMbIo1rgf3JMzdmX/Zw0F0+BHalHzejrWPNnxWIYH4=; b=g29UfFP8z+o/vsw2sZdNlLoTDUzEbOUzQWOcdI3twPgUUoqlmv2JxzDNP0SGnpfV+n RbfPYpS2WwP6NJv5xjxXV8piEAcVKu35B7jDhmjJeXb0dbHkWaTt3i2GL7IIWW1z4jpc UBMd5dxm1qdGhxksj6VDJ9yLNTXcY6wgcwJLi+3dfrUjpexD3Zw3KQ0Z0lvbbLBNOS9e 9SQeKaZhLJVE9oyCmxphHpcN1owI0RjAZlXMsGGk3tUbJBJYcSa68VUYFEl20sD4mudL TOGbPq15wnj5g7sTWCfScwm8fJB5+cbC4DpbuEbGbgsxFdhbC74K3D+xsrVgcqTHTBmq TXrw== X-Gm-Message-State: AGi0PuY8xi+rRxwJb0lcTFEuGAOQ/fnMqh5Xa2nppPUqSzuGxKNA+lQn ubT9mTaiGfQUljb8PIfSrRASlLAk X-Google-Smtp-Source: APiQypKBOhl7DgXrp1MGSiJ+5gPdL8Nr5ww1iEWw1RxRlfB2FwM+ujwugbokIFr70o8fZbP52g/1Sw== X-Received: by 2002:a17:90a:5b:: with SMTP id 27mr2225656pjb.190.1588371465782; Fri, 01 May 2020 15:17:45 -0700 (PDT) Received: from localhost (g19.222-224-154.ppp.wakwak.ne.jp. [222.224.154.19]) by smtp.gmail.com with ESMTPSA id m14sm2770185pgk.56.2020.05.01.15.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 15:17:44 -0700 (PDT) To: GLIBC patches Subject: [RFC PATCH] sysvipc: Fix handling of direct syscalls Date: Sat, 2 May 2020 07:17:33 +0900 Message-Id: <20200501221733.14456-1-shorne@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-25.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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-Patchwork-Original-From: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Working on the OpenRISC port I get an error that __NR_ipc is not defined using the default kernel-features.h with kernel 5.7. It seems this would also impact riscv and csky that also do not do any special SYSVIPC defines or use __NR_ipc. Compiler output: In file included from ../sysdeps/unix/sysv/linux/msgctl.c:21: ../sysdeps/unix/sysv/linux/msgctl.c: In function '__old_msgctl': ../sysdeps/unix/sysv/linux/or1k/sysdep.h:23:34: error: '__NR_ipc' undeclared (first use in this function) 23 | #define SYS_ify(syscall_name) (__NR_##syscall_name) | ^~~~~ ../sysdeps/unix/sysv/linux/or1k/sysdep.h:103:35: note: in definition of macro 'INTERNAL_SYSCALL_NCS' 103 | long _sc_ret = (long) number; \ | ^~~~~~ ../sysdeps/unix/sysv/linux/or1k/sysdep.h:96:24: note: in expansion of macro 'SYS_ify' 96 | INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) | ^~~~~~~ ../sysdeps/unix/sysv/linux/sysdep.h:43:23: note: in expansion of macro 'INTERNAL_SYSCALL' 43 | long int sc_ret = INTERNAL_SYSCALL (name, nr, args); \ | ^~~~~~~~~~~~~~~~ ../sysdeps/unix/sysdep.h:71:3: note: in expansion of macro 'INLINE_SYSCALL' 71 | INLINE_SYSCALL (name, 5, a1, a2, a3, a4, a5) | ^~~~~~~~~~~~~~ ../sysdeps/unix/sysdep.h:27:37: note: in expansion of macro '__INLINE_SYSCALL5' 27 | #define __SYSCALL_CONCAT_X(a,b) a##b | ^ ../sysdeps/unix/sysdep.h:28:37: note: in expansion of macro '__SYSCALL_CONCAT_X' 28 | #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) | ^~~~~~~~~~~~~~~~~~ ../sysdeps/unix/sysdep.h:81:3: note: in expansion of macro '__SYSCALL_CONCAT' 81 | __SYSCALL_CONCAT (b,__INLINE_SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) | ^~~~~~~~~~~~~~~~ ../sysdeps/unix/sysdep.h:89:3: note: in expansion of macro '__INLINE_SYSCALL_DISP' 89 | __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~ ../sysdeps/unix/sysv/linux/msgctl.c:127:10: note: in expansion of macro 'INLINE_SYSCALL_CALL' 127 | return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf); --- sysdeps/unix/sysv/linux/msgctl.c | 8 ++------ sysdeps/unix/sysv/linux/semctl.c | 9 +++------ sysdeps/unix/sysv/linux/shmctl.c | 8 ++------ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c index fd46aec1a0..a49c1e81fa 100644 --- a/sysdeps/unix/sysv/linux/msgctl.c +++ b/sysdeps/unix/sysv/linux/msgctl.c @@ -117,12 +117,8 @@ int attribute_compat_text_section __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf) { -#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ - && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 - /* For architecture that have wire-up msgctl but also have __IPC_64 to a - value different than default (0x0) it means the compat symbol used the - __NR_ipc syscall. */ - return INLINE_SYSCALL_CALL (msgctl, msqid, cmd, buf); +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf); #else return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf); #endif diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c index 30571af49f..ba3d0b206c 100644 --- a/sysdeps/unix/sysv/linux/semctl.c +++ b/sysdeps/unix/sysv/linux/semctl.c @@ -174,12 +174,9 @@ __old_semctl (int semid, int semnum, int cmd, ...) break; } -#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ - && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 - /* For architectures that have wire-up semctl but also have __IPC_64 to a - value different than default (0x0) it means the compat symbol used the - __NR_ipc syscall. */ - return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array); +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd | __IPC_64, + arg.array); # else return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd, SEMCTL_ARG_ADDRESS (arg)); diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c index f41b359b8b..c97db208c6 100644 --- a/sysdeps/unix/sysv/linux/shmctl.c +++ b/sysdeps/unix/sysv/linux/shmctl.c @@ -117,12 +117,8 @@ int attribute_compat_text_section __old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf) { -#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS \ - && !defined __ASSUME_SYSVIPC_DEFAULT_IPC_64 - /* For architecture that have wire-up shmctl but also have __IPC_64 to a - value different than default (0x0), it means the compat symbol used the - __NR_ipc syscall. */ - return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf); +#if defined __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return INLINE_SYSCALL_CALL (shmctl, shmid, cmd | __IPC_64, buf); #else return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf); #endif