From patchwork Thu Jun 20 16:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805992 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp377328wrt; Thu, 20 Jun 2024 09:23:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8fVUv/ZlvFlSlUJS6jE2IWCAHurPMrjDD6iP17ogO7VHSo2gbgzEirW0xHjw/4c9PFbLJdBXyKZL0qoohpctJ X-Google-Smtp-Source: AGHT+IHx4v6YlQF+UqNiZ7q1jDWuZ1uIBsj6c9dCXe9YAAjtAi9NxQZOIuBQwMbPmKIvqBMTSk+H X-Received: by 2002:a05:6102:731:b0:48f:1adb:7e53 with SMTP id ada2fe7eead31-48f1adb7f43mr3931109137.19.1718900637025; Thu, 20 Jun 2024 09:23:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900637; cv=pass; d=google.com; s=arc-20160816; b=sDFQso9/Er08dw5z4/iAsSz8X93+725MTMsKcvHz1Dnj02bIt6ZicMXxY3sQP/Sx4S BblexK1naNhhXDaymJGbctWYoNeYedNHvv36Rt1SAd5gbw2HIlDdlbtvQtAYxjyFDw+L Vk7oIyU6n8/odNCsKWQ3VrHn8rrkLHxYS4lNn2wIRbUDPUFXAY1VSRsb+TaVidH+ZgAe PCe+EeRw5+LaWt0YuvX5w1Iae07qBCRt6gVe3P//ZjUjLgo/9s20bR3qJwJrvrXZlu+4 B2yCn70DBEOIjan6vbg22JdXhyfhkjkb0+FZrql8dFt6auVIpeU3kS3TqOzDMAaf6znC r1Dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=freZwdYkoNbt2Gm5oN6bpYmbUQak+DSrOR1RtO0rwbk=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=R1SXy11z7QCErMldbt/XTj6WBhAXPsk/CY/QhOS2P2tOYFO2z0gvq5pzlUs9EVAN/L vaGo9G84mJFvL+V5GSGgXXEFAbJPLbn/8tHDOfZ+j+fQGtvklK7Bw3Vf26IbArUwaXnV bk34idogQ3JGiisHOsuUGY3lOaaUuJDEOIseWJDWnevRhLjXDKXk2Bcc0G6hgvb5c9+n 1NpTtnoSmXNe9A01y+f9+B8Ae54gJzm2tHabz6HYASwvNd3O8YvwqfRTfiLPy2RYjkQy SBGo87H1nlp+H49/fhPXdk0sodqNlKTPBjynmgX1QTFcI2Qf0Ww34xxgeFr0kvZkwuxA awYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qFPMZFuI; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ada2fe7eead31-48da43b86f2si2647195137.181.2024.06.20.09.23.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:23:56 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qFPMZFuI; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D99A3893646 for ; Thu, 20 Jun 2024 16:23:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id 371AC3890431 for ; Thu, 20 Jun 2024 16:23:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 371AC3890431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 371AC3890431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:4641:c500::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900624; cv=none; b=x+G0iKjT5kKGz/yEqKxFLXDqpgByDvJBuS9+1RcgsM/6gAf+syqabj6+Y1gCkYqIUyki7pT5lKSfn+zcY2Lq2Ag8V3RcZcegP3WvEYpsLmLTtZRkrlWNFsmRznPHcfbbrheTBTGsPBpzgHoWl89pcYHHmNofpHL/gXN0/uB1CzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900624; c=relaxed/simple; bh=CGFeZxnM99WO8CUQsmcPRyeSqTluGP6wK4tt26wo7MA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=buuWaeo31TI6m6Yf0YHyZivZJ2H+UGMHZPWNrKStcFEYEcbFxXP/V3fa9hEgfmyf79PPIBgX+WlpUd2QMTrwbFxGhGF/eUZIjI1hDaTAk6o1Q3/LMN2DpECJLkCxAr7WGsyyu6OIjJR7V8pEMRFK7CZc8u1C2ERu5QbV0hjVO/A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BBACF62097; Thu, 20 Jun 2024 16:23:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2418C4AF09; Thu, 20 Jun 2024 16:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900622; bh=CGFeZxnM99WO8CUQsmcPRyeSqTluGP6wK4tt26wo7MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFPMZFuIa5R0Glf5ENc2BYFqZfPhYo8QIZnyrdimQlTBKvaHbuCtPvrIfomllEd9/ JpLNq2SDbtHqlJyuLH0dQP8moKiF8uhmumJYs9o2sBsCPGtMQKxsjkvFceJbD2sCe5 iqYfcls+BOXFi8S8pRjY7giMA82l1MsB4/7AAhWDtByCl8OAAtDGML8o/+To3bUkRa PuTTC4pDoNbmyoCTObOuXs8R+JSz0u0eYIhSXe0Dmh5XnqLbr+7IhR9P908xkYXNwP ZamhH6pESgfZ6DKzg3bZRZInz7WGQ0gGLigYJa47XVNNvrSHskhf5n0cIAxbD+morq YgXJDRrkqY+ZA== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 01/15] ftruncate: pass a signed offset Date: Thu, 20 Jun 2024 18:23:02 +0200 Message-Id: <20240620162316.3674955-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann The old ftruncate() syscall, using the 32-bit off_t misses a sign extension when called in compat mode on 64-bit architectures. As a result, passing a negative length accidentally succeeds in truncating to file size between 2GiB and 4GiB. Changing the type of the compat syscall to the signed compat_off_t changes the behavior so it instead returns -EINVAL. The native entry point, the truncate() syscall and the corresponding loff_t based variants are all correct already and do not suffer from this mistake. Fixes: 3f6d078d4acc ("fix compat truncate/ftruncate") Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann Reviewed-by: Christian Brauner --- fs/open.c | 4 ++-- include/linux/compat.h | 2 +- include/linux/syscalls.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/open.c b/fs/open.c index 89cafb572061..50e45bc7c4d8 100644 --- a/fs/open.c +++ b/fs/open.c @@ -202,13 +202,13 @@ long do_sys_ftruncate(unsigned int fd, loff_t length, int small) return error; } -SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) +SYSCALL_DEFINE2(ftruncate, unsigned int, fd, off_t, length) { return do_sys_ftruncate(fd, length, 1); } #ifdef CONFIG_COMPAT -COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length) +COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_off_t, length) { return do_sys_ftruncate(fd, length, 1); } diff --git a/include/linux/compat.h b/include/linux/compat.h index 233f61ec8afc..56cebaff0c91 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -608,7 +608,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf); asmlinkage long compat_sys_truncate(const char __user *, compat_off_t); -asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t); +asmlinkage long compat_sys_ftruncate(unsigned int, compat_off_t); /* No generic prototype for truncate64, ftruncate64, fallocate */ asmlinkage long compat_sys_openat(int dfd, const char __user *filename, int flags, umode_t mode); diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 9104952d323d..ba9337709878 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -418,7 +418,7 @@ asmlinkage long sys_listmount(const struct mnt_id_req __user *req, u64 __user *mnt_ids, size_t nr_mnt_ids, unsigned int flags); asmlinkage long sys_truncate(const char __user *path, long length); -asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); +asmlinkage long sys_ftruncate(unsigned int fd, off_t length); #if BITS_PER_LONG == 32 asmlinkage long sys_truncate64(const char __user *path, loff_t length); asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); From patchwork Thu Jun 20 16:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805993 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp377410wrt; Thu, 20 Jun 2024 09:24:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDy7Ryketj2iXmbIFuEhOQ6yrRe8YGFmBSTQIq6E5AobkNkFZPYTdUTMlH2UdRLAVPTSE9G6TQMIYBF4qGmQIW X-Google-Smtp-Source: AGHT+IHmtK31f6HCHJZpSHAs0W42pTUodVa6TxbgaF/5BszQcs6k21uq9YdmcBcPQrXCzMoO8VVa X-Received: by 2002:a05:6102:5898:b0:48d:9550:ac55 with SMTP id ada2fe7eead31-48f12fb189cmr6306391137.7.1718900646546; Thu, 20 Jun 2024 09:24:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900646; cv=pass; d=google.com; s=arc-20160816; b=kBb+RR92u+dipAmUPVajkPeHGzI4j6Pry3UOutJMI1p+tYmRDZoLXaJf8Oluz35d4g Ahf0exmG+6j5Wl12jEGOwDUs2cFhSrrhssYoSfGSoXgQR7smAKQu78+l7eR1/5+brW8C DCi0zvZrQMNs6utFM/J527fA/OC9Z348ioXEyXa5gRMpBUFNSXGOxCLrXE1hLAiK5O4J cJqB2aU771fMlckd1V1AKzyJMtLBV529WyvzRd49xoUN9gQfk3nt2mEUcQx8Jc3CfJ02 EmTWbo6K7x6YN+t/kuJ3MyRFIFbnJJNZJpD0Ye9rq90KxAlUFBVMige19vjvk1zNsEZO TW0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=rOCGU7IBzfaXGh+znWv7E19VZCSaVAQlgAK2WnsAJKs=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=Lo1JiWw7S1iCWcVl96RFuKB9klPIGUi+iUQGaLI79uYZirkmvnJsQUwPegcdVXbPPZ xXBokcj5+cdDDKaHR//zSNka8nkIalzyMgn5pdP7QsZop9ReJr4rzKouk6ribon0uP8S VMpO++wXDlX/OxyeVamQYxdyvF9rwKJVvP2jXs0TgpY/7Qnq/NUjhRDb3yWjCdMsrhIq QRYyIQTMXom+XHDJnAman3/Niz6IAyFMO/5MHRlSvB9PeQv8Hs7LYdWvGWEop1zsgsDt cZ7jgU4n6w8a07/rixKtze8NmHlyBFRj21hf+NGaUyuKwMSg7oGsJY8EfmK88fyEBqwO RV7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gp1OfiOJ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ada2fe7eead31-48da43c4f40si2567443137.203.2024.06.20.09.24.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:24:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gp1OfiOJ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F38AC389245E for ; Thu, 20 Jun 2024 16:24:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id AD2B43893644 for ; Thu, 20 Jun 2024 16:23:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD2B43893644 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AD2B43893644 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:40e1:4800::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900635; cv=none; b=UY2XTwyokgRhB7WrZJG1y7e7jPErEs7KOp6c4d+8ZiaxyrsVpaDH5iUCMVjayqQwP0GjnxjCpM0ayQnOXFBGXH02Rhb/QqdQblmsIA5pb+E2Q5OnD9T5xqYzgFNWT+nZ/9zVBkOvOuMYCs7cTzEJPB+/wQ0JQ/6MxSege5B0g0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900635; c=relaxed/simple; bh=aVxJkW/iQwrNOLgfTTVJY6pj2fg2CeUI4P5STK6H26g=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=NVayvUxPPqD1StbV8HxxYJuEVHSbnGRgCYP3ce0DpMAzlCX5XeDjGjVGN/b62q5ZAQUF18D1GeXTydK7LIqbnhoiUwcbx40+P8EcjycOXkSZlzo3+SdJQoSazCD4pJRo/o0TJ1Kc2lErvLRtm0y0ZM2eGqWR4vTYOipwN9dtlBs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4B655CE2743; Thu, 20 Jun 2024 16:23:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7636C32786; Thu, 20 Jun 2024 16:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900629; bh=aVxJkW/iQwrNOLgfTTVJY6pj2fg2CeUI4P5STK6H26g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gp1OfiOJYVv84vePrRS45hAyaAyeMToGQzUaNUoYWz+fBT73+IF24GCI4MXB5/jOf TfGzdzxHssbjh3n4mNmOkgo0ERLGQruvRYgmzNnE8GSKu3z2MpmXMLpe+A2A2PtVbr U1TxfuGACaur0lnoibgImkdzv4Ai3KrsqZekNaDnL371jKXigoigwZlvR0LlLkvWPt yO+uEARJeqHbdyWZmwGGc+SC92Bjzq/kgjWt99bvlPjGUd/c4S9TtFxJ1KAcaqi1Ik tP/3l5RRJMIw/JiBGz59bJP6M//sxk4az8lHcyUfjthpEG+Naah/UkiFNyQAlBfBb5 kp27UGFdOs+iA== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 02/15] syscalls: fix compat_sys_io_pgetevents_time64 usage Date: Thu, 20 Jun 2024 18:23:03 +0200 Message-Id: <20240620162316.3674955-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann Using sys_io_pgetevents() as the entry point for compat mode tasks works almost correctly, but misses the sign extension for the min_nr and nr arguments. This was addressed on parisc by switching to compat_sys_io_pgetevents_time64() in commit 6431e92fc827 ("parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode"), as well as by using more sophisticated system call wrappers on x86 and s390. However, arm64, mips, powerpc, sparc and riscv still have the same bug. Changes all of them over to use compat_sys_io_pgetevents_time64() like parisc already does. This was clearly the intention when the function was originally added, but it got hooked up incorrectly in the tables. Cc: stable@vger.kernel.org Fixes: 48166e6ea47d ("y2038: add 64-bit time_t syscalls to all 32-bit architectures") Signed-off-by: Arnd Bergmann Acked-by: Heiko Carstens # s390 --- arch/arm64/include/asm/unistd32.h | 2 +- arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +- arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +- arch/powerpc/kernel/syscalls/syscall.tbl | 2 +- arch/s390/kernel/syscalls/syscall.tbl | 2 +- arch/sparc/kernel/syscalls/syscall.tbl | 2 +- arch/x86/entry/syscalls/syscall_32.tbl | 2 +- include/uapi/asm-generic/unistd.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 266b96acc014..1386e8e751f2 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -840,7 +840,7 @@ __SYSCALL(__NR_pselect6_time64, compat_sys_pselect6_time64) #define __NR_ppoll_time64 414 __SYSCALL(__NR_ppoll_time64, compat_sys_ppoll_time64) #define __NR_io_pgetevents_time64 416 -__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) +__SYSCALL(__NR_io_pgetevents_time64, compat_sys_io_pgetevents_time64) #define __NR_recvmmsg_time64 417 __SYSCALL(__NR_recvmmsg_time64, compat_sys_recvmmsg_time64) #define __NR_mq_timedsend_time64 418 diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl index cc869f5d5693..953f5b7dc723 100644 --- a/arch/mips/kernel/syscalls/syscall_n32.tbl +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl @@ -354,7 +354,7 @@ 412 n32 utimensat_time64 sys_utimensat 413 n32 pselect6_time64 compat_sys_pselect6_time64 414 n32 ppoll_time64 compat_sys_ppoll_time64 -416 n32 io_pgetevents_time64 sys_io_pgetevents +416 n32 io_pgetevents_time64 compat_sys_io_pgetevents_time64 417 n32 recvmmsg_time64 compat_sys_recvmmsg_time64 418 n32 mq_timedsend_time64 sys_mq_timedsend 419 n32 mq_timedreceive_time64 sys_mq_timedreceive diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl index 008ebe60263e..85751c9b9cdb 100644 --- a/arch/mips/kernel/syscalls/syscall_o32.tbl +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl @@ -403,7 +403,7 @@ 412 o32 utimensat_time64 sys_utimensat sys_utimensat 413 o32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 o32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 o32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents +416 o32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 417 o32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 o32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 419 o32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl index 3656f1ca7a21..c6b0546b284d 100644 --- a/arch/powerpc/kernel/syscalls/syscall.tbl +++ b/arch/powerpc/kernel/syscalls/syscall.tbl @@ -502,7 +502,7 @@ 412 32 utimensat_time64 sys_utimensat sys_utimensat 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents +416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl index bd0fee24ad10..01071182763e 100644 --- a/arch/s390/kernel/syscalls/syscall.tbl +++ b/arch/s390/kernel/syscalls/syscall.tbl @@ -418,7 +418,7 @@ 412 32 utimensat_time64 - sys_utimensat 413 32 pselect6_time64 - compat_sys_pselect6_time64 414 32 ppoll_time64 - compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 - sys_io_pgetevents +416 32 io_pgetevents_time64 - compat_sys_io_pgetevents_time64 417 32 recvmmsg_time64 - compat_sys_recvmmsg_time64 418 32 mq_timedsend_time64 - sys_mq_timedsend 419 32 mq_timedreceive_time64 - sys_mq_timedreceive diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index ac6c281ccfe0..b354139b40be 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -461,7 +461,7 @@ 412 32 utimensat_time64 sys_utimensat sys_utimensat 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents +416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl index 7fd1f57ad3d3..d6ebcab1d8b2 100644 --- a/arch/x86/entry/syscalls/syscall_32.tbl +++ b/arch/x86/entry/syscalls/syscall_32.tbl @@ -420,7 +420,7 @@ 412 i386 utimensat_time64 sys_utimensat 413 i386 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 i386 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 i386 io_pgetevents_time64 sys_io_pgetevents +416 i386 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 417 i386 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 i386 mq_timedsend_time64 sys_mq_timedsend 419 i386 mq_timedreceive_time64 sys_mq_timedreceive diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index d983c48a3b6a..3fdaa573d661 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -737,7 +737,7 @@ __SC_COMP(__NR_pselect6_time64, sys_pselect6, compat_sys_pselect6_time64) #define __NR_ppoll_time64 414 __SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64) #define __NR_io_pgetevents_time64 416 -__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) +__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64) #define __NR_recvmmsg_time64 417 __SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64) #define __NR_mq_timedsend_time64 418 From patchwork Thu Jun 20 16:23:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805994 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp377486wrt; Thu, 20 Jun 2024 09:24:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX96BktG/sn+vgAzCV2Q4/SqvhdAp/1wSNi4xCd2HhYc9thge+sX7pW3DuNyxP8GBKT/azPpUeLEHyUwUGbQxDV X-Google-Smtp-Source: AGHT+IFMJnFfSYbb9VIoV50kfW26fFB+5Vhg4GDQXmB/h9vDeDpjjdL1aTiHOpMTjWdD3uomGLro X-Received: by 2002:a05:6808:23cf:b0:3d1:ff7c:a957 with SMTP id 5614622812f47-3d51bb037e7mr5231575b6e.53.1718900655336; Thu, 20 Jun 2024 09:24:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900655; cv=pass; d=google.com; s=arc-20160816; b=0s9YIVQS5frNc+wscY1H7JcLk0FRYm/IpI5T/3QXzarNf20LLqq36jJ6Vje8C+oDPz MPdioPJTuPmlbX2pv9kFU8p7KSG3TArw4D/LAN77x5WDaeJCmxVB3YtWECTvpefFQeED D4uYJarK77UEEZTRb5mr0zS4lh7fjXsf4Q2k1vkGCLBxvS9y0N57ft3ZdRsPeXZTRgOT M8sOLeop/PcTnIuTaZhoqCh63xf39WirgBq8WP/wpQ5zUeuiMDSI6RBzbwO4Yqpmh8cH RjeKLP/lTopD8Ih6nq4g3Ri31gDX8V7Xa3s8MLGNJyy/qntoZfkPoqPc5EcJNqYyqhbm XXBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=dM7iPDKCly3/XX+LCTJnpYbNZdM4qNmVsCpF/rYcRpU=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=fmOtmyN3rNyTMRiwoSpnb2gPpXYwiPcNXcP/J1p71G8hWvAFkI9cQTwE+2TL+uQ1eA ANaBuUqTJnvnVapMSdyO9g456mGb/g76UVMMMKg8sgswDfSwrXp/bCbVjvFPA6UgrNrk z0VIq/FCt3z7UqwQORHzOs3qzJcqftVr/PJGV1KEIPnXzWiw7LdpKn/5c9WjbhlQxIxd YE3yWzhxWBOVsEVyoGecAz0AEygoB6RHySSWxG1Fw+c7fPEB5AxclxgGh/Xc8NNXFDEt OmuHgBCbiVh261JWi7D8l5/fuISDx0uJKpZG7J/2R3hnQD67nKbq8pIW/B22BQaML/Co NLVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AaWGCEH0; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80d78a7d676si3110389241.187.2024.06.20.09.24.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AaWGCEH0; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3D9E3894C2E for ; Thu, 20 Jun 2024 16:24:14 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id F377E3894C01 for ; Thu, 20 Jun 2024 16:23:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F377E3894C01 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F377E3894C01 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:40e1:4800::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900642; cv=none; b=O9Xp8y0A94tiDGSfxdIbM6rUy4at1wrrvrVnJWHl+HC6jifm/sDh9pffXWvBJ6VCT1RUwq8lhDoALzmtBE6a0bQ6b/MpkzAQjtYMIahKyHzIqggm6B90we5jxLqgvm5EEWIyQcUBEW0MbWEtJgc6/Ti1T+mNtowYhEjwY5KVduk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900642; c=relaxed/simple; bh=Doj0//VPfq9z758xR2+yZ79Db+NeekZ0EoHrfr9q2Q0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=x5WGxX1som91nWgZiinSJiyglaqKvS9UJx1zLmrTn0A3AgYbva8SS/AAcHzCVZOzstgZMTKJqWqXmO/5LDLCypQ8g83lHPn0rvrbQAvw+SAESwen+nRK+gq4vW+cGv/ku6X2kVsu2X9/7JkzanzjEJsQBDDPxpgnrtpZ7mTM01o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6A3ABCE2741; Thu, 20 Jun 2024 16:23:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB5EC4AF07; Thu, 20 Jun 2024 16:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900636; bh=Doj0//VPfq9z758xR2+yZ79Db+NeekZ0EoHrfr9q2Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaWGCEH0FUtHpMS1MWl92zyMC/tgI55ZbXl6tZ3t5C3/D90MhQY7LMPv52sRtXgX7 /tDHOQ6fobnn4uVWb5vNTuBQIwEAxDas3AiEfhSop6feRAWhRnZ+da7P7VMngnhmkk uKday5m0uC0pCQIfQjJmNfph+BSKsE6mupZiTK4nCMh6ev02nOQHZHAifS9GhfJcf8 Av2+SR2IBKxnqrqNk3UUKHECPl0wYIrYeODFjmzBUOQioGFpi7EdScbEqPk5DdwfzV /j7R+AlsEtHGaZd/7u8r6X3V3OMunqnE6kTRg7ZdDsGpPmUCRt3Q2a3/R9uSNNqkgU 9t5D3HmhZEJ5Q== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 03/15] mips: fix compat_sys_lseek syscall Date: Thu, 20 Jun 2024 18:23:04 +0200 Message-Id: <20240620162316.3674955-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann This is almost compatible, but passing a negative offset should result in a EINVAL error, but on mips o32 compat mode would seek to a large 32-bit byte offset. Use compat_sys_lseek() to correctly sign-extend the argument. Signed-off-by: Arnd Bergmann --- arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl index 85751c9b9cdb..2439a2491cff 100644 --- a/arch/mips/kernel/syscalls/syscall_o32.tbl +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl @@ -27,7 +27,7 @@ 17 o32 break sys_ni_syscall # 18 was sys_stat 18 o32 unused18 sys_ni_syscall -19 o32 lseek sys_lseek +19 o32 lseek sys_lseek compat_sys_lseek 20 o32 getpid sys_getpid 21 o32 mount sys_mount 22 o32 umount sys_oldumount From patchwork Thu Jun 20 16:23:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805995 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp377928wrt; Thu, 20 Jun 2024 09:25:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHlb/GOh5SPl8NWbuGmzCFgtCNacrg53r+fyl0ZL2zBLZ671kzkcI9bC5wTwMZmk1OGSzc5vjohYG7IbzjJ1Gw X-Google-Smtp-Source: AGHT+IFGMNsIsdnfTkf2EjD4GphAujIrKbEUNHeaqqiRq3orLc03e2bL1nPFZ2BV8p/C/heOM7OI X-Received: by 2002:a05:620a:4153:b0:794:f330:6caa with SMTP id af79cd13be357-79bb3ed2cabmr643579685a.58.1718900707870; Thu, 20 Jun 2024 09:25:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900707; cv=pass; d=google.com; s=arc-20160816; b=khfUX57M9ZpBNXFMS5zItI9Cm0t51HN5hoRd6H1w76RLemmZE5SB4SckF5/0eDLbbK 1+xDEVoWHpvCsNxT2ZXX2IrclDNcyMp+LZcbsiV9Lb/OAhjOlVSkEefkhf09+LIIcTVr yxBIPgXoUkskQzz0GTw/E6NlIgwprdCzSHP6cvh+q/TGVjy2khCUR9BVqUaxh+HQBZlU AGoYjMphZnt39AeM+oOYIdR53OH/F8SNoS2aHhtf7ekexX7B/wGmXph1xeQVb6LBph8N E8aItUTwkclfhneau2ujjalcOF5eSFo470pcOmMJSU1+QhPobHji+TTN6BHr8FGd2oYX dIHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=YEHbqKIiyC3eLQT9uksWn2Qm7LLoT768KKwHogHDR0A=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=p+O3vHGjUvRORiVpcghRJwJoavhcP80d9RNDI1oQMZ+l1Wu9dAb3U9UZVmb4rxIMY+ tlU4YSQPeHqsTANkH5p7IZcHnJRmGoj8lxyC0wm6v1PNW/d9kgUwcsQQDlAbMWEb8E4u lHhFBaBK9z3+Hj+5MbtrwPn8zRTjICyBbXQh9qb0V97/A5E6nayK0XV+rZFtSiUcrNhj cxJ6tKI54oBbEa+jTvJhM78DjPMSLIwMygwL7FnKFCY/+vpW2GOt0nk2alb2SsljyUru 0b7fK1rHALZZiRo+1KT3XT6doFZqvhdv405/usxgVMaCsa2/XcgvyG8fv9sSUSiW0cY2 CcZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HkyRLylM; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-798abe57c56si1850865685a.536.2024.06.20.09.25.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HkyRLylM; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61CBC3894C27 for ; Thu, 20 Jun 2024 16:25:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id BFC873894C14 for ; Thu, 20 Jun 2024 16:24:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFC873894C14 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BFC873894C14 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:4641:c500::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900645; cv=none; b=ZPrwuSNEc/aMveouvizSho3AGk8xhhsyaTHO9Vsu+wx9IdlySePBcWSFx6JrV6rFrflyzH8DxPZO3AMJ7rd3L3Aq9QFF855OmNFY+d31w0l30/XO+1N+PDHNiwvjmc4n3OUBq1yAd9L4D8uyfmBYYdJZSfRmmIPEkJTQ2Kzg7gE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900645; c=relaxed/simple; bh=cJPHgO7rC0lwgzSVqzH0rTJpOL4kkIXZCXlrSaP+FJc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=o5affleGjWlNgW07g2xNvP1Xm5kSVE4XkUt2x7gS2yLrv96EZVkmlT36b/kvw2Afus1hYKF8CC+eCghwDwTX5KGhNTb8zblEF3h/pxC3IVfumCEXg4p2XbuNptutsES7tSIz9rhzqPFY4DMy0ciEBIf33WaJ2XVknWzMMgPoOvI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 61FC6621F9; Thu, 20 Jun 2024 16:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFFD4C32786; Thu, 20 Jun 2024 16:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900643; bh=cJPHgO7rC0lwgzSVqzH0rTJpOL4kkIXZCXlrSaP+FJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HkyRLylMnXyv0WsxD8QL8vKVPSKro4BwCxwyewRoTfPdeRVcm1oChn7k8vYspR3wd yQW8rnIE0bv8kkbtAqaKqgPnepA6DcOCp3JMdTlAnT8RlKjsKi5K+r9OqT4HoFonmG f3kHhl3ZWTZMo4GtaggxJcXmFVjVUSUkiC4DBTES3UPVTq0B2sYkBQsRdANXLL6bIL SCHzW2/7J9RmI1gl2ED3xynQG4CCaaemzF9kz+POcz6T4kzugSs3WAtC5cl5ThjNaj oq/eswLVYZeUNXhiqyKfNJrn1nns2jlf4JSkYv7RCQh4XBBytNYAFCKzeahkxjiU8J nnR+Jle+gafYw== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 04/15] sparc: fix old compat_sys_select() Date: Thu, 20 Jun 2024 18:23:05 +0200 Message-Id: <20240620162316.3674955-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann sparc has two identical select syscalls at numbers 93 and 230, respectively. During the conversion to the modern syscall.tbl format, the older one of the two broke in compat mode, and now refers to the native 64-bit syscall. Restore the correct behavior. This has very little effect, as glibc has been using the newer number anyway. Fixes: 6ff645dd683a ("sparc: add system call table generation support") Signed-off-by: Arnd Bergmann --- arch/sparc/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index b354139b40be..5e55f73f9880 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -117,7 +117,7 @@ 90 common dup2 sys_dup2 91 32 setfsuid32 sys_setfsuid 92 common fcntl sys_fcntl compat_sys_fcntl -93 common select sys_select +93 common select sys_select compat_sys_select 94 32 setfsgid32 sys_setfsgid 95 common fsync sys_fsync 96 common setpriority sys_setpriority From patchwork Thu Jun 20 16:23:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805996 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378041wrt; Thu, 20 Jun 2024 09:25:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmtglhDr010KoYqXAtEZfLzMBXty6kjUnkZOGkoswwtACGoh8QmV09YvJKHCDr+mRvtBW/B4vRIJLia1PLnHe1 X-Google-Smtp-Source: AGHT+IFpr4JzYhBxJu8qrmHSn2Oh+3amKgHOpPpvHsUzKCzLO3TV+7bttANDXZ5jqijO2g4eQ0D+ X-Received: by 2002:a05:6808:238f:b0:3d2:2a43:1c03 with SMTP id 5614622812f47-3d51b96c6e0mr6036549b6e.9.1718900718498; Thu, 20 Jun 2024 09:25:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900718; cv=pass; d=google.com; s=arc-20160816; b=KPXza2GiMFp5HgdM1vGgYfFeTAjMe0jHewkXyTwovoMNiJHb+x+l1QyBlZgiWWH2Le OY5Sr0C1ZQtuLbtJMY2i3HUp4qotp0SFlGfxqVEmgca8yssAvmrKoyNayuxOHgwysbHI DpGIwNK0JmVYcH2Y6xwT8tX73c1aA6KCLJ7/fpzaReV6QMlpMnFHP4pwW1pTgv56jmR9 yL1dK+2E7GoifxNt1wkqZa9ExqboX3RLLWc8lyuJ8Tbj0qGXTx9PoRV3CXUp0Af/lqwH NLZQq8obHF0UvVILSUsbUnszWfryQUQC6Bc+uVMmYvXEwrMNq5VAZJwDOgAJFAlymV4K 3CpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=FvDq83fei3N4Tk8P8xjSdRVqfHIaUr1bKeRcquais0o=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=1DcPDODtLMdixaMIl1M+B/oK5EAgI6hCfKH8pJU6mJCwpurjz3xwxiXb76CoSZOuy7 7zkbgRpyUmR/YnnJuJ5gWIx0wTEmKnZCpu0q6zq6MD7cE4q1CuxcrXFTvZ6fA0uZwSfn 656yM9Os6A0bCxWrxOsELFHBXc9E8iA+STewpZHctuPjd9YWycwdaxJQ9nEW6M3Bkf/X P/84g9D9DNbsCrwUa/B/hYnG5sVFmXT/kRuTNz1MesPKUkdvZOi89muSpAtrkHADZXdx RUOhOUxeCPKLhyHRHJxGGoFDeI+gd4qcUjuLrI9up0zZmsVgIsR8blucsltArbgtwxdu 8DZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s3lH41X8; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80d78a9bbf5si2598255241.201.2024.06.20.09.25.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:25:18 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s3lH41X8; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 13694389365E for ; Thu, 20 Jun 2024 16:25:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id 4FFBD3893640 for ; Thu, 20 Jun 2024 16:24:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FFBD3893640 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4FFBD3893640 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:40e1:4800::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900660; cv=none; b=mFvMeC1QUqpTcsipZY+VDUyqHdO8LGVCjcpZeWQhExb4wN6gYEYHjBESU1NSR11okU/53kAmS7jGYuzdOoNbtfeNd0ePCqERHd9z2mIneQNc9LqYQpXHiNrdf+BdOA+LBUMHa/e4mgbLnGGsi38cfCWjOySBD26WD+HyLSJzbfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900660; c=relaxed/simple; bh=AKNrHrEDw/bOnYoPf4j9KvT8uWTmJp8Ho7k3J75gm1Y=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ip9+0VklfERwAR9ZIcCPdcgprwG1CIYQyTItwtTdLISHw/ugPfID9zJHNnbl79ZZk/wetCkABJFwyAl9DxFfcH2kKJRLgGacJO1EoruzA1xTuptNTNjiphg3te+igaRPbhP+QRdKkxPIakSGT7xovS9I0Xr55+mJGHWuIv29k54= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D81C7CE2743; Thu, 20 Jun 2024 16:24:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D194C2BD10; Thu, 20 Jun 2024 16:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900649; bh=AKNrHrEDw/bOnYoPf4j9KvT8uWTmJp8Ho7k3J75gm1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3lH41X8uDU30QzP5Uh6EeYrYgLqRUFP+ebyJttGbu+VgkA5y7tcuu8/kqZQ2ikmQ gU8yhEWdkKRXWzgvg5ZDJL4ymc0Ww0dFKPwxkv11YMA6gQkFgxXH90lVqsXogLFizl BllFCP1furlXvMwK5FHiiSSwMFZQyU5F/A9eCcqnsyAKF8P1yt5kr7Z2fwaeoX0YQw 8atG75dcfJ4Nv+kRMwjraopThlYyoK3sDXFeJXrd/yXTQpPo/8rrMH8ZiefnhYO1wX FwPnV32KV/uXdZqYSFHQfBFTQMbLzOO9TtjsfZZAwYLazbdUAyCGJA1PVNH1L05a/n GgQT6pXl8/k5Q== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 05/15] sparc: fix compat recv/recvfrom syscalls Date: Thu, 20 Jun 2024 18:23:06 +0200 Message-Id: <20240620162316.3674955-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann sparc has the wrong compat version of recv() and recvfrom() for both the direct syscalls and socketcall(). The direct syscalls just need to use the compat version. For socketcall, the same thing could be done, but it seems better to completely remove the custom assembler code for it and just use the same implementation that everyone else has. Fixes: 1dacc76d0014 ("net/compat/wext: send different messages to compat tasks") Signed-off-by: Arnd Bergmann --- arch/sparc/kernel/sys32.S | 221 ------------------------- arch/sparc/kernel/syscalls/syscall.tbl | 4 +- 2 files changed, 2 insertions(+), 223 deletions(-) diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S index a45f0f31fe51..a3d308f2043e 100644 --- a/arch/sparc/kernel/sys32.S +++ b/arch/sparc/kernel/sys32.S @@ -18,224 +18,3 @@ sys32_mmap2: sethi %hi(sys_mmap), %g1 jmpl %g1 + %lo(sys_mmap), %g0 sllx %o5, 12, %o5 - - .align 32 - .globl sys32_socketcall -sys32_socketcall: /* %o0=call, %o1=args */ - cmp %o0, 1 - bl,pn %xcc, do_einval - cmp %o0, 18 - bg,pn %xcc, do_einval - sub %o0, 1, %o0 - sllx %o0, 5, %o0 - sethi %hi(__socketcall_table_begin), %g2 - or %g2, %lo(__socketcall_table_begin), %g2 - jmpl %g2 + %o0, %g0 - nop -do_einval: - retl - mov -EINVAL, %o0 - - .align 32 -__socketcall_table_begin: - - /* Each entry is exactly 32 bytes. */ -do_sys_socket: /* sys_socket(int, int, int) */ -1: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_socket), %g1 -2: ldswa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_socket), %g0 -3: ldswa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ -4: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_bind), %g1 -5: ldswa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_bind), %g0 -6: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ -7: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_connect), %g1 -8: ldswa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_connect), %g0 -9: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_listen: /* sys_listen(int, int) */ -10: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_listen), %g1 - jmpl %g1 + %lo(sys_listen), %g0 -11: ldswa [%o1 + 0x4] %asi, %o1 - nop - nop - nop - nop -do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ -12: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_accept), %g1 -13: lduwa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_accept), %g0 -14: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ -15: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_getsockname), %g1 -16: lduwa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_getsockname), %g0 -17: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ -18: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_getpeername), %g1 -19: lduwa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(sys_getpeername), %g0 -20: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ -21: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_socketpair), %g1 -22: ldswa [%o1 + 0x8] %asi, %o2 -23: lduwa [%o1 + 0xc] %asi, %o3 - jmpl %g1 + %lo(sys_socketpair), %g0 -24: ldswa [%o1 + 0x4] %asi, %o1 - nop - nop -do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ -25: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_send), %g1 -26: lduwa [%o1 + 0x8] %asi, %o2 -27: lduwa [%o1 + 0xc] %asi, %o3 - jmpl %g1 + %lo(sys_send), %g0 -28: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop -do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ -29: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_recv), %g1 -30: lduwa [%o1 + 0x8] %asi, %o2 -31: lduwa [%o1 + 0xc] %asi, %o3 - jmpl %g1 + %lo(sys_recv), %g0 -32: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop -do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ -33: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_sendto), %g1 -34: lduwa [%o1 + 0x8] %asi, %o2 -35: lduwa [%o1 + 0xc] %asi, %o3 -36: lduwa [%o1 + 0x10] %asi, %o4 -37: ldswa [%o1 + 0x14] %asi, %o5 - jmpl %g1 + %lo(sys_sendto), %g0 -38: lduwa [%o1 + 0x4] %asi, %o1 -do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ -39: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_recvfrom), %g1 -40: lduwa [%o1 + 0x8] %asi, %o2 -41: lduwa [%o1 + 0xc] %asi, %o3 -42: lduwa [%o1 + 0x10] %asi, %o4 -43: lduwa [%o1 + 0x14] %asi, %o5 - jmpl %g1 + %lo(sys_recvfrom), %g0 -44: lduwa [%o1 + 0x4] %asi, %o1 -do_sys_shutdown: /* sys_shutdown(int, int) */ -45: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_shutdown), %g1 - jmpl %g1 + %lo(sys_shutdown), %g0 -46: ldswa [%o1 + 0x4] %asi, %o1 - nop - nop - nop - nop -do_sys_setsockopt: /* sys_setsockopt(int, int, int, char *, int) */ -47: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_setsockopt), %g1 -48: ldswa [%o1 + 0x8] %asi, %o2 -49: lduwa [%o1 + 0xc] %asi, %o3 -50: ldswa [%o1 + 0x10] %asi, %o4 - jmpl %g1 + %lo(sys_setsockopt), %g0 -51: ldswa [%o1 + 0x4] %asi, %o1 - nop -do_sys_getsockopt: /* sys_getsockopt(int, int, int, u32, u32) */ -52: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_getsockopt), %g1 -53: ldswa [%o1 + 0x8] %asi, %o2 -54: lduwa [%o1 + 0xc] %asi, %o3 -55: lduwa [%o1 + 0x10] %asi, %o4 - jmpl %g1 + %lo(sys_getsockopt), %g0 -56: ldswa [%o1 + 0x4] %asi, %o1 - nop -do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ -57: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(compat_sys_sendmsg), %g1 -58: lduwa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(compat_sys_sendmsg), %g0 -59: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ -60: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(compat_sys_recvmsg), %g1 -61: lduwa [%o1 + 0x8] %asi, %o2 - jmpl %g1 + %lo(compat_sys_recvmsg), %g0 -62: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - nop -do_sys_accept4: /* sys_accept4(int, struct sockaddr *, int *, int) */ -63: ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys_accept4), %g1 -64: lduwa [%o1 + 0x8] %asi, %o2 -65: ldswa [%o1 + 0xc] %asi, %o3 - jmpl %g1 + %lo(sys_accept4), %g0 -66: lduwa [%o1 + 0x4] %asi, %o1 - nop - nop - - .section __ex_table,"a" - .align 4 - .word 1b, __retl_efault, 2b, __retl_efault - .word 3b, __retl_efault, 4b, __retl_efault - .word 5b, __retl_efault, 6b, __retl_efault - .word 7b, __retl_efault, 8b, __retl_efault - .word 9b, __retl_efault, 10b, __retl_efault - .word 11b, __retl_efault, 12b, __retl_efault - .word 13b, __retl_efault, 14b, __retl_efault - .word 15b, __retl_efault, 16b, __retl_efault - .word 17b, __retl_efault, 18b, __retl_efault - .word 19b, __retl_efault, 20b, __retl_efault - .word 21b, __retl_efault, 22b, __retl_efault - .word 23b, __retl_efault, 24b, __retl_efault - .word 25b, __retl_efault, 26b, __retl_efault - .word 27b, __retl_efault, 28b, __retl_efault - .word 29b, __retl_efault, 30b, __retl_efault - .word 31b, __retl_efault, 32b, __retl_efault - .word 33b, __retl_efault, 34b, __retl_efault - .word 35b, __retl_efault, 36b, __retl_efault - .word 37b, __retl_efault, 38b, __retl_efault - .word 39b, __retl_efault, 40b, __retl_efault - .word 41b, __retl_efault, 42b, __retl_efault - .word 43b, __retl_efault, 44b, __retl_efault - .word 45b, __retl_efault, 46b, __retl_efault - .word 47b, __retl_efault, 48b, __retl_efault - .word 49b, __retl_efault, 50b, __retl_efault - .word 51b, __retl_efault, 52b, __retl_efault - .word 53b, __retl_efault, 54b, __retl_efault - .word 55b, __retl_efault, 56b, __retl_efault - .word 57b, __retl_efault, 58b, __retl_efault - .word 59b, __retl_efault, 60b, __retl_efault - .word 61b, __retl_efault, 62b, __retl_efault - .word 63b, __retl_efault, 64b, __retl_efault - .word 65b, __retl_efault, 66b, __retl_efault - .previous diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index 5e55f73f9880..cfdfb3707c16 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -155,7 +155,7 @@ 123 32 fchown sys_fchown16 123 64 fchown sys_fchown 124 common fchmod sys_fchmod -125 common recvfrom sys_recvfrom +125 common recvfrom sys_recvfrom compat_sys_recvfrom 126 32 setreuid sys_setreuid16 126 64 setreuid sys_setreuid 127 32 setregid sys_setregid16 @@ -247,7 +247,7 @@ 204 32 readdir sys_old_readdir compat_sys_old_readdir 204 64 readdir sys_nis_syscall 205 common readahead sys_readahead compat_sys_readahead -206 common socketcall sys_socketcall sys32_socketcall +206 common socketcall sys_socketcall compat_sys_socketcall 207 common syslog sys_syslog 208 common lookup_dcookie sys_ni_syscall 209 common fadvise64 sys_fadvise64 compat_sys_fadvise64 From patchwork Thu Jun 20 16:23:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805998 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378132wrt; Thu, 20 Jun 2024 09:25:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0ChR5NyRK3vxqhpHrMQ+ZAau9lZtKHaqNRBNHnEcbcELx+jibuLadYcmcyMdoetQbauyNDxSepZeMLaqgUQ14 X-Google-Smtp-Source: AGHT+IHQoDdIkh0F49KIwYvN97x270HMP72J4yHWrq01zz7jJXmYd76lAWl5yWQxjOPPom3zv96O X-Received: by 2002:a05:6808:1483:b0:3d2:17c9:23e9 with SMTP id 5614622812f47-3d51b96641amr7280504b6e.4.1718900727514; Thu, 20 Jun 2024 09:25:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900727; cv=pass; d=google.com; s=arc-20160816; b=v4EMFk9o7lpgUhzb2ZsiH/KxMKa8XklFA95avb83zJFkueaMEAnDjJtUts+UnV7P7z vFhQEVrjC5vVXPPUYgscnkK6UcuvkI0IgcwxUf8gywXViTkyZCqwgMhHJCUAKb4AHsgm 9nafr0AXdYhkz5ylG8ubbEf9p6NeLWt2llQUYHcgNqEIBbB0g39n/QYA4ANzlljJDsVN PjAj82JCfC37OYHA8E8hVVq9rskrTnqb1PQknLvcLkxvycIUxKugZNkA3WrX9EGW8S+F O4ZiWmoJtPMY0n08y18Mbz2BfgcG9tR1UCUvumiT0xc+2InQe3R9uEL0jMHFE2GAcWgw MwOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=OD8KJgqf5NbaFRxf+/A12kJSWOjVM56JtJ94p/AqpxU=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=V7tok3azjd8DjVP18B/JVzm4zcwD0cF4gDwBAY8QFlGA1qd0OfMJE5/B6rTHS4SPu5 OouPAmCKkia4DrIrPmtw3OlACt6111YofSV5DsJEe42RzYls4VJznJGDL+7h/LElauey ttIZrygrXBi6RhtPxodixUGmyVkyvKWptaFM3br0Dp3rqxp9sQI+MpbQSe0S+Mz7T1xL EWhRkGhWKfTJIE7esUsavRJUMJ1aSYKHscedmtQWIs/nSRtZPPYUHJ6lTrnS7QdqBmdh 4mZ6lRXvAgEtpFwQf0TbMz1Axm3yKWNSFik/tYQbicHlOghqrvoxWHar8TDiMJX9UAGE cPrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OMV332YN; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80f52602386si1064554241.169.2024.06.20.09.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OMV332YN; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06F783894C0A for ; Thu, 20 Jun 2024 16:25:27 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id D77CD3894C00 for ; Thu, 20 Jun 2024 16:24:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D77CD3894C00 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D77CD3894C00 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:40e1:4800::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900662; cv=none; b=diidL98HCLOj7sNZ4fX9VYqMT7OWjo5+ifGaAEJgprvXjF96vL4LuIspuCdK+xfEbbbBHK0mMIbwmulKQFHdAXfdsILX6mork9iZj6/BKf/9J2tXiyd8WqxeafWg2WI4Tbi1CwCa+3vJWRyX0c/htHFO5ZFWMHhIq9QLYukiJek= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900662; c=relaxed/simple; bh=SxsG/TmKgeAvUmRAEjqsJKtLdqJlcUTp92xZHqYPbCE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=R+Zpes8GbLw2BWcIEWRsoHyKvPN/LvyYKiFxrJLW2mJy/1gizIPNykXuMXaqNKlHowqRVUIzrOEUvC1MH8VurCBGzXG8OXwsXR4D2HdIncXbHeWoYvVfXsxdX+VJbxoGLpsh2HuNMotpIzsKYTw7Sg/k3ukGCxSfNX7TktMf/S8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B171BCE274F; Thu, 20 Jun 2024 16:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F7DDC4AF0A; Thu, 20 Jun 2024 16:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900656; bh=SxsG/TmKgeAvUmRAEjqsJKtLdqJlcUTp92xZHqYPbCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OMV332YN3UjvJEF4PnM8J7A3bK1CfCxAJvquL4L87vNJ73iww9j8NMyNmkVNBsvmV oELQxErXhDcG6P1rKt8y5lu6a2LtBjPDcBah6AiMLmVxYXeGEBhJxOd4/D1epMMzGZ R142uU7a0qh37b/GbHePGcf2G6lBDkIXJDHA3VULLtdkpyqDFbxpJJwYBlv8bNnybT NRdb50Ap1szpwu+NWMfOfVqEAO3pAtzZW5KC2NWeEgPMl+6NXwN5MlGV9mMt/0P1So DLVL2wKXmHzpfpxUnklRuzv1N+j+tSSs3o7VuHKcFzF8ECtFLmrSwZtTUw4SUAvjB1 Yb913TxCniLxA== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 06/15] parisc: use correct compat recv/recvfrom syscalls Date: Thu, 20 Jun 2024 18:23:07 +0200 Message-Id: <20240620162316.3674955-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann Johannes missed parisc back when he introduced the compat version of these syscalls, so receiving cmsg messages that require a compat conversion is still broken. Use the correct calls like the other architectures do. Fixes: 1dacc76d0014 ("net/compat/wext: send different messages to compat tasks") Signed-off-by: Arnd Bergmann --- arch/parisc/kernel/syscalls/syscall.tbl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl index b13c21373974..39e67fab7515 100644 --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -108,7 +108,7 @@ 95 common fchown sys_fchown 96 common getpriority sys_getpriority 97 common setpriority sys_setpriority -98 common recv sys_recv +98 common recv sys_recv compat_sys_recv 99 common statfs sys_statfs compat_sys_statfs 100 common fstatfs sys_fstatfs compat_sys_fstatfs 101 common stat64 sys_stat64 @@ -135,7 +135,7 @@ 120 common clone sys_clone_wrapper 121 common setdomainname sys_setdomainname 122 common sendfile sys_sendfile compat_sys_sendfile -123 common recvfrom sys_recvfrom +123 common recvfrom sys_recvfrom compat_sys_recvfrom 124 32 adjtimex sys_adjtimex_time32 124 64 adjtimex sys_adjtimex 125 common mprotect sys_mprotect From patchwork Thu Jun 20 16:23:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805997 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378053wrt; Thu, 20 Jun 2024 09:25:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZY0NhEfWGWM8twK1epWKPPPMIQYralDq3j6qJhezwDYVKnkkhKfI0wV7Mtvqr1Cz2C+0JPJpdrZcE51rvSxx2 X-Google-Smtp-Source: AGHT+IGnnbIz9B2juEU4Rk+DidJcFbKFfZFP51+2icA70B7TujC+5TgDsZIEVzoCalTquumnh3FE X-Received: by 2002:a0c:f58d:0:b0:6b2:ca8f:b7ec with SMTP id 6a1803df08f44-6b501eaad72mr68603036d6.50.1718900719837; Thu, 20 Jun 2024 09:25:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900719; cv=pass; d=google.com; s=arc-20160816; b=zvaI2glr7mexuiH1k2cc7wJVxl4jfLlZOBL2sXsx/SPzG4e7GghbI37qnhc2xulJ7v Ly/6XcVCygegvQcT5vKptAyOjoY9guyUioFb+KKmx4LVfU9QatUDhYtjsCHNQqoorycN 1G8DtUX6TLuTDhYm1UWQalTkeqMBvel2ko4o78v73b6kt+m5sgXU0mpXp0SiErI1b1cs RYnRKa21BVMYHMK8vteC+NGG6Bdm1DTZowwOKshcX9SL3n2mj6O+fB4PUnn/ETQOU5aj ygpO7ByJTirYlq2uyqgflgvu1gZ6sPH0RlIDauj8X2ly8+F6dHCuRTZr+dKELKHtQCkd uZ/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=io3xwGs2zNvfg9zpzpqICE1Npf/qKP3jgPnNgyd6HIc=; fh=8vZR4BMhSp2MKx3u9RvxuJYVlivuNEVatVHlQEAq0t4=; b=XYJEwjn86+H8sS//rIILQ9sS3SE53RLTEUhAnRwWYYB3HEWH8EWQ+MW0VHYLriAqmJ Ja6RntjFpHrkrXQw+d+GYR2eO+WxPtgkC4FpSnYFaTFyuTE7fCtNwUvksMcF3r9OIodo JUpFcGlJQlZ6lWOTlTfKujiPSccYFAhkrYMNBvOHvTpjxAv2LlsEd0v9KMN40hdmFbDq BXJJsyBlxeTnlgavv2kgSDhsNIKLE2NaYOsPsO5QetKxFZetFyro7qvFP9uI3t9W9gBY h0nEp4WBqoHG0xPdi72nYNrBmTbLtIyJqZljgS1FtVgFLJocbeuZVV80g9SpyoxOoEIg wyIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cRy1c8+g; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6b382523705si69704496d6.441.2024.06.20.09.25.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cRy1c8+g; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B9053894C1E for ; Thu, 20 Jun 2024 16:25:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id 5FE2B3894C28 for ; Thu, 20 Jun 2024 16:24:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FE2B3894C28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5FE2B3894C28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:4641:c500::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900666; cv=none; b=fOttYARrXQ4YEbkPn9v4vtcvgngfQEUveZaXhKJIsCWQ2pk6K51rWndZwWNte0/l4CFaM9SvccQU3Z/ZcyuoGSlD2BKyQGLfPqCFOBvz/L6fg7Uy6KU1q2XW0nCMqz1SrQyFb6ITlSMuPlw8xzZ+HM8WYsr9bCbfoAJZ/ZqLS/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900666; c=relaxed/simple; bh=CXrlszEDPUQiYKtZ0u7pc0WChHdomqG0bc13oHOMYk8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=pG5QY5K/B/wwndNurWj4OsLDJVXhcQQqcSLhifHL0jDjZEfudeyGUPuAYEyHRIacA+4AJ/Wiuw0qr7xUraOO8TPvb33RhKTO+8nigE3ZqSOjRKRDDgviIgKj6NKn4gDHxQ51/MgBURR9wp4vVbMebk9fgpWnpj+x5jvL60GjaRo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0238C621F8; Thu, 20 Jun 2024 16:24:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B740C2BD10; Thu, 20 Jun 2024 16:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900663; bh=CXrlszEDPUQiYKtZ0u7pc0WChHdomqG0bc13oHOMYk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRy1c8+gzgzO1YmNYFn0xlU4/jPNcn/9MvwsPvAoPe7+0ERWB1jp/4Eg4SrYPfKQW dCxbOu/gXMIqE1WRrm6G4NMNz7t3JWJ57na8ewDl991homE91hY2Y3XJ7fjtxJecwP Z0ls7gy7/0cQaCVR+BfSxUjtZnsLGGh7q+ak0mQ9D7/e8CgHOIX2YIujd0ZuwccdAK qgOlMp7UfU6xdGU8tsWYALGF509s2RqwNwr01W8ehfFbKfshH6UmIb9yP7CLjjIEtf yU4JI3Alw+R/eT/X5xu84FD4G1b2AZ9URmrAprLqK37tETc9Dr0PtHUNggRkNu9Op0 cJXFcVyYlM6ng== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, Adhemerval Zanella Subject: [PATCH 07/15] parisc: use generic sys_fanotify_mark implementation Date: Thu, 20 Jun 2024 18:23:08 +0200 Message-Id: <20240620162316.3674955-8-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann The sys_fanotify_mark() syscall on parisc uses the reverse word order for the two halves of the 64-bit argument compared to all syscalls on all 32-bit architectures. As far as I can tell, the problem is that the function arguments on parisc are sorted backwards (26, 25, 24, 23, ...) compared to everyone else, so the calling conventions of using an even/odd register pair in native word order result in the lower word coming first in function arguments, matching the expected behavior on little-endian architectures. The system call conventions however ended up matching what the other 32-bit architectures do. A glibc cleanup in 2020 changed the userspace behavior in a way that handles all architectures consistently, but this inadvertently broke parisc32 by changing to the same method as everyone else. The change made it into glibc-2.35 and subsequently into debian 12 (bookworm), which is the latest stable release. This means we need to choose between reverting the glibc change or changing the kernel to match it again, but either hange will leave some systems broken. Pick the option that is more likely to help current and future users and change the kernel to match current glibc. This also means the behavior is now consistent across architectures, but it breaks running new kernels with old glibc builds before 2.35. Link: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d150181d73d9 Link: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/arch/parisc/kernel/sys_parisc.c?h=57b1dfbd5b4a39d Cc: Adhemerval Zanella Signed-off-by: Arnd Bergmann Tested-by: Helge Deller Acked-by: Helge Deller --- I found this through code inspection, please double-check to make sure I got the bug and the fix right. The alternative is to fix this by reverting glibc back to the unusual behavior. --- arch/parisc/Kconfig | 1 + arch/parisc/kernel/sys_parisc32.c | 9 --------- arch/parisc/kernel/syscalls/syscall.tbl | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index daafeb20f993..dc9b902de8ea 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -16,6 +16,7 @@ config PARISC select ARCH_HAS_UBSAN select ARCH_HAS_PTE_SPECIAL select ARCH_NO_SG_CHAIN + select ARCH_SPLIT_ARG64 if !64BIT select ARCH_SUPPORTS_HUGETLBFS if PA20 select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_STACKWALK diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index 2a12a547b447..826c8e51b585 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c @@ -23,12 +23,3 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, current->comm, current->pid, r20); return -ENOSYS; } - -asmlinkage long sys32_fanotify_mark(compat_int_t fanotify_fd, compat_uint_t flags, - compat_uint_t mask0, compat_uint_t mask1, compat_int_t dfd, - const char __user * pathname) -{ - return sys_fanotify_mark(fanotify_fd, flags, - ((__u64)mask1 << 32) | mask0, - dfd, pathname); -} diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl index 39e67fab7515..66dc406b12e4 100644 --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -364,7 +364,7 @@ 320 common accept4 sys_accept4 321 common prlimit64 sys_prlimit64 322 common fanotify_init sys_fanotify_init -323 common fanotify_mark sys_fanotify_mark sys32_fanotify_mark +323 common fanotify_mark sys_fanotify_mark compat_sys_fanotify_mark 324 32 clock_adjtime sys_clock_adjtime32 324 64 clock_adjtime sys_clock_adjtime 325 common name_to_handle_at sys_name_to_handle_at From patchwork Thu Jun 20 16:23:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806000 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378468wrt; Thu, 20 Jun 2024 09:26:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkcXKYSUUtvkq5Sx0MtGdp7V7+Sa/yYxA1Y7oULAvngPbKPBu5Gy2NO0JA3y3DcWb/fDxbLwBkVrWJ5EUbTCPf X-Google-Smtp-Source: AGHT+IHpyB6qImFIh2hOwewYgaeEVLvCx8KKJDx6tOmuZTLDs3yRAKyp6pQDT+HmBewvBA4eeYe+ X-Received: by 2002:a0c:dc08:0:b0:6b2:cf9e:866 with SMTP id 6a1803df08f44-6b501e097a3mr67580796d6.4.1718900772617; Thu, 20 Jun 2024 09:26:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900772; cv=pass; d=google.com; s=arc-20160816; b=BJYVMu/1bdvxUdQMaARilwP0W9D6+TU7Mv8s+fIhfdeKy7N4+xJqddyZuxWQQF1UAD xKU5CuyU15ARohS+fiJ8yBdPrFqHPIKzVhwW14PWFrUhh/rrtnhYFQJ/UO8pTwKBt8Us 5bICFW9FgrcFad0CAo/8m0njEmquz8rj89yHybc34nrFMLQUKdi7DLlOl81vYn/4DAib Q5QBYcX9/5361qWqqqLX/9E34F7sbo1vXD4hxqSTCUtZZqoIN5yH619eg7wnr8LMIMmw xA+WnB298HsDUTqaLFihM8rUllgOCyOdcc90D12NmEPlxeabL7NICcbvd6uOBoIkLaaV oMfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=cGLik+2yCc8DP6asxnYlM9DmUWGCbT4u0r6rINJY11w=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=xrV87RK0U22g1MF4XV+rivnZP0Y6BWBB9+BShZNXvWBBeY/E2ZxNo7/0tkyo7NAF6f tkD60I8N7aVOPJeGV4JxL09I0nkQP0M9T+ASpmoz6gB3SCHcIyJAhN0B05DYG/x1P018 flKENXWZ4PBuXUUedK4mXVeW9Dpny14PZmUlxsy+sfK7PyKUY8+4ekwxLkHLwgCi9/D2 1pqVscVXfbEy8bEXrHmQWtpzs1j7I6w55JXaK34cOgtD08S//KVi0Xl6WKC4OLy4sCf0 VMCtV0cipkEaQe8XivDEr61aUIKQpT+Q3XM1VckyeG7XOjdAhh2wMTdZlyBWZlpbX1O/ Ky3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mBOAGVRP; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5b377cfsi51439016d6.402.2024.06.20.09.26.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mBOAGVRP; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D22B3895FC6 for ; Thu, 20 Jun 2024 16:26:12 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id 346B638930C1 for ; Thu, 20 Jun 2024 16:24:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 346B638930C1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 346B638930C1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900673; cv=none; b=p7gW6Vs+ldezTF7Z1VphmG925Q8h7yJYNx+xGpuv+u9J/DhGzNc+G6pfzy8/7sO/PmRQzdMOYIsn3AIUHN2mbSBAzC6ibiK3RbGrPMp1kp0IuUOjxUhFPEOuKS1cBoqx+oYa7UhW9Xp4Jbk3jE2ebzT2/f7mldgg+RGMT6zVDio= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900673; c=relaxed/simple; bh=aE1IzWXJE8K8MWEf5402uO3TqcAk8oC7+4/q1IycgIY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=X+v7WKGyQ/NTYXz+Ko/l6MA9Q3wzy9GUwJQyX6F3h4c9WUs4tu1d9mfE0v+TQ/AoYj81YmDr/fI59BvnKJxVcY4w/9ClkQlCPHbRlAUsLsiAlbvqBuQXUparcycNQzEMiqHG1WVfApP5+IbtDM4DrrecQuvSCCBYz4rt0FLZGXo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D16DD62097; Thu, 20 Jun 2024 16:24:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B879C2BD10; Thu, 20 Jun 2024 16:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900670; bh=aE1IzWXJE8K8MWEf5402uO3TqcAk8oC7+4/q1IycgIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBOAGVRPDuIIDgzz9N9Wv9tq+6O7qehvtt3NqwZRKXAaX81ur91IhS/ySqZEVjXHH 8BNFcwQVOPD4kEHDjxawmwom1Bs6tusGWzCs9fCVUZ5OUF0O+OvH0CVa5kGnOTFmzL GEI5mB0QcswRpgi+tdI9ziS4nTh/FR/VW8c0NX2qlhuCSCCrTcDCQVCXPAkfLukmZ5 NbYsw1oxfrsZ7X0U4eoXex0ehnrVGHOa2jbo8WScSWXnj3rfEAKY0S8c3gzpWgOSDy tnXuUgL8P3jSsl4vGY4W7kZjzDQ42iBfVb9+jcuFzGcY1/joadJbP3jiKaE7bYpngQ 8HwoNYMbd4hYQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 08/15] powerpc: restore some missing spu syscalls Date: Thu, 20 Jun 2024 18:23:09 +0200 Message-Id: <20240620162316.3674955-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann A couple of system calls were inadventently removed from the table during a bugfix for 32-bit powerpc entry. Restore the original behavior. Fixes: e23750623835 ("powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs") Signed-off-by: Arnd Bergmann Acked-by: Michael Ellerman (powerpc) --- arch/powerpc/kernel/syscalls/syscall.tbl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl index c6b0546b284d..ebae8415dfbb 100644 --- a/arch/powerpc/kernel/syscalls/syscall.tbl +++ b/arch/powerpc/kernel/syscalls/syscall.tbl @@ -230,8 +230,10 @@ 178 nospu rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend 179 32 pread64 sys_ppc_pread64 compat_sys_ppc_pread64 179 64 pread64 sys_pread64 +179 spu pread64 sys_pread64 180 32 pwrite64 sys_ppc_pwrite64 compat_sys_ppc_pwrite64 180 64 pwrite64 sys_pwrite64 +180 spu pwrite64 sys_pwrite64 181 common chown sys_chown 182 common getcwd sys_getcwd 183 common capget sys_capget @@ -246,6 +248,7 @@ 190 common ugetrlimit sys_getrlimit compat_sys_getrlimit 191 32 readahead sys_ppc_readahead compat_sys_ppc_readahead 191 64 readahead sys_readahead +191 spu readahead sys_readahead 192 32 mmap2 sys_mmap2 compat_sys_mmap2 193 32 truncate64 sys_ppc_truncate64 compat_sys_ppc_truncate64 194 32 ftruncate64 sys_ppc_ftruncate64 compat_sys_ppc_ftruncate64 @@ -293,6 +296,7 @@ 232 nospu set_tid_address sys_set_tid_address 233 32 fadvise64 sys_ppc32_fadvise64 compat_sys_ppc32_fadvise64 233 64 fadvise64 sys_fadvise64 +233 spu fadvise64 sys_fadvise64 234 nospu exit_group sys_exit_group 235 nospu lookup_dcookie sys_ni_syscall 236 common epoll_create sys_epoll_create From patchwork Thu Jun 20 16:23:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806003 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378983wrt; Thu, 20 Jun 2024 09:27:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTV6UHLmQOQGDybRTByiAkg6ppDljMlsfvKeinvj+GU38YBDyokkXsGWfQ6u0RfdhYRI5XvW7x6qQaTtZJ90CE X-Google-Smtp-Source: AGHT+IGhgdOn/H1xLUWRgbT8Wm8QlAMH+vLm5p+C/YU9k06aleElR42A+ogIHLos2gHrYjoUpeJ/ X-Received: by 2002:a05:620a:24d4:b0:795:5f38:7de3 with SMTP id af79cd13be357-79bb3e1a4a2mr653985285a.6.1718900838539; Thu, 20 Jun 2024 09:27:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900838; cv=pass; d=google.com; s=arc-20160816; b=qrwgKJxN0GfWxWdBI9x7jBz342EMLAio9jyf7YwCyJ8CXDffHAHEe8emxAUbo2WxVv ntC4c/VeLtHXOFCbbTciL80xOhdIbWONI3yQ/9fkedsTHwY2rRGbQsWupaWN1Gek5uX2 pw7mt74ZaS5dgWiBG5z1esunmVFbFG1fY2ZIcIruEdKBCH0divADj82RInjR4hD5iN47 Eh+YtxO9OTyqyZTeiVEXD5k7/wQPUSJuJ8/6DkzedxvdCfEqXQczXXLm1ydK4kS1SElK cfHMq9yPuGUvAGDMgQ3j5OCGv/ML4xths3fjqiBLZyctRsCSKiba3upcsTmBN72UYN0V H8oA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=dKegY/NCuvP1qGpTty+zi/gABRoEOsmvI2xLwKAI2tY=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=f2HT20OkhRMwOpZVjvYMAMSgkEZUgqEta3p7vtRcFDyzGx8YyH/AhHcYbR6gZ66XNm WaqFZWjSG2CVg4RI0jwJGbC8zXuwmBgzJVk5BvJioi3ol8NxeyiB9LiDZ3kzldiW1lhV 5LG4aFosL8D86xo1n1UTY5KSDfRhgh7QNTB5R1krAkOsGpkdF9ATMZHutEy70YAm6uzs qewrJYCfe7/NEpXWbBA1kHxX86Hs/JC8iLPBIdmwJyJD/PGrwHoOPTu4c2loxnxp15At B5x/1oI7ZG4E3cBt3hgVjDbOjRCSrMTRYakY4du5+yfI3ncT4DPKpYLLlpNq9R2TZ3QX bV2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RQ6euKiK; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-798ac096db7si1694377185a.752.2024.06.20.09.27.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:27:18 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RQ6euKiK; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 030C83893675 for ; Thu, 20 Jun 2024 16:27:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id 43374389000C for ; Thu, 20 Jun 2024 16:24:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43374389000C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 43374389000C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900682; cv=none; b=evnkpBSAW5lgnqebLIME5jklN0GPdjW3NUfJGjZyc/x2eykD5K0wFMAhXXOPsX78wIRc86x/YwvgT0z6i5ndv2lVFdoh8AgDSvDY0TpoL7XOd6TPeY9Rr8/8Rj5DwUvnCmFTByoVeARG0Y4mS6imrpLxMpyYkNUOwXb31DENSgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900682; c=relaxed/simple; bh=xqTHXBiOiQ4J4f1sokB8ZtOD8QdaqRy5yeb7o2jjiqA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=rvp/dUayjMU8XZtGl5XkZUDiOEJHBB7hDbChoXgNrnhb/uVGxK6FfOT9bDW0XNv6Ulxt7Ar0HeTPOORo509DC6CMp4lR/Tm9ejsURavbVpWTVtE8i0qqxY159vbBH8txxdjrVXupXeMLzaGOXMwpCyNSazLejbMcC8OJkd2u/qw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D9CFC621C5; Thu, 20 Jun 2024 16:24:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C1EEC4AF07; Thu, 20 Jun 2024 16:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900677; bh=xqTHXBiOiQ4J4f1sokB8ZtOD8QdaqRy5yeb7o2jjiqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQ6euKiK6VwJDxRKXDYXKkMxwqA9niEIEbzdfAQwitBbSpJdGv45x6KaIQuMDG4bV kwbXvrBf8QrSE5d30scR0+5bbzMw9uHigxaxVLi6uPpj4Wg4PNJsysp3vr3oEQW8BR ub66lfagcFK6JB/7wBvTbSTD9mXLYE0/FZ8A6pQmsu2V0i07+pv7D50QprJCKwG2Jd KOyYM0IDo1Y+GFVBlpz0+pnklNWjIUgVB5MXwc/c7ELXo3x/qgau81tHvAiJE2pmvu AZh3B0fhn3iyeuhMXaEkwLVifgpTrpmYF0iwoRQqsVYYQ3pVoqyR2S++1ru65GiGD7 Lh2JFlkaIi1UQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 09/15] sh: rework sync_file_range ABI Date: Thu, 20 Jun 2024 18:23:10 +0200 Message-Id: <20240620162316.3674955-10-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann The unusual function calling conventions on superh ended up causing sync_file_range to have the wrong argument order, with the 'flags' argument getting sorted before 'nbytes' by the compiler. In userspace, I found that musl, glibc, uclibc and strace all expect the normal calling conventions with 'nbytes' last, so changing the kernel to match them should make all of those work. In order to be able to also fix libc implementations to work with existing kernels, they need to be able to tell which ABI is used. An easy way to do this is to add yet another system call using the sync_file_range2 ABI that works the same on all architectures. Old user binaries can now work on new kernels, and new binaries can try the new sync_file_range2() to work with new kernels or fall back to the old sync_file_range() version if that doesn't exist. Cc: stable@vger.kernel.org Fixes: 75c92acdd5b1 ("sh: Wire up new syscalls.") Signed-off-by: Arnd Bergmann --- arch/sh/kernel/sys_sh32.c | 11 +++++++++++ arch/sh/kernel/syscalls/syscall.tbl | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c index 9dca568509a5..d5a4f7c697d8 100644 --- a/arch/sh/kernel/sys_sh32.c +++ b/arch/sh/kernel/sys_sh32.c @@ -59,3 +59,14 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1, (u64)len0 << 32 | len1, advice); #endif } + +/* + * swap the arguments the way that libc wants it instead of + * moving flags ahead of the 64-bit nbytes argument + */ +SYSCALL_DEFINE6(sh_sync_file_range6, int, fd, SC_ARG64(offset), + SC_ARG64(nbytes), unsigned int, flags) +{ + return ksys_sync_file_range(fd, SC_VAL64(loff_t, offset), + SC_VAL64(loff_t, nbytes), flags); +} diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl index bbf83a2db986..c55fd7696d40 100644 --- a/arch/sh/kernel/syscalls/syscall.tbl +++ b/arch/sh/kernel/syscalls/syscall.tbl @@ -321,7 +321,7 @@ 311 common set_robust_list sys_set_robust_list 312 common get_robust_list sys_get_robust_list 313 common splice sys_splice -314 common sync_file_range sys_sync_file_range +314 common sync_file_range sys_sh_sync_file_range6 315 common tee sys_tee 316 common vmsplice sys_vmsplice 317 common move_pages sys_move_pages @@ -395,6 +395,7 @@ 385 common pkey_alloc sys_pkey_alloc 386 common pkey_free sys_pkey_free 387 common rseq sys_rseq +388 common sync_file_range2 sys_sync_file_range2 # room for arch specific syscalls 393 common semget sys_semget 394 common semctl sys_semctl From patchwork Thu Jun 20 16:23:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806001 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378477wrt; Thu, 20 Jun 2024 09:26:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMLDgXKSQtGS6Sz4LAHpAPD8ZjPMo+QNLNMFJP40YZUnfu52Xa7J8KlHqrc3DDFM2g/hu8dckKeUjKYq7eam7d X-Google-Smtp-Source: AGHT+IGeNU3t8w9fUyMLcZs2x8HG9ieHZTWaVzSDboToS0trSw0O/fSlrb5ZHPTanlOPVl66q1oR X-Received: by 2002:a67:ee09:0:b0:48d:a9f2:4803 with SMTP id ada2fe7eead31-48f02b2aaf0mr7829745137.3.1718900773446; Thu, 20 Jun 2024 09:26:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900773; cv=pass; d=google.com; s=arc-20160816; b=G2LynAXqqqIN20+JCKfDmnmEiniZrdg9c9j+Twz8IQ4lDQBzVenUk21oZhHfGpp4D0 hEOCMw8zRB6ookEpvm9PFJnjUcD6iVyh2/4IVcWyH3ey4kHp0fpgjzvyji9fct7DeUso w1z9UnSv0dHOiL04G+56UV2t4HCWMxVZpF5EhAxYB5aGPO3oYPq7+AQdXcczOzvcTa2r nN9b2DNyGosKnrRWDiXohQqK0zd80G+DpP/hmK4CJOyyRXxsuM8k9QNyxX1PH9NvZ2xU eeoRSqz5SkxYoqpxvVlPSP12aSRm8EyutBe5/DwAb+saaXQSHPfGtj42pSIX3BODVCpN MHJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=N9/T8M70u7br/0OAbMgQmKNpJnJxFprX6sr02Qo+G48=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=i4grdMfJl/oSHGS/INUni80/R1kR7aR0AySEA9PynPHi/nFXz/4elHg320RvymsGgb jT0t0pqCHbXNW/IZ7aFKkVpVFGHdKOeJmGTlzsJVHIaGMzc/NJ1Q3ZvkVnB66o5a1C0F rtr/oxUCYSRKZHXiMCcIeecGgwS0MbgQ9K4p/qP6W2MEwwgDywGxle3G3B5YNRNcZare 1h7ax1ugx9dTFFTIk5m1bUt0H8yoySSlxAvOGfJuhDWQc8r5TwHD0tq5YzSItzYesXqh joUIKPXe00xmyIhMxW0xEfD1iynORvzb/fy1JbcY3Klfz7J7lc6sf3FLatg76ylImUXj Darw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dEQH6j2t; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80f65e59163si376132241.107.2024.06.20.09.26.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dEQH6j2t; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0FBE638930C1 for ; Thu, 20 Jun 2024 16:26:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id 6219438930C1 for ; Thu, 20 Jun 2024 16:24:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6219438930C1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6219438930C1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:40e1:4800::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900694; cv=none; b=aGt5f2DgGkDlIcNtjmvgGRfcCC97p2La4piir6aAMeS1/KkZlhoY3zDU0Zfinvp99aujX6Dbqfibc9bZs95u93VRY2wyeMOC42Qf+hsLrCgVfKm4IxURqIwZkuMOfbTz6OpfhBCoS3oJJHuX9tktcTExgGLj9Y8F7NK0Shw8h3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900694; c=relaxed/simple; bh=+a57zGsAJyEAahaUfY2ckDfX8ym58urOnfoM/RSmrcE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OjygyjHk8oRsJtEwHpCcXXhO4FNKq6+X8otkWxCLqlyluURc2pFgKP4Di12uwFB1rtnXyZwdI8kSgDbsvLZwOQ0lJ3dKgr6q6LMcom07G1l2/PGs9VdmCBzksdc/z/VSkv0EOiHwHPdehLuVac+flbhjAywRQyeM6IQi4T91R5A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7E5E3CE2741; Thu, 20 Jun 2024 16:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10432C4AF0B; Thu, 20 Jun 2024 16:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900684; bh=+a57zGsAJyEAahaUfY2ckDfX8ym58urOnfoM/RSmrcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dEQH6j2tUvEM6XSIIbcvx0uQwAkrexBIykSIcZUTXPBXVhMpT0EluDNW8uUheYzrr KlLrppZbU7TbVxxzLqfrVqrt1AySyxMJyhjJF9eFP9M1aRYDkW/CChJzE0kYE1G2Af WKAYgwz90Kr0xbqTg53P6Ul1lSqWkBCpFf7jigslVb33ET8939RpRBRdLl9Ew9XvS1 XuGHy2PyH14F7akZ3UPCVznpDjLJJRAGk2n17J/gSUWOGFRs2cJt4tPb0rKEmHl8eB RewUq0kiVkPfTVoLoT3itzbuHuTe4ukcWKAlAXdkC0jsRRMg/Y6t+sVXafud3or+7v 1S7NlICwmq5Ew== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 10/15] csky, hexagon: fix broken sys_sync_file_range Date: Thu, 20 Jun 2024 18:23:11 +0200 Message-Id: <20240620162316.3674955-11-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann Both of these architectures require u64 function arguments to be passed in even/odd pairs of registers or stack slots, which in case of sync_file_range would result in a seven-argument system call that is not currently possible. The system call is therefore incompatible with all existing binaries. While it would be possible to implement support for seven arguments like on mips, it seems better to use a six-argument version, either with the normal argument order but misaligned as on most architectures or with the reordered sync_file_range2() calling conventions as on arm and powerpc. Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann Acked-by: Guo Ren --- arch/csky/include/uapi/asm/unistd.h | 1 + arch/hexagon/include/uapi/asm/unistd.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/csky/include/uapi/asm/unistd.h b/arch/csky/include/uapi/asm/unistd.h index 7ff6a2466af1..e0594b6370a6 100644 --- a/arch/csky/include/uapi/asm/unistd.h +++ b/arch/csky/include/uapi/asm/unistd.h @@ -6,6 +6,7 @@ #define __ARCH_WANT_SYS_CLONE3 #define __ARCH_WANT_SET_GET_RLIMIT #define __ARCH_WANT_TIME32_SYSCALLS +#define __ARCH_WANT_SYNC_FILE_RANGE2 #include #define __NR_set_thread_area (__NR_arch_specific_syscall + 0) diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h index 432c4db1b623..21ae22306b5d 100644 --- a/arch/hexagon/include/uapi/asm/unistd.h +++ b/arch/hexagon/include/uapi/asm/unistd.h @@ -36,5 +36,6 @@ #define __ARCH_WANT_SYS_VFORK #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_TIME32_SYSCALLS +#define __ARCH_WANT_SYNC_FILE_RANGE2 #include From patchwork Thu Jun 20 16:23:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 805999 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378465wrt; Thu, 20 Jun 2024 09:26:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOsNYhVX19D1NkhjvTBrgeSt9t/IKeDhpfI4XXce/KddJInNynDWGWdWGMn32VR3qqm4LVQftfBz9SO2G/l2lg X-Google-Smtp-Source: AGHT+IHJYjj+GLT7NZYxp0cLgZn5QsdePZ9KndhGm2p7zHozC7Lu39yqDF5O+iQaDuOTH/coWQBf X-Received: by 2002:a67:f49a:0:b0:48f:1782:c26d with SMTP id ada2fe7eead31-48f1782c3d5mr5321599137.27.1718900772353; Thu, 20 Jun 2024 09:26:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900772; cv=pass; d=google.com; s=arc-20160816; b=yUzJHuJpEwhqKY+Qeew0TQvedl3mTLxTh4ocTZvYpK6GydgD02yyWKXRGwSH+puH4E bvLJRy8j6k071wpvSJpIyWlHHA7tedvaoZ0jMw8V+DkJ8RoCcrqj2HY4x9HLPwv+V20h N0X3nhfXs78AS1mm5iM7KrbD+JlfieSWjrc4826cqdgykofMjEccVX37K7yNd+OTjGvJ QnNuE1dfYS0oxVjetBeD+GJN1Pu9KIfb2UVnKL7Y4wXJZWyarlVX5XwKPCw+JFu1toyE LRtM/CSDA381z4T5NvkIV5iIIr51Ixs0nkvoLRBNQomd9NOMfIDsOovi3n4/lZzebFU2 sJrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=CziElLPuHTSKYbxdCeLmGf3AuIz4XMkaqSzFyCfNlSI=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=OdT+ZietQ/Fnc+yA53twZNVZ5QRxL9PmHoB6V1kCf4mII9AyRAiEFSeo0Vr/2XgxWI 0vrqeaUUuUSA4RzfpeW+yeaDy+z+K+ZWGMPpyBavsQ9m957nNgjNhI+lUQJAhOER0xfQ lZRrJ6ZmVUSFdfRHkwtA9EgVGgbXk5CrICv65klamX44JJgDNZPyNSUao+IaFO05dlfT BnMTePcUXQ7XmGiXcGmCq3Ctd6nXbx4yn93QFLrVVRgUmO/Nez4gq9khB/xpjP3QQNYf gpFtu30Nfpld4xf+Txe7XieuoE2GKE2OCR/ePEGDZ+GSVZCHeo5v9wAsGeDmo7zKqFSC SE0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="liP+clW/"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ada2fe7eead31-48dd1ee91fcsi2153297137.799.2024.06.20.09.26.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="liP+clW/"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AFEB93894C33 for ; Thu, 20 Jun 2024 16:26:11 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id 6ACD13892474 for ; Thu, 20 Jun 2024 16:24:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ACD13892474 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6ACD13892474 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900696; cv=none; b=BhNFIEKY5+kaHOb+AZz5lQpJdcTwCV80XQb/b1QMxSGLt59PdifYlkhlOCg9z/P/Li0sZ1q/ZpNSAXl+L0RZwoFgH8Ac5vTQ4t+UT2hTFGMOlHBjXvFA3yWKqWjcIQzr1SOEjBzKqMZrYEXGxNPyoSr4JNK+nu8eCy2eb2grdS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900696; c=relaxed/simple; bh=CTMiij8diPtp23L47nQHWXQrj3MX4OJNEzgig287ZPA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=hPmtJYQcJmSvJ8EmaoEaH+KopGEbKwjUsbiDfiooMBe2kGkf0/8zAXGJLCiQo4+hLfuI6AWf5QrQLehiN7ltqI5LkZ3ytSMVsGB/QJwI00sas7HDzBK1/iCeapsDk59zckqQfc44gXpb1bUUJwkCftUYihT49x/ndxIuDvCcAMc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D4CB9621EF; Thu, 20 Jun 2024 16:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DEAEC2BD10; Thu, 20 Jun 2024 16:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900691; bh=CTMiij8diPtp23L47nQHWXQrj3MX4OJNEzgig287ZPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=liP+clW/FYJDMFwHv7e2XTi4LYa5eTnDyL47NLmiZ3cdTxaeJVM6WiqLSOvjZXten pE6JYMMTtK2vXsP1OXrG0X/wzRuupXj07RgRMay50dms6iT69PyESvm8MZAALUCwW6 ScElgo7HBzd1he0cQvkNBktxqXYA3+ZQp+4j7Eyi0zUX6iTS+26CH6314rMnHOCsxp 2GZ0MxgqvDjTVnlva8n8/w9P6j9/14JsdOE3xslLC/hd1U15iSxzjY7Gdw5OPMjGTi FxE0zxbrXL4hhuRiBxV9AFKTmJuqA88W9aUdlZqe/hk7lAm9X+hHNtXkp5bF7KXdDP LnYwGSfr5+nRQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 11/15] hexagon: fix fadvise64_64 calling conventions Date: Thu, 20 Jun 2024 18:23:12 +0200 Message-Id: <20240620162316.3674955-12-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann fadvise64_64() has two 64-bit arguments at the wrong alignment for hexagon, which turns them into a 7-argument syscall that is not supported by Linux. The downstream musl port for hexagon actually asks for a 6-argument version the same way we do it on arm, csky, powerpc, so make the kernel do it the same way to avoid having to change both. Link: https://github.com/quic/musl/blob/hexagon/arch/hexagon/syscall_arch.h#L78 Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann --- arch/hexagon/include/asm/syscalls.h | 6 ++++++ arch/hexagon/kernel/syscalltab.c | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 arch/hexagon/include/asm/syscalls.h diff --git a/arch/hexagon/include/asm/syscalls.h b/arch/hexagon/include/asm/syscalls.h new file mode 100644 index 000000000000..40f2d08bec92 --- /dev/null +++ b/arch/hexagon/include/asm/syscalls.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include + +asmlinkage long sys_hexagon_fadvise64_64(int fd, int advice, + u32 a2, u32 a3, u32 a4, u32 a5); diff --git a/arch/hexagon/kernel/syscalltab.c b/arch/hexagon/kernel/syscalltab.c index 0fadd582cfc7..5d98bdc494ec 100644 --- a/arch/hexagon/kernel/syscalltab.c +++ b/arch/hexagon/kernel/syscalltab.c @@ -14,6 +14,13 @@ #undef __SYSCALL #define __SYSCALL(nr, call) [nr] = (call), +SYSCALL_DEFINE6(hexagon_fadvise64_64, int, fd, int, advice, + SC_ARG64(offset), SC_ARG64(len)) +{ + return ksys_fadvise64_64(fd, SC_VAL64(loff_t, offset), SC_VAL64(loff_t, len), advice); +} +#define sys_fadvise64_64 sys_hexagon_fadvise64_64 + void *sys_call_table[__NR_syscalls] = { #include }; From patchwork Thu Jun 20 16:23:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806005 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp379369wrt; Thu, 20 Jun 2024 09:28:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJL8wPJnyir/nlplUOOxRLK5biz5KC3z+ljdaAePdl+aJ7yKxTNR9tu5ZmTHs1Zz0Se1iGIZmSzkOsFythNEwj X-Google-Smtp-Source: AGHT+IHLWbW/nV5c4t+3h8wGfIw8M8GywoQIjeim6h6K62jkr0JdTTsqAev55KNlblMBOCLDQBkL X-Received: by 2002:a05:6102:3959:b0:48f:1395:d07a with SMTP id ada2fe7eead31-48f1395d12bmr4803355137.10.1718900882305; Thu, 20 Jun 2024 09:28:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900882; cv=pass; d=google.com; s=arc-20160816; b=Cd0Rf1gK081d3GnSKK+fI27/+jY476o9Z4NdCqXDMqiYD3DrjuQ57645PT5llWZDUt GmX0P/cuEXnL4Pzo2mLxn4PuJvmf2NqcUw9RDHCZyWrHMO6H0tKfcyzO6tZVN+RrgHL1 qaeBwYy5rNktlimsiIkuBw6UmYf1TxSmU0h3mROUTezw6f7qJXXFlKJMinLLDcu1OT4r 60N37A1IonZMCX3h1TmaxBa0FCFZ8nrQF4u13VFq6obVbtI4qqbbvG0kaHVxnm+E1woX chZ1cgYBCcscLS47HzH2ZGpdOPLUfjq/Z/gxH6R2SXfurEOzDetNQQEtQ6NRPPjdMCss K9eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=O+42lI9Ix2yF3yWrdA4ldwIUvI3kBOi/acfsUpFDsEk=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=RfMyy0eGdy1VYVLz1NSY9dZjwUmZyKtLTGqxvdOBII3LDBgwTdc/QrAgiaGV44PFVF ucGXrZ5EjMcD1BIfmQNTNC+78e4ZP0oxe/BUOm+bH+Kjs+yXOwRnRbROQUXQyC2gYam2 3uGhz/frZkdQeg30YDrguzPHa8dZlDfMVK9S1kbeua3F7LYoCxUIOSt2cml6VTCaTae0 82zBy+EfgvflTqJt8RXxCd+S+ofALi/pz/rYBmcyClUeGIFMjQMhySp68ZvZyOOumcOx 5BPgYdeif+m2kZs+c51QsYQ1aHEflCq9QUtjfCct+tSYWP7HfLtSSI8dTEBDblWYzumV a6Pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="abvyrJ/X"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ada2fe7eead31-48da44b52ddsi2646193137.676.2024.06.20.09.28.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="abvyrJ/X"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E599E38930C1 for ; Thu, 20 Jun 2024 16:28:01 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by sourceware.org (Postfix) with ESMTPS id 050F63894C14 for ; Thu, 20 Jun 2024 16:25:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 050F63894C14 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 050F63894C14 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=145.40.73.55 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900703; cv=none; b=BKRyHV0Ok/MdlTV3pwcicvTWRH8db7snzdFi0UCqeNHZi2E9ZjRiECBbKw8tFLKO3wDQn93bUWG3TcuDCFdlXp7pbek8fyt7T7LA8DzCYpIfmQs0I2mtqSE0PqDs/9KPlOxZIJ1P6d0oMZyc+CyLCQEP6a7cia97KxX3kycJjbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900703; c=relaxed/simple; bh=9tNBDm896BjzUxmnfvW1e6haCDwe3E/atZfPgTf6dvM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=XBGYPzCx1T0zxVE2gyn8Fpv3BUXNq1K/YQt+PZnenGzV0HTemNU5q5ZLRqheyJdamuAgeq0v6qAIFSvFJ7J6MnYlr7ZXIH6MX+ScvXK1hl3/VL1RmJhxpMXfJyOOqViyxMPKtheKZgOMaBUxHZIhYOz19APi6mYMFmpjR2EbUME= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5D49ECE274D; Thu, 20 Jun 2024 16:24:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AB57C4AF07; Thu, 20 Jun 2024 16:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900698; bh=9tNBDm896BjzUxmnfvW1e6haCDwe3E/atZfPgTf6dvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abvyrJ/X+WgKBcKLB26W63xGzrJswPTiNJDtrvePABOWadxaiMVdFVIIrjjZH7EMt i3yfbG9sxIhKzIMCfECn8jajIwt5EnHTKwWgtPNsnEm6eH5VPX4iHwPOT/KLGXygLR Y8UtKQhQMTPuDEykuGSASDGG1jSbMq6hu59HuuOGBaXNiJXkV1zooHon61XOPITCpE SFmK3OLp8gXcumhP0tivnIEFTlCHa7lpiLvSg28jj4kABCTLi6W7v8y4Et1OD6DAcD 5NN8lrWx/ZkRbGl97bKzVpQphPBlvW7EqUaJZymCAafGjzXa4xCR+daUY33mNKb8As 9i6pj/PklBLgw== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 12/15] s390: remove native mmap2() syscall Date: Thu, 20 Jun 2024 18:23:13 +0200 Message-Id: <20240620162316.3674955-13-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann The mmap2() syscall has never been used on 64-bit s390x and should have been removed as part of 5a79859ae0f3 ("s390: remove 31 bit support"). Remove it now. Signed-off-by: Arnd Bergmann Acked-by: Heiko Carstens --- arch/s390/kernel/syscall.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/arch/s390/kernel/syscall.c b/arch/s390/kernel/syscall.c index dc2355c623d6..50cbcbbaa03d 100644 --- a/arch/s390/kernel/syscall.c +++ b/arch/s390/kernel/syscall.c @@ -38,33 +38,6 @@ #include "entry.h" -/* - * Perform the mmap() system call. Linux for S/390 isn't able to handle more - * than 5 system call parameters, so this system call uses a memory block - * for parameter passing. - */ - -struct s390_mmap_arg_struct { - unsigned long addr; - unsigned long len; - unsigned long prot; - unsigned long flags; - unsigned long fd; - unsigned long offset; -}; - -SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) -{ - struct s390_mmap_arg_struct a; - int error = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - error = ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); -out: - return error; -} - #ifdef CONFIG_SYSVIPC /* * sys_ipc() is the de-multiplexer for the SysV IPC calls. From patchwork Thu Jun 20 16:23:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806006 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp379666wrt; Thu, 20 Jun 2024 09:28:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXVHiNZaaS6nVEtitZ8ypRdKZdWDQyK2Zm0wEv2hpJOKX89mmc1hs9yIimgYIQw0zlLYliUWo1flMZAzK02u/K X-Google-Smtp-Source: AGHT+IGf1Ug3VMy8AwajhoUfqFECCLYtCHAeRryxZ1uUveoXInkce/acMbbGasb4DkMmn4KyZW6R X-Received: by 2002:ad4:5bae:0:b0:6b2:a36f:3118 with SMTP id 6a1803df08f44-6b2e23826dcmr167392886d6.22.1718900916228; Thu, 20 Jun 2024 09:28:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900916; cv=pass; d=google.com; s=arc-20160816; b=Ogz8Z6ZLwIEQNq+SLGj6YsXmMr2HgaovQbH0PYuxITFfKT8pFDeK0hUmZNc2jAU2OM JQfjUEEW0t7TduFifG5/cKySx7E+QwQ+I1hXenFK9fT1G1fz8mfIw/qzQAAzQX5oe+kg Apms5F6PRigyHmCOWKHcBwHxbg+cFLiw5rMe3AtXjK5SE7o0XCUVyaS7X4B3s10YxK8e gP/V4iRJR0VLtJvhkPyEZpsw8iZaRmebRQixc9OtbK23FDAhu/9RZ189LfaaFUYAEK6c mRUmIISq03o2C/GfyBpkcdbI8P4seidVkiord+81elrk8iONnscTxcfloGKk0MJr8jEU EeNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=2hu5UhjwC1eLUsRyhRoY0VbfG7QceNiHQECI0lI9G38=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=c4aY6E8+ZjsDIkGByO4B8j/3L1UqeonriG7Ml0BrEesG2xSqQxDe6DVha50grDAy9v Dw6MYwj+dwEwPhbyZkJKgAIoX9eBVPqMmLRfk5RpTyKGK3+gVGY8inhOG8gbaoiBSkNU fxmKKHa+2oRFtGzzf7Tx6oAVB5z+D9kJFcJgxIUjPRHh6d2I18Zio9PnyiadZ7cj0p5a 37HJ0/8vcU7Z4RZrECbzyOZwwwQo/VYGABovZhvPX64W78mFU1jvWJYbrmkCdUIw3Oaa /tv6WSqQhlIc51ylpeH6QaH6sovUkZak7VlBdkaHzu47peexg2/kV+mNK2z7sJTlGhiv uD2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L4I6Oy4U; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5b7553esi1870626d6.519.2024.06.20.09.28.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:28:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L4I6Oy4U; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D522F389000C for ; Thu, 20 Jun 2024 16:28:35 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by sourceware.org (Postfix) with ESMTPS id 23F403894C3C for ; Thu, 20 Jun 2024 16:25:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23F403894C3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 23F403894C3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=145.40.73.55 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900711; cv=none; b=x/lWirnB2hXcN0qFw+spvRP4Z2PBATv6msi+dKZHQvsaln60XY81Eqj2fJ3ByoeXaDGkujiMVho4ionIgnjCuc7Jx44wJIVhhyPQ9cmHz60FB0W/218zHEB60P+0hG3yh+WQeN+27gFAgckap6i4sQYjmGC/Zwx0xpYloPZJ7o8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900711; c=relaxed/simple; bh=cPi0ZjnBV1CIKlXBkpBvG5fVNflJ/ABQ595U6A2fdNY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Q0AsOB3MM215O740OBOH1KV8pJJ5mG8LpovYtqNkTx3ylhGkSBZTY/p+S4kcjTSl7Oob/GakY2sBGn/Y67Y9K1iXqP+QI1mQdtP56Q12JNZ9sBUZ0uNKOt4RwuaKTmBQ8POjQYEqE5kTNmM49exJ3wMYrVlNH56kZYacmUVFyMg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 29220CE2429; Thu, 20 Jun 2024 16:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3633C32786; Thu, 20 Jun 2024 16:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900705; bh=cPi0ZjnBV1CIKlXBkpBvG5fVNflJ/ABQ595U6A2fdNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4I6Oy4U9Tj4R13eiK7pqNG2CXsWUIjkycJBnYKwfQOrvpBUldFWwHt5fforf8qGO W7ImwPMXiKO8CaPCzUM0SFq2R8ogOIYhE4DzW2jwybln/I37fOpfNvMxVAVrrdaDoS WUi8sCz8As8NoYFsujUNcySYE3BhqLiI+fdifQAzyfs9GESJFzoOrwAaRenVvMUVkG XnNmh77sKBmccGcKyq697GncV2zjKoPPWOKYtfbRLPaDFIGaZyswOD5mh9kmoEczBR MmqXf5vABoIwXanfGd9nvrIo6xDYMJfqhkmt6FUeNA/P7TOQqjAij0rew7x9s74LHq xobiBExDOIVlg== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 13/15] syscalls: mmap(): use unsigned offset type consistently Date: Thu, 20 Jun 2024 18:23:14 +0200 Message-Id: <20240620162316.3674955-14-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann Most architectures that implement the old-style mmap() with byte offset use 'unsigned long' as the type for that offset, but microblaze and riscv have the off_t type that is shared with userspace, matching the prototype in include/asm-generic/syscalls.h. Make this consistent by using an unsigned argument everywhere. This changes the behavior slightly, as the argument is shifted to a page number, and an user input with the top bit set would result in a negative page offset rather than a large one as we use elsewhere. For riscv, the 32-bit sys_mmap2() definition actually used a custom type that is different from the global declaration, but this was missed due to an incorrect type check. Signed-off-by: Arnd Bergmann --- arch/csky/kernel/syscall.c | 2 +- arch/loongarch/kernel/syscall.c | 2 +- arch/microblaze/kernel/sys_microblaze.c | 2 +- arch/riscv/kernel/sys_riscv.c | 4 ++-- include/asm-generic/syscalls.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/csky/kernel/syscall.c b/arch/csky/kernel/syscall.c index 3d30e58a45d2..4540a271ee39 100644 --- a/arch/csky/kernel/syscall.c +++ b/arch/csky/kernel/syscall.c @@ -20,7 +20,7 @@ SYSCALL_DEFINE6(mmap2, unsigned long, prot, unsigned long, flags, unsigned long, fd, - off_t, offset) + unsigned long, offset) { if (unlikely(offset & (~PAGE_MASK >> 12))) return -EINVAL; diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/syscall.c index b4c5acd7aa3b..8801611143ab 100644 --- a/arch/loongarch/kernel/syscall.c +++ b/arch/loongarch/kernel/syscall.c @@ -22,7 +22,7 @@ #define __SYSCALL(nr, call) [nr] = (call), SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, - prot, unsigned long, flags, unsigned long, fd, off_t, offset) + prot, unsigned long, flags, unsigned long, fd, unsigned long, offset) { if (offset & ~PAGE_MASK) return -EINVAL; diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index ed9f34da1a2a..0850b099f300 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c @@ -35,7 +35,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, - off_t, pgoff) + unsigned long, pgoff) { if (pgoff & ~PAGE_MASK) return -EINVAL; diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c index 64155323cc92..d77afe05578f 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -23,7 +23,7 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len, #ifdef CONFIG_64BIT SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, - unsigned long, fd, off_t, offset) + unsigned long, fd, unsigned long, offset) { return riscv_sys_mmap(addr, len, prot, flags, fd, offset, 0); } @@ -32,7 +32,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, #if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT) SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, - unsigned long, fd, off_t, offset) + unsigned long, fd, unsigned long, offset) { /* * Note that the shift for mmap2 is constant (12), diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h index 933ca6581aba..fabcefe8a80a 100644 --- a/include/asm-generic/syscalls.h +++ b/include/asm-generic/syscalls.h @@ -19,7 +19,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, #ifndef sys_mmap asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, - unsigned long fd, off_t pgoff); + unsigned long fd, unsigned long off); #endif #ifndef sys_rt_sigreturn From patchwork Thu Jun 20 16:23:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806002 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp378547wrt; Thu, 20 Jun 2024 09:26:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWshhxw5ytQn7DwUar59CWhXif/Bir4WEUj03/wvOd789LOmmL4DTlxm4XSXztf4RElYwe8h2DntUjdnR+ffHLX X-Google-Smtp-Source: AGHT+IG3MMxbyMtq2GGSZy3tTicikb0h2oGiasjOHxGiGE+K8ljMxYaDoY2PNyOSKWV42Ior2m36 X-Received: by 2002:a0c:9a89:0:b0:6b4:fd24:95f9 with SMTP id 6a1803df08f44-6b501e4cce6mr60813726d6.38.1718900782977; Thu, 20 Jun 2024 09:26:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900782; cv=pass; d=google.com; s=arc-20160816; b=TEbmMWrdCjx5z7B98oHWtmwvjITfUU0BZowkx9NISU/YWKuvdLd1N5EGhglj5UmwW9 FpATAr6TQk741U5GOAbzpgilhCrydmY8DGHZXjjjplNoemjjU+LSf0pOmqa2jmNcq1Yp H+sekUANkCrK3i8vz4c/a5w1p+Y7/Qn7jiQIcNg10MR9H7gFC+YmDtN6YHfeiAo89KjY t1X2ojG3ntbfUuRXF4JIpDlB4ZaJjQ882dac6J9K4l0UaDR9EdXglniKVY3OCa7dD6+D m42FNMFSFbuAvAku8SsACW8+TeZZnarULW0QSIj49o/m9nPYPr9BGmFcfDxOpDgc/XWT aFfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=8aY5ZnsO8f6BHQ1Zg56dky4cQYB+TS1OK0TElSrlmT8=; fh=z7WBpRnpEcajsi+eCrB9be3IBpnFpuOD2qMP8Shfqmo=; b=RrLbuH1NTbESFcSrxe8kJGSej2Cna2GFYzbB79H+XvARgLLtGgTe//nlSJnt8+fAl+ z5b5IWA5jVw5EmdLHFjGP+bq03dNEkMpHabzMK1i8/4+1VPs3J9+gGVSsLSumIAIScXU wzQsl/NGIjJpsxeC6hm0Qe5XVcc0A4RlWmlpwmIUvZ1Q6Irjrs6aI2C8aF1mVJJ2j7kX 7UsrWEIHTQF76WQJYNx/NFeufw2qE/E+EWHUVwt0dPukBssvO1WWQXncoU7tt7NEIyqH aVLWeKjzbK+Lxappm+hey+x4UI7ALTG0NXtcW+QXgHg1EBGrVcbOvAzdTI2fFYuvRDzT YC0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mmS8IYAQ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6b50d1e0cc0si29057826d6.335.2024.06.20.09.26.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:26:22 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mmS8IYAQ; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8FE143896C32 for ; Thu, 20 Jun 2024 16:26:22 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id F39183894C08 for ; Thu, 20 Jun 2024 16:25:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F39183894C08 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F39183894C08 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:4641:c500::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900718; cv=none; b=BsSeoh1/5txxWH9cUPpY8M6LEdfG4Np6cHoFtARH6Nj4j+4zqGpDkG2BReGBVWS5ILETD3PcaiBsfluKs1RpeR5317JWt70LAI6rmD7gihMmd9GZ8KA2a7RvZ4cQAnKm8BGNReNFlyNzx4bTXS4fGEo5iLw0A8FEbuAWtNGhhoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900718; c=relaxed/simple; bh=DmBAxbeYTBncX5bl/HvCmLsEpHQvV2w2CK/NjV0qTMw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Szevs39qsiURGmcIBwQXyo7DYxv5mzTi0k8kBmSVpVehlzHUqonS2mqorl2V+O5oxamTZfSmy6LDp9QOAMVXwkFdyv99GN3KK/ajNmsDcLzHbdC562dQ2vNOtZqAXlOw3qU+OLm8PApdp8QQ3WB3mXPdu7PoMzUK47pVL7ERcgk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 76773621EF; Thu, 20 Jun 2024 16:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A27D5C2BD10; Thu, 20 Jun 2024 16:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900712; bh=DmBAxbeYTBncX5bl/HvCmLsEpHQvV2w2CK/NjV0qTMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmS8IYAQWW69dqUsoOQK9VgMXj75HkeXssxpRMqHnXS7IEXYdB8lDpuV539MnmBAh s5gbZn3TjHFYOMff/qbOKiB91FcdJJ/B1yEBb87oOBGhFSSYAdGQ2TItgY+Uw8EkGX g3gJpNwiRu+JLbhJ7yhZWxOK3wGEsIi6ljHwvnrJ2xTSutwPldayRZs/di4mcOMrbT llX1acIQCyrfixIxAG/jVId1PA68MhgRz9IalJBS/cPw2/WhuLizVaP4BajooQVYtC /KGI86ltLy3bRQy9J9vDepyHlhzcDRFgo8sX9ImC4EISDALjAc1kQaLDqQ5ZoGgC1c GJtOFr4c9ZTEA== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it, stable@vger.kernel.org Subject: [PATCH 14/15] asm-generic: unistd: fix time32 compat syscall handling Date: Thu, 20 Jun 2024 18:23:15 +0200 Message-Id: <20240620162316.3674955-15-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann arch/riscv/ appears to have accidentally enabled the compat time32 syscalls in 64-bit kernels even though the native 32-bit ABI does not expose those. Address this by adding another level of indirection, checking for both the target ABI (32 or 64) and the __ARCH_WANT_TIME32_SYSCALLS macro. The macro arguments are meant to follow the syscall.tbl format, the idea here is that by the end of the series, all other syscalls are changed to the same format to make it possible to move all architectures over to generating the system call table consistently. Only this patch needs to be backported though. Cc: stable@vger.kernel.org # v5.19+ Fixes: 7eb6369d7acf ("RISC-V: Add support for rv32 userspace via COMPAT") Signed-off-by: Arnd Bergmann --- include/uapi/asm-generic/unistd.h | 146 +++++++++++++++++++----------- 1 file changed, 94 insertions(+), 52 deletions(-) diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 3fdaa573d661..e47c966557d0 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -16,10 +16,32 @@ #define __SYSCALL(x, y) #endif +#ifndef __SC +#define __SC(_cond, _nr, _sys) __SYSCALL_ ## _cond (_nr, _sys) +#endif + +#ifndef __SCC +#ifdef __SYSCALL_COMPAT +#define __SCC(_cond, _nr, _sys, _comp) __SC(_cond, _nr, _comp) +#else +#define __SCC(_cond, _nr, _sys, _comp) __SC(_cond, _nr, _sys) +#endif +#endif + #if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) +#define __SYSCALL_32(_nr, _sys) __SYSCALL(__NR_ ## _nr, _sys) +#define __SYSCALL_64(_nr, _sys) #else #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) +#define __SYSCALL_32(_nr, _sys) +#define __SYSCALL_64(_nr, _sys) __SYSCALL(__NR_ ## _nr, _sys) +#endif + +#if defined(__ARCH_WANT_TIME32_SYSCALLS) +#define __SYSCALL_time32(_nr, _sys) __SYSCALL_32(__NR_ ## _nr, _sys) +#else +#define __SYSCALL_time32(_nr, _sys) #endif #ifdef __SYSCALL_COMPAT @@ -41,7 +63,8 @@ __SYSCALL(__NR_io_cancel, sys_io_cancel) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_io_getevents 4 -__SC_3264(__NR_io_getevents, sys_io_getevents_time32, sys_io_getevents) +__SC(time32, io_getevents, sys_io_getevents_time32) +__SC(64, io_getevents, sys_io_getevents) #endif #define __NR_setxattr 5 @@ -190,9 +213,11 @@ __SYSCALL(__NR3264_sendfile, sys_sendfile64) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_pselect6 72 -__SC_COMP_3264(__NR_pselect6, sys_pselect6_time32, sys_pselect6, compat_sys_pselect6_time32) +__SCC(time32, pselect6, sys_pselect6_time32, compat_sys_pselect6_time32) +__SC(64, pselect6, sys_pselect6) #define __NR_ppoll 73 -__SC_COMP_3264(__NR_ppoll, sys_ppoll_time32, sys_ppoll, compat_sys_ppoll_time32) +__SCC(time32, ppoll, sys_ppoll_time32, compat_sys_ppoll_time32) +__SC(64, ppoll, sys_ppoll) #endif #define __NR_signalfd4 74 @@ -235,16 +260,17 @@ __SYSCALL(__NR_timerfd_create, sys_timerfd_create) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_timerfd_settime 86 -__SC_3264(__NR_timerfd_settime, sys_timerfd_settime32, \ - sys_timerfd_settime) +__SC(time32, timerfd_settime, sys_timerfd_settime32) +__SC(64, timerfd_settime, sys_timerfd_settime) #define __NR_timerfd_gettime 87 -__SC_3264(__NR_timerfd_gettime, sys_timerfd_gettime32, \ - sys_timerfd_gettime) +__SC(time32, timerfd_gettime, sys_timerfd_gettime32) +__SC(64, timerfd_gettime, sys_timerfd_gettime) #endif #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_utimensat 88 -__SC_3264(__NR_utimensat, sys_utimensat_time32, sys_utimensat) +__SC(time32, utimensat, sys_utimensat_time32) +__SC(64, utimensat, sys_utimensat) #endif #define __NR_acct 89 @@ -268,7 +294,8 @@ __SYSCALL(__NR_unshare, sys_unshare) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_futex 98 -__SC_3264(__NR_futex, sys_futex_time32, sys_futex) +__SC(time32, futex, sys_futex_time32) +__SC(64, futex, sys_futex) #endif #define __NR_set_robust_list 99 @@ -280,7 +307,8 @@ __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_nanosleep 101 -__SC_3264(__NR_nanosleep, sys_nanosleep_time32, sys_nanosleep) +__SC(time32, nanosleep, sys_nanosleep_time32) +__SC(64, nanosleep, sys_nanosleep) #endif #define __NR_getitimer 102 @@ -298,7 +326,8 @@ __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_timer_gettime 108 -__SC_3264(__NR_timer_gettime, sys_timer_gettime32, sys_timer_gettime) +__SC(time32, timer_gettime, sys_timer_gettime32) +__SC(64, timer_gettime, sys_timer_gettime) #endif #define __NR_timer_getoverrun 109 @@ -306,7 +335,8 @@ __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_timer_settime 110 -__SC_3264(__NR_timer_settime, sys_timer_settime32, sys_timer_settime) +__SC(time32, timer_settime, sys_timer_settime32) +__SC(64, timer_settime, sys_timer_settime) #endif #define __NR_timer_delete 111 @@ -314,14 +344,17 @@ __SYSCALL(__NR_timer_delete, sys_timer_delete) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_clock_settime 112 -__SC_3264(__NR_clock_settime, sys_clock_settime32, sys_clock_settime) +__SC(time32, clock_settime, sys_clock_settime32) +__SC(64, clock_settime, sys_clock_settime) #define __NR_clock_gettime 113 -__SC_3264(__NR_clock_gettime, sys_clock_gettime32, sys_clock_gettime) +__SC(time32, clock_gettime, sys_clock_gettime32) +__SC(64, clock_gettime, sys_clock_gettime) #define __NR_clock_getres 114 -__SC_3264(__NR_clock_getres, sys_clock_getres_time32, sys_clock_getres) +__SC(time32, clock_getres, sys_clock_getres_time32) +__SC(64, clock_getres, sys_clock_getres) #define __NR_clock_nanosleep 115 -__SC_3264(__NR_clock_nanosleep, sys_clock_nanosleep_time32, \ - sys_clock_nanosleep) +__SC(time32, clock_nanosleep, sys_clock_nanosleep_time32) +__SC(64, clock_nanosleep, sys_clock_nanosleep) #endif #define __NR_syslog 116 @@ -351,8 +384,8 @@ __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_sched_rr_get_interval 127 -__SC_3264(__NR_sched_rr_get_interval, sys_sched_rr_get_interval_time32, \ - sys_sched_rr_get_interval) +__SC(time32, sched_rr_get_interval, sys_sched_rr_get_interval_time32) +__SC(64, sched_rr_get_interval, sys_sched_rr_get_interval) #endif #define __NR_restart_syscall 128 @@ -376,8 +409,8 @@ __SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_rt_sigtimedwait 137 -__SC_COMP_3264(__NR_rt_sigtimedwait, sys_rt_sigtimedwait_time32, \ - sys_rt_sigtimedwait, compat_sys_rt_sigtimedwait_time32) +__SCC(time32, rt_sigtimedwait, sys_rt_sigtimedwait_time32, compat_sys_rt_sigtimedwait_time32) +__SC(64, rt_sigtimedwait, sys_rt_sigtimedwait) #endif #define __NR_rt_sigqueueinfo 138 @@ -451,11 +484,14 @@ __SYSCALL(__NR_getcpu, sys_getcpu) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_gettimeofday 169 -__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) +__SCC(time32, gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) +__SC(64, gettimeofday, sys_gettimeofday) #define __NR_settimeofday 170 -__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) +__SCC(time32, settimeofday, sys_settimeofday, compat_sys_settimeofday) +__SC(64, settimeofday, sys_settimeofday) #define __NR_adjtimex 171 -__SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex) +__SC(time32, adjtimex, sys_adjtimex_time32) +__SC(64, adjtimex, sys_adjtimex) #endif #define __NR_getpid 172 @@ -481,10 +517,11 @@ __SYSCALL(__NR_mq_unlink, sys_mq_unlink) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_mq_timedsend 182 -__SC_3264(__NR_mq_timedsend, sys_mq_timedsend_time32, sys_mq_timedsend) +__SC(time32, mq_timedsend, sys_mq_timedsend_time32) +__SC(64, mq_timedsend, sys_mq_timedsend) #define __NR_mq_timedreceive 183 -__SC_3264(__NR_mq_timedreceive, sys_mq_timedreceive_time32, \ - sys_mq_timedreceive) +__SC(time32, mq_timedreceive, sys_mq_timedreceive_time32) +__SC(64, mq_timedreceive, sys_mq_timedreceive) #endif #define __NR_mq_notify 184 @@ -506,7 +543,8 @@ __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_semtimedop 192 -__SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop) +__SC(time32, semtimedop, sys_semtimedop_time32) +__SC(64, semtimedop, sys_semtimedop) #endif #define __NR_semop 193 @@ -618,7 +656,8 @@ __SYSCALL(__NR_accept4, sys_accept4) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_recvmmsg 243 -__SC_COMP_3264(__NR_recvmmsg, sys_recvmmsg_time32, sys_recvmmsg, compat_sys_recvmmsg_time32) +__SCC(time32, recvmmsg, sys_recvmmsg_time32, compat_sys_recvmmsg_time32) +__SC(64, recvmmsg, sys_recvmmsg) #endif /* @@ -629,7 +668,8 @@ __SC_COMP_3264(__NR_recvmmsg, sys_recvmmsg_time32, sys_recvmmsg, compat_sys_recv #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_wait4 260 -__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) +__SCC(time32, wait4, sys_wait4, compat_sys_wait4) +__SC(64, wait4, sys_wait4) #endif #define __NR_prlimit64 261 @@ -645,7 +685,8 @@ __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_clock_adjtime 266 -__SC_3264(__NR_clock_adjtime, sys_clock_adjtime32, sys_clock_adjtime) +__SC(time32, clock_adjtime, sys_clock_adjtime32) +__SC(64, clock_adjtime, sys_clock_adjtime) #endif #define __NR_syncfs 267 @@ -701,7 +742,8 @@ __SYSCALL(__NR_statx, sys_statx) #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_io_pgetevents 292 -__SC_COMP_3264(__NR_io_pgetevents, sys_io_pgetevents_time32, sys_io_pgetevents, compat_sys_io_pgetevents) +__SCC(time32, io_pgetevents, sys_io_pgetevents_time32, compat_sys_io_pgetevents) +__SC(64, io_pgetevents, sys_io_pgetevents) #endif #define __NR_rseq 293 @@ -713,45 +755,45 @@ __SYSCALL(__NR_kexec_file_load, sys_kexec_file_load) #if defined(__SYSCALL_COMPAT) || __BITS_PER_LONG == 32 #define __NR_clock_gettime64 403 -__SYSCALL(__NR_clock_gettime64, sys_clock_gettime) +__SC(32, clock_gettime64, sys_clock_gettime) #define __NR_clock_settime64 404 -__SYSCALL(__NR_clock_settime64, sys_clock_settime) +__SC(32, clock_settime64, sys_clock_settime) #define __NR_clock_adjtime64 405 -__SYSCALL(__NR_clock_adjtime64, sys_clock_adjtime) +__SC(32, clock_adjtime64, sys_clock_adjtime) #define __NR_clock_getres_time64 406 -__SYSCALL(__NR_clock_getres_time64, sys_clock_getres) +__SC(32, clock_getres_time64, sys_clock_getres) #define __NR_clock_nanosleep_time64 407 -__SYSCALL(__NR_clock_nanosleep_time64, sys_clock_nanosleep) +__SC(32, clock_nanosleep_time64, sys_clock_nanosleep) #define __NR_timer_gettime64 408 -__SYSCALL(__NR_timer_gettime64, sys_timer_gettime) +__SC(32, timer_gettime64, sys_timer_gettime) #define __NR_timer_settime64 409 -__SYSCALL(__NR_timer_settime64, sys_timer_settime) +__SC(32, timer_settime64, sys_timer_settime) #define __NR_timerfd_gettime64 410 -__SYSCALL(__NR_timerfd_gettime64, sys_timerfd_gettime) +__SC(32, timerfd_gettime64, sys_timerfd_gettime) #define __NR_timerfd_settime64 411 -__SYSCALL(__NR_timerfd_settime64, sys_timerfd_settime) +__SC(32, timerfd_settime64, sys_timerfd_settime) #define __NR_utimensat_time64 412 -__SYSCALL(__NR_utimensat_time64, sys_utimensat) +__SC(32, utimensat_time64, sys_utimensat) #define __NR_pselect6_time64 413 -__SC_COMP(__NR_pselect6_time64, sys_pselect6, compat_sys_pselect6_time64) +__SCC(32, pselect6_time64, sys_pselect6, compat_sys_pselect6_time64) #define __NR_ppoll_time64 414 -__SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64) +__SCC(32, ppoll_time64, sys_ppoll, compat_sys_ppoll_time64) #define __NR_io_pgetevents_time64 416 -__SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64) +__SCC(32, io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64) #define __NR_recvmmsg_time64 417 -__SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64) +__SCC(32, recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64) #define __NR_mq_timedsend_time64 418 -__SYSCALL(__NR_mq_timedsend_time64, sys_mq_timedsend) +__SC(32, mq_timedsend_time64, sys_mq_timedsend) #define __NR_mq_timedreceive_time64 419 -__SYSCALL(__NR_mq_timedreceive_time64, sys_mq_timedreceive) +__SC(32, mq_timedreceive_time64, sys_mq_timedreceive) #define __NR_semtimedop_time64 420 -__SYSCALL(__NR_semtimedop_time64, sys_semtimedop) +__SC(32, semtimedop_time64, sys_semtimedop) #define __NR_rt_sigtimedwait_time64 421 -__SC_COMP(__NR_rt_sigtimedwait_time64, sys_rt_sigtimedwait, compat_sys_rt_sigtimedwait_time64) +__SCC(32, rt_sigtimedwait_time64, sys_rt_sigtimedwait, compat_sys_rt_sigtimedwait_time64) #define __NR_futex_time64 422 -__SYSCALL(__NR_futex_time64, sys_futex) +__SC(32, futex_time64, sys_futex) #define __NR_sched_rr_get_interval_time64 423 -__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) +__SC(32, sched_rr_get_interval_time64, sys_sched_rr_get_interval) #endif #define __NR_pidfd_send_signal 424 From patchwork Thu Jun 20 16:23:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 806004 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp379033wrt; Thu, 20 Jun 2024 09:27:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnUTIWEYM3dK/jGCB+8ZAv25i8fYD7h7unDbuicb2uIWEDhXXKS2S5h2ENruRRguxNcJCYs3epiLPHNXpn65FX X-Google-Smtp-Source: AGHT+IE6cweY1O0zNEaVayA2mphDoSPVuPu0xEdAt07eyjJkfk6AvqYmPucwxDvgiGKTM0izLkpx X-Received: by 2002:a05:622a:12:b0:440:628c:b26e with SMTP id d75a77b69052e-444a7a1e0e5mr71399671cf.11.1718900846561; Thu, 20 Jun 2024 09:27:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718900846; cv=pass; d=google.com; s=arc-20160816; b=NIUhY6pX3uHUDEu5pMRVTWP+HiiMB2tSah6qSD0frlt2zc7CeDDiXBahBpZAc/z7W0 9cdwGTu3oDP/YlYXQjczg+DZzuL5WnGd5VC7lJW31ypgwnpxq6F3XlBFrVN9xsh30zpY UivsK9IvMzF8nJVczchvDzIIrGD6rACmZdQMIdLl0yt9YljSyZRMFlQ27i8WAGlx7tT2 LlF+39CpSg3jvhO5ga7hXrx7xDrCWPvLBDAjUtTnPFU3rTNLHPILvVHLcjvbUOcET6/q nOzYYvien9xVo9iZ6F79TfjkXgCTbhhffU01sJv01wno8V+38yhz3ZTj/UxolRkZPzyC +wtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=fvtVf1PfA9sQBvjOR60oFrLwm0pS8UazDX0m9JuBKZc=; fh=xSIq547Z/8+2mwrThk5NmWwnmadq1eVmQ35PeXz4rpA=; b=RiRVGtzyFDgRN0OxOrQwOzOzYC8m2KcSeLq3FxHjOBkqiboLNk0czYSly36VGG+2gY KAR5SFh+hOc/qXL7r3wXIINu/jgzTyEmQZXoj8oCslZKmZsTLhg4y5qtbxOucmdANSrE 7oEw16gNPXU1dTy1LF2+/8oRNmAiOvlbVjRb5BuDjVtbPLTOVb/Ga1tk69UPpnMd2/IV 40P0sgtYwgp/vBNeOpuSC9HyOgQYiLDq9ZRjvhgxsVqYww+d0ztUSTYqNQtdQFaWpVFR Zt1q+9QhlqRqcO15Gy/JjayKRHW5pxak7t9oynZK20yD70O7UCVosAtGyFRL6T5XmGv0 RvPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mgf3e1Fh; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3d8f93si168335361cf.195.2024.06.20.09.27.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 09:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mgf3e1Fh; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3116B3895FCD for ; Thu, 20 Jun 2024 16:27:26 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by sourceware.org (Postfix) with ESMTPS id DC97C3894C30 for ; Thu, 20 Jun 2024 16:25:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC97C3894C30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DC97C3894C30 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:4641:c500::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900723; cv=none; b=R+b8a3L+zSA/aarKokFRKY1A3R5S4xJsOFeHeUuOSCx9xkO889o0UK5+IF8GV2bodJxfzJ6wdmEq9u3CISV7vuhneMN85z31mKGlZyHkt0vvisO5bUIu8wrUzk7aZhV/HBdLNTWMAQh+ZEd6ZVwsyur1BAMDS5Co2sHnOG2BXXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718900723; c=relaxed/simple; bh=kDUL0eQ/6YSJ1bK+6Lr69ZdPp0RU2xbPAfoz6UW7TTg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=gL9QAg4pWXYd34AdaF0un+icuZPviCDRjnJrPMux+pNCfdl/l+PAFBxCYIDgy47+EeKI/j0cdKsovJmI/iWeNXgSd0qIYq/KyOqIwXuYBLcuabcHKRXk6slwoUwOrEmV7qP3tnj0n8n8eF3IJWQ7aWWlwGdxgVjRG0CB4oUwPYk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 46101621C5; Thu, 20 Jun 2024 16:25:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1817C32786; Thu, 20 Jun 2024 16:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718900719; bh=kDUL0eQ/6YSJ1bK+6Lr69ZdPp0RU2xbPAfoz6UW7TTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mgf3e1FhIJ34BxmZFn82Ln9S0Qv6QXhxwCJKDARqYjkFgu+PeLy+HbQQiPNlRIlpH CJPg8GeMhGdXNWnFJ7rs6CxgQTJgS3aIOdECU1hUTPI3GTqq1wFPc1n7ygAUyYEwl9 +8r+PlwF95EJ6Ir8u8mktZFBaZpsQVlPwxTyDXM7TdcPf38yXtOg8ExYgy0jNH9ePX 1ViSkxDmMk4r4dOWXWQ9/QUe8Zx98JIfQyCBmd0SwBnHw1BZMRTpQwEpjMClIy+kE/ qhRXIrGZpKimne/UDkbRtj9V6uWojsT4fcxvIhFSPeJGeHucTaUEAfjbySdUDB53iI PtNJzQd1HEs7A== From: Arnd Bergmann To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N . Rao" , linuxppc-dev@lists.ozlabs.org, Brian Cain , linux-hexagon@vger.kernel.org, Guo Ren , linux-csky@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "H. Peter Anvin" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, libc-alpha@sourceware.org, musl@lists.openwall.com, ltp@lists.linux.it Subject: [PATCH 15/15] linux/syscalls.h: add missing __user annotations Date: Thu, 20 Jun 2024 18:23:16 +0200 Message-Id: <20240620162316.3674955-16-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620162316.3674955-1-arnd@kernel.org> References: <20240620162316.3674955-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Arnd Bergmann A couple of declarations in linux/syscalls.h are missing __user annotations on their pointers, which can lead to warnings from sparse because these don't match the implementation that have the correct address space annotations. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index ba9337709878..63424af87bba 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -322,13 +322,13 @@ asmlinkage long sys_io_pgetevents(aio_context_t ctx_id, long nr, struct io_event __user *events, struct __kernel_timespec __user *timeout, - const struct __aio_sigset *sig); + const struct __aio_sigset __user *sig); asmlinkage long sys_io_pgetevents_time32(aio_context_t ctx_id, long min_nr, long nr, struct io_event __user *events, struct old_timespec32 __user *timeout, - const struct __aio_sigset *sig); + const struct __aio_sigset __user *sig); asmlinkage long sys_io_uring_setup(u32 entries, struct io_uring_params __user *p); asmlinkage long sys_io_uring_enter(unsigned int fd, u32 to_submit, @@ -441,7 +441,7 @@ asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group); asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, umode_t mode); asmlinkage long sys_openat2(int dfd, const char __user *filename, - struct open_how *how, size_t size); + struct open_how __user *how, size_t size); asmlinkage long sys_close(unsigned int fd); asmlinkage long sys_close_range(unsigned int fd, unsigned int max_fd, unsigned int flags); @@ -555,7 +555,7 @@ asmlinkage long sys_get_robust_list(int pid, asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, size_t len); -asmlinkage long sys_futex_waitv(struct futex_waitv *waiters, +asmlinkage long sys_futex_waitv(struct futex_waitv __user *waiters, unsigned int nr_futexes, unsigned int flags, struct __kernel_timespec __user *timeout, clockid_t clockid); @@ -907,7 +907,7 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, asmlinkage long sys_getrandom(char __user *buf, size_t count, unsigned int flags); asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags); -asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size); +asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned int size); asmlinkage long sys_execveat(int dfd, const char __user *filename, const char __user *const __user *argv, const char __user *const __user *envp, int flags); @@ -960,11 +960,11 @@ asmlinkage long sys_cachestat(unsigned int fd, struct cachestat_range __user *cstat_range, struct cachestat __user *cstat, unsigned int flags); asmlinkage long sys_map_shadow_stack(unsigned long addr, unsigned long size, unsigned int flags); -asmlinkage long sys_lsm_get_self_attr(unsigned int attr, struct lsm_ctx *ctx, - u32 *size, u32 flags); -asmlinkage long sys_lsm_set_self_attr(unsigned int attr, struct lsm_ctx *ctx, +asmlinkage long sys_lsm_get_self_attr(unsigned int attr, struct lsm_ctx __user *ctx, + u32 __user *size, u32 flags); +asmlinkage long sys_lsm_set_self_attr(unsigned int attr, struct lsm_ctx __user *ctx, u32 size, u32 flags); -asmlinkage long sys_lsm_list_modules(u64 *ids, u32 *size, u32 flags); +asmlinkage long sys_lsm_list_modules(u64 __user *ids, u32 __user *size, u32 flags); /* * Architecture-specific system calls