Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6291282pxu; Wed, 23 Dec 2020 20:43:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz32l/xFRyu2qX47vNYrh5uj+8SvrOeZzaGMMJRxWLWJok9MZmp78S+57xhCcEmKiw0OOFr X-Received: by 2002:a05:6402:1a54:: with SMTP id bf20mr27312347edb.65.1608785009300; Wed, 23 Dec 2020 20:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608785009; cv=none; d=google.com; s=arc-20160816; b=d3y+Ru+q/KRco1W/Slc2R29oKKOyQYTk6XnGEC8hhu/ZeYn8LwU8axIYs2YkHOKV/+ 2YqZ9TmbdH4DoiVTNVIBkiRnen2FiSf+T+GEyXxr57IqyrkgoE3uUUGq1RqtS71zHkAS p8OjOQ2CcG+HBf2C6Q7SecKjg1DS7s2Sh3QXF4rjM/TRJQylV/86tfQNtPjSa1MSOdbt 7Gz9Ig9IZDhCH/US4EDwvx0Sfg+2/ajy30Cri4zbgAIKG9A9qr3dJU803e70332UZAYo cjk2K4h+NmqiaC95J5tH2mDmNU+GxcGVStwacld9jMme8lIV+kOepo0zbUtsmm9CvoEA gGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=ZuAOZsuNyuhekGAfAuVc4cPYDPjwuvIUZMlI+9EGZFw=; b=siz7m8xWETWgP0jnBxqD56tNGGN5yWkkowMo/1YIY/isW8zAFu35NucHlA9UhEydXq idUv+rU6/AQBIDVe3I9TszQ2SHU6XPTPL1DhLPNixAMAe2+C+BJi35vBA2OpdMQmfoxT R5oYlvaqNEvNo/kLaPnmnADjw3l21L443yE8A88ujtP8K5XH7oazy/i7abiT1353iVZv QNZDr9FkHwW7i7Unb6J9xOVFEibKI9VIak8R42/G47cuD9cEEnROO3gNuSNzHS8ZeryL 9HZIrhaNLnoOtD3lGzNGYJquI3mFpojETCmJL2iCdgyptElj1XcgXqJlbcavKqf5B1ap UvxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=P0tHQ73n; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YyvLRtpI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga18si12892005ejc.66.2020.12.23.20.43.06; Wed, 23 Dec 2020 20:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=P0tHQ73n; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YyvLRtpI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgLXEjP (ORCPT + 99 others); Wed, 23 Dec 2020 23:39:15 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59249 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbgLXEjP (ORCPT ); Wed, 23 Dec 2020 23:39:15 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 510325C00D5; Wed, 23 Dec 2020 23:38:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 23 Dec 2020 23:38:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=ZuAOZsuNyuhekGAfAuVc4cPYDPj wuvIUZMlI+9EGZFw=; b=P0tHQ73n6Zk/97bKki+yq/zgjYW2E5/0zcclADwMdwW hHvXicBzFMFnbiYXVTRynKWcQBIcoyeZ8R+d8XCYlJyuCuEfHVPm3pX70KHVaxKw ko+VaehO28E6WXZxQ601VKjvWXvi8nXl2GMfloi9bMtG6JMkxhXPgSLSV4LA1+jW heqVQ6vkDmPBWiPD5rK2/ECEgzAk9tE0PejYD7g4wZC6tIM0OU2dLLukFY3NVwn+ Jj79SFJSduL6jBmYcTn6Ni3m9NLZA2r1xjnVRBGzQG0z8U0WHqWcd7xCk/v8IPpL 2QeHo7B6XXpWENlyUnyQN1V6NuWGabUZ8qIT2vYy2HA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ZuAOZs uNyuhekGAfAuVc4cPYDPjwuvIUZMlI+9EGZFw=; b=YyvLRtpIJyopSIVz4gqp7p t4AZgfleFqUiwzNFyPtIwee9tlvRdp9iiPt3acpSLBn+JFnWZyN07q3XBI7ZoDp8 H9zbYOdwB+7g0kQ3f/uETALWnr2VOG2QxurzFwLHCtwEvBV/OQKd/M0c5G1f9vWF msEUmhz0CcClZRO8eOlTcqsceQPpQbNoK1ohnH7MVlolN4JSNvj7P5OlQEP5JOEC U0f44hNj4XKjLh4wEPt11FctECj++Vch/syQDthoLnnQR87f8TzOo/KeIg1NX+1E lyVTlaKsiMPGlbJh0Xdgw2g/NgIT+V1u1MPpMc0Iq4bKxcpiH/AaE1Pi3mzKyikA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddtkedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefvhigthhho ucetnhguvghrshgvnhcuoehthigthhhosehthigthhhordhpihiiiigrqeenucggtffrrg htthgvrhhnpeeifffffeekkeeifffhteekleejhfetledvvdeileefheffveduveevleef lefgtdenucffohhmrghinhepvghnthhrhidrshgsnecukfhppeduledvrddvgedurddvhe ehrdduhedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthihtghhohesthihtghhohdrphhiiiiirg X-ME-Proxy: Received: from cisco (unknown [192.241.255.151]) by mail.messagingengine.com (Postfix) with ESMTPA id DA5FA1080059; Wed, 23 Dec 2020 23:38:07 -0500 (EST) Date: Wed, 23 Dec 2020 21:38:06 -0700 From: Tycho Andersen To: Palmer Dabbelt Cc: Christoph Hellwig , schwab@suse.de, david.abdurachmanov@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Paul Walmsley Subject: Re: [PATCH] riscv: return -ENOSYS for syscall -1 Message-ID: <20201224043806.GE710211@cisco> References: <20201223082404.GB24581@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 23, 2020 at 06:54:43PM -0800, Palmer Dabbelt wrote: > On Wed, 23 Dec 2020 00:24:04 PST (-0800), Christoph Hellwig wrote: > > On Tue, Dec 22, 2020 at 09:22:19AM -0700, Tycho Andersen wrote: > > > On Mon, Dec 21, 2020 at 11:52:00PM +0100, Andreas Schwab wrote: > > > > Properly return -ENOSYS for syscall -1 instead of leaving the return value > > > > uninitialized. This fixes the strace teststuite. > > > > > > > > Fixes: 5340627e3fe0 ("riscv: add support for SECCOMP and SECCOMP_FILTER") > > > > Signed-off-by: Andreas Schwab > > > > --- > > > > arch/riscv/kernel/entry.S | 9 +-------- > > > > 1 file changed, 1 insertion(+), 8 deletions(-) > > > > > > > > diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S > > > > index 524d918f3601..d07763001eb0 100644 > > > > --- a/arch/riscv/kernel/entry.S > > > > +++ b/arch/riscv/kernel/entry.S > > > > @@ -186,14 +186,7 @@ check_syscall_nr: > > > > * Syscall number held in a7. > > > > * If syscall number is above allowed value, redirect to ni_syscall. > > > > */ > > > > - bge a7, t0, 1f > > > > - /* > > > > - * Check if syscall is rejected by tracer, i.e., a7 == -1. > > > > - * If yes, we pretend it was executed. > > > > - */ > > > > - li t1, -1 > > > > - beq a7, t1, ret_from_syscall_rejected > > > > - blt a7, t1, 1f > > > > + bgeu a7, t0, 1f > > > > > > IIUC, this is all dead code anyway for the path where seccomp actually > > > rejects the syscall, since it should do the rejection directly in > > > handle_syscall_trace_enter(), which is called above this hunk. So it > > > seems good to me. > > > > That change really needs to be documented in the commit log, or even > > better split into a separate patch (still documented of course!). > > Unless I'm missing something, this is already how it works already? Yes, agreed. My musing was mostly just that this is dead code that probably should have been in removed in af33d2433b03 ("riscv: fix seccomp reject syscall code path"), but was overlooked. Maybe this could use a Fixes: tag for that too. Tycho