From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by sourceware.org (Postfix) with ESMTPS id 7915D3896815 for ; Thu, 30 Apr 2020 19:34:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7915D3896815 Received: by mail-pg1-x542.google.com with SMTP id o185so3329323pgo.3 for ; Thu, 30 Apr 2020 12:34:26 -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:subject:date:message-id:mime-version :content-transfer-encoding; bh=kBnMnzqZUFe48hUa+Q3tF2oDYL5PMRgoD56AudMAm6k=; b=r18gu/kJBucqLb1RQuSwwv9MxL147FMXwvGy2xgawTphrRG7Hyizxmk9TBbGWpH7U3 1Y7Tx8DLrZlCvTCxbPEQhnA5BnvjSJKnfl9dC3/2bdf/aMOuKM2RKcQ5hNLBgCP4eAD2 +XFym0ydzOWxBCj6qlrnr85BpocjgFZHfvFN7dLNKJdSJpGT3CwKKXd9hiHFfPqovKai vxkHqj4Kwmc506HaEP+w+P71xmqyF5OjWcrErYy4t3juQkdVbd2bK2lagMzC7cbpOfXt MAt3jDFoN97KKAERTFVUjVXZzF8eMntMODDW9hwRJMX0JY3Db1mE8AzRwW46zcQ+sM/P O6ig== X-Gm-Message-State: AGi0PuZIzsb4sjyB3zhWkX21mRBLqCZUcbASOsHCiWbtJfk9tvepXl5h IGbsEKrrjvq69as61Gh9TLcf9rrX X-Google-Smtp-Source: APiQypK/UO7ewW6Kk7OOYuihH3BgjRTe2arbhz7reS8YNP/cnYq989c/puFzM7KOroUjN3efEd/bZQ== X-Received: by 2002:a62:fc15:: with SMTP id e21mr327798pfh.79.1588275265297; Thu, 30 Apr 2020 12:34:25 -0700 (PDT) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id n3sm457771pfa.218.2020.04.30.12.34.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:34:24 -0700 (PDT) Received: from gnu-cfl-2.localdomain (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id E927F1A011B for ; Thu, 30 Apr 2020 12:34:23 -0700 (PDT) From: "H.J. Lu" To: libc-stable@sourceware.org Subject: [2.31/2.30] [PATCH 0/6] Properly pass long to syscall [BZ #25810/#25896] Date: Thu, 30 Apr 2020 12:34:17 -0700 Message-Id: <20200430193423.807713-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-17.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 19:34:29 -0000 X32 has 32-bit long and pointer with 64-bit off_t. Since x32 psABI requires that pointers passed in registers must be zero-extended to 64bit, x32 can share many syscall interfaces with LP64. When a LP64 syscall with long and unsigned long arguments is used for x32, these arguments must be properly extended to 64-bit. Otherwise if the upper 32 bits of the register have undefined value, such a syscall will be rejected by kernel. This patch set backports fixes from master branch to properly extend long argument to long long before passing it to syscall for x32. It also adds a C wrapper to pass arguments in /* Control process execution. */ extern int prctl (int __option, ...) __THROW; to prctl syscall: extern int prctl (int, unsigned long int, unsigned long int, unsigned long int, unsigned long int); I will check it into 2.31 and 2.30 branches next Thursday. H.J. Lu (6): x32: Properly pass long to syscall [BZ #25810] Add SYSCALL_ULONG_ARG_[12] to pass long to syscall [BZ #25810] Add a syscall test for [BZ #25810] Mark unsigned long arguments with U in more syscalls [BZ #25810] Add C wrappers for process_vm_readv/process_vm_writev [BZ #25810] Add a C wrapper for prctl [BZ #25896] include/sys/prctl.h | 1 + misc/Makefile | 2 +- misc/tst-syscalls.c | 167 ++++++++++++++++++++ sysdeps/unix/make-syscalls.sh | 24 +++ sysdeps/unix/syscall-template.S | 49 +++++- sysdeps/unix/syscalls.list | 22 +-- sysdeps/unix/sysv/linux/Makefile | 4 +- sysdeps/unix/sysv/linux/prctl.c | 42 +++++ sysdeps/unix/sysv/linux/process_vm_readv.c | 32 ++++ sysdeps/unix/sysv/linux/process_vm_writev.c | 32 ++++ sysdeps/unix/sysv/linux/syscalls.list | 41 +++-- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 86 +++++++--- sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 35 ++++ 13 files changed, 479 insertions(+), 58 deletions(-) create mode 100644 misc/tst-syscalls.c create mode 100644 sysdeps/unix/sysv/linux/prctl.c create mode 100644 sysdeps/unix/sysv/linux/process_vm_readv.c create mode 100644 sysdeps/unix/sysv/linux/process_vm_writev.c -- 2.26.2