From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7E0F3B14C3; Fri, 3 Jul 2026 09:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783071283; cv=none; b=AkFu9O9PfX/kmNJW3xHmg4XRPrWtDU4qYK9CmKi8j7wp7biXlKDpP3jAylJsacX3RxyzXAzS2KEUr9MwOug0T4DYV9cYK4/TzOJdb+bkE/yMKA4/+RupRZeVrDFLoM3JOz+2ebWlks6SdtC10XnF3VchEJDfy0oLyNU7wavdr9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783071283; c=relaxed/simple; bh=4zwQCRVYGR5FArRVyRpUCs5bDBdQqJdKupIYXwMv/aU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=BD333vYTeYI2+x/m8D9oZt+3M2PGX82Osp4g2NZGjWZM+ZiCMODiSwXxw4GbI46dyVOdwIOe1SLv+uwXDrQDH0XEq+X5hF031UqlZsxcquZ4SwqAiU8Q1dsNzKnJM9mX6KWIP5aTLipSLk0rygDhlLsxZRZoEX7dlUcI4zdnAtI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K4JQ6Zc8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K4JQ6Zc8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B011F000E9; Fri, 3 Jul 2026 09:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783071282; bh=nMY8UZyvI/HF5Rdv1bSkWyNbGRbx1G27seV2ZaZUbN4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=K4JQ6Zc8TPguGmkEN1toHL2v5PXz61h6EWt7zZ8rNB04Nv/OFyWtRbIK7/fVYv1YG B2iavueYbkcwMfN5GGnSDuP3/Y2ypQOlduP9C9EH0oHedTCI4eVb8GN99XZ7K3gk2U mKiWTX7nFzp9NihhXbgvqGtv6EZe36azyYLF8fKo4DpnPtV9M5EwlFIg4kabWNJ5dR ivYvj8LWnh2+s/7LGPHBUsOszJO62d4z94v7KFjNFI2CueHXILKryvycsxAeIyGtSG s98h3rggiuosCqsSmQ0MRnvTtW2Y2rrZ6VdGUVtB9Peojv9MYzNR0W2Zxz87hN6G4/ UM7w31V/ebUew== From: Thomas Gleixner To: Michal =?utf-8?Q?Such=C3=A1nek?= Cc: Peter Zijlstra , Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Donnellan , Mark Rutland , Arnd Bergmann , Jiaxun Yang , Ryan Roberts , Greg Kroah-Hartman , Mukesh Kumar Chaurasiya , Shrikanth Hegde , Zong Li , Nam Cao , Deepak Gupta , Lukas Gerlach , Rui Qi , Kees Cook , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: Re: [RFC] entry: Untangle the return value of syscall_enter_from_user_mode from syscall NR In-Reply-To: References: <878q7tprau.ffs@fw13> <87jyrdnmrh.ffs@fw13> Date: Fri, 03 Jul 2026 11:34:39 +0200 Message-ID: <87ik6wmn68.ffs@fw13> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Jul 03 2026 at 09:53, Michal Such=C3=A1nek wrote: > On Thu, Jul 02, 2026 at 10:45:54PM +0200, Thomas Gleixner wrote: >> > When the syscall number was -1 to start with it's not possible to >> > determine if the syscall was fileterd from the return value. s390 >> > returns the filtered state in a flag it sets on the regs structure, >> > avoiding this problem. >>=20 >> What needs to determine whether the syscall was filtered or not? > > The code that executes syscall_enter_from_user_mode() needs to determine > that. > > After syscall_enter_from_user_mode() returns the syscall needs to be > executed or skipped. > > 'Executing' an invalid syscall boils down to setting the return value to > -ENOSYS. > > But if the syscall number returned is -1 was the syscall filtered and > the return value set by syscall_enter_from_user_mode() or should it be > set by the caller to -ENOSYS? See the explanation I gave to Peter. It's conclusive, but admittedly not intuitive. The fact, that s390 decided to have the syscall number and the return value in the same register is a different problem, but as I pointed out to Sven it could have been solved completely without that flag. Thanks, tglx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE9C8C43458 for ; Fri, 3 Jul 2026 09:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FYERMfmDG7QkY/P1AxhGVOS398pKefGP7ruJXJ6yrqc=; b=Q18nWZUz/G26hi zABX0Asw0UV+5sWhaqVkcCAfmy5ScQpU6M/cJCz8Kyza79T5OApIohtW5YMT/85+BnejNUFhq1Fte JIqk3nrFQzZQ4hBrZpxxjkeHeKDUsp9eSp0BDCvTOOs0VAmdOiCDWJE0J7xYaAYun7qQ8JcGoy+UV uTJJjS/BlxgQJRRrXUh4u0GtHQSm6dGgC+ODL1c68crLBANlX0o3Nzp1qblRM3Sck2IF7uLLOwWfC VeSqt7dH3y3FwitbTZV80wD11L/QDKu5+POfpejWotd1lhcfYBd+a8TCT4dJjPf50w/OvrGWaQTIT AkPD2DDzMepE38z9RelQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfaIG-00000006Udi-1PDG; Fri, 03 Jul 2026 09:34:45 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfaIF-00000006UdV-2dBN for linux-riscv@lists.infradead.org; Fri, 03 Jul 2026 09:34:43 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D09566001A; Fri, 3 Jul 2026 09:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B011F000E9; Fri, 3 Jul 2026 09:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783071282; bh=nMY8UZyvI/HF5Rdv1bSkWyNbGRbx1G27seV2ZaZUbN4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=K4JQ6Zc8TPguGmkEN1toHL2v5PXz61h6EWt7zZ8rNB04Nv/OFyWtRbIK7/fVYv1YG B2iavueYbkcwMfN5GGnSDuP3/Y2ypQOlduP9C9EH0oHedTCI4eVb8GN99XZ7K3gk2U mKiWTX7nFzp9NihhXbgvqGtv6EZe36azyYLF8fKo4DpnPtV9M5EwlFIg4kabWNJ5dR ivYvj8LWnh2+s/7LGPHBUsOszJO62d4z94v7KFjNFI2CueHXILKryvycsxAeIyGtSG s98h3rggiuosCqsSmQ0MRnvTtW2Y2rrZ6VdGUVtB9Peojv9MYzNR0W2Zxz87hN6G4/ UM7w31V/ebUew== From: Thomas Gleixner To: Michal =?utf-8?Q?Such=C3=A1nek?= Cc: Peter Zijlstra , Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Donnellan , Mark Rutland , Arnd Bergmann , Jiaxun Yang , Ryan Roberts , Greg Kroah-Hartman , Mukesh Kumar Chaurasiya , Shrikanth Hegde , Zong Li , Nam Cao , Deepak Gupta , Lukas Gerlach , Rui Qi , Kees Cook , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: Re: [RFC] entry: Untangle the return value of syscall_enter_from_user_mode from syscall NR In-Reply-To: References: <878q7tprau.ffs@fw13> <87jyrdnmrh.ffs@fw13> Date: Fri, 03 Jul 2026 11:34:39 +0200 Message-ID: <87ik6wmn68.ffs@fw13> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org T24gRnJpLCBKdWwgMDMgMjAyNiBhdCAwOTo1MywgTWljaGFsIFN1Y2jDoW5layB3cm90ZToKPiBP biBUaHUsIEp1bCAwMiwgMjAyNiBhdCAxMDo0NTo1NFBNICswMjAwLCBUaG9tYXMgR2xlaXhuZXIg d3JvdGU6Cj4+ID4gV2hlbiB0aGUgc3lzY2FsbCBudW1iZXIgd2FzIC0xIHRvIHN0YXJ0IHdpdGgg aXQncyBub3QgcG9zc2libGUgdG8KPj4gPiBkZXRlcm1pbmUgaWYgdGhlIHN5c2NhbGwgd2FzIGZp bGV0ZXJkIGZyb20gdGhlIHJldHVybiB2YWx1ZS4gczM5MAo+PiA+IHJldHVybnMgdGhlIGZpbHRl cmVkIHN0YXRlIGluIGEgZmxhZyBpdCBzZXRzIG9uIHRoZSByZWdzIHN0cnVjdHVyZSwKPj4gPiBh dm9pZGluZyB0aGlzIHByb2JsZW0uCj4+IAo+PiBXaGF0IG5lZWRzIHRvIGRldGVybWluZSB3aGV0 aGVyIHRoZSBzeXNjYWxsIHdhcyBmaWx0ZXJlZCBvciBub3Q/Cj4KPiBUaGUgY29kZSB0aGF0IGV4 ZWN1dGVzIHN5c2NhbGxfZW50ZXJfZnJvbV91c2VyX21vZGUoKSBuZWVkcyB0byBkZXRlcm1pbmUK PiB0aGF0Lgo+Cj4gQWZ0ZXIgc3lzY2FsbF9lbnRlcl9mcm9tX3VzZXJfbW9kZSgpIHJldHVybnMg dGhlIHN5c2NhbGwgbmVlZHMgdG8gYmUKPiBleGVjdXRlZCBvciBza2lwcGVkLgo+Cj4gJ0V4ZWN1 dGluZycgYW4gaW52YWxpZCBzeXNjYWxsIGJvaWxzIGRvd24gdG8gc2V0dGluZyB0aGUgcmV0dXJu IHZhbHVlIHRvCj4gLUVOT1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