Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5496574pxu; Tue, 22 Dec 2020 20:13:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlrdpotfPL5ah1gxhWgacdYvBR/TekvBdXtEiNO3lgf4cKgDQm3p6Peo0jAWvS+msq0D7f X-Received: by 2002:a05:6402:b57:: with SMTP id bx23mr22743933edb.191.1608696807945; Tue, 22 Dec 2020 20:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608696807; cv=none; d=google.com; s=arc-20160816; b=nTAf5EheomfmBPERrT1Qx/FY1HnOYYJJDnPzhov7zghHtdXRcGqvJo9+hw2pZwJqAa J+Ft83rcyaT6zDA+9DijB1b3suD7pSP9OwwqZPhlKqH1rrm933808ZlmWRDt5APxxRMD 44PzimtBjRihVGfk5d8ySsjYJqE0xYbSV5OoIgx1KdqKwP6uxH8OwL+dWED3y2UdlHES aQ+xi/Eq+yDxFUSNxY+/nUjBLFJGJ5eqJcaDXOAlcBRHvXXA+dPrXMs7uOnypA2wPnY8 CUEKzu12OK+86cW5DrZNIeHpkmXE8PLk2PSfjcEHQqtcYE4pwt1+Jv9dbnOGzpEtNBKU w0ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=cn58q9KeE/RU2XDvOxFGGOuHBC6aWJ/EzGUBfwiEmQw=; b=GVce7E4rU0EP1P0Dp2ozN8jQSeK8NWNDQweIFq5jh/BJ5Xwp70lVTy/hTZQtd8Uush 1nj2fNnuSnq0IDssUl1sezno5tSO7a6ZEwF7N7TvcexSDoeV90QEFONWy/dfzSM4xW6w zBcTmjnrKy+4hUy9aHPpXFjYqPVsruGaBB8xQxRTxAD1T7QXA0odOK3Xy5Ay4gcWaaot 7cCx0GYYcaqmEMaPuf1vV4sksn8OPG85AynpSrzmUExjjMvy2R0G5C2mquKfvr4z1rul TTPW7qstHEAzPbzbZk1oU7+4dNoucmu4T3IjaP9/NFgwvGjBY0YGCK0eDvCsv/RyJKvJ AVRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=fc4pGtTh; 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 dn20si12862187ejc.748.2020.12.22.20.13.05; Tue, 22 Dec 2020 20:13:27 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=fc4pGtTh; 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 S1727319AbgLWEFE (ORCPT + 99 others); Tue, 22 Dec 2020 23:05:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgLWEFD (ORCPT ); Tue, 22 Dec 2020 23:05:03 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75A1BC0613D3 for ; Tue, 22 Dec 2020 20:04:23 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id x18so8488709pln.6 for ; Tue, 22 Dec 2020 20:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=cn58q9KeE/RU2XDvOxFGGOuHBC6aWJ/EzGUBfwiEmQw=; b=fc4pGtThcYUqUumDa0iLH8hbA9TqxgyvYZ84AY47qHijmFkEvwcdJi+1Ef4GwHbmpZ jR5KPScyf63x8djUX09npML4sBV+0doz5zBPObFo1TRqyVWasysWN6QkKVRey6PFGYmL PKyuQzIBO/3m0tOkLjY6I370W0tFHWDVCR/osshBgM03CL/tjUMSSuyRRGKNH47brVxz FebKVJ8mvol/bWKteFVYx1V1wu355sIw+NZFDDMiZJOB6YxYGLbfijMc+frCiK5jCyvr Qpf2bVXChs7LTJydAIxGGAHkzWM3WfuylDny7mZxKxrTHFBZYrBM7Uoja8QKn6he4WN4 6KtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=cn58q9KeE/RU2XDvOxFGGOuHBC6aWJ/EzGUBfwiEmQw=; b=NTFKGUaik7tV934tpR4yAcMef97u3SIX4/hIkFm7rnzR8NLTNRJ8U/UAD7YGqS7Vwf 8MTprxKl9zROcqIVcBYpWFBdqO/zPSshjkRsVUPj7CVf3KQ3QkSvJqjY1t7lDiyzzGFu vwjc3E07Z0N3g7A/s6aQ1W0TT1Cr5yfSKW2BG3fWiNfEQfkWtyOq1CKFmkXxKh29+x+T oeqnZFTkzAD2BffnOoT2LQLgJifH28x+DNwMwfhWLMPFumJ67IauFnXEezwbIB6BPx95 /bGlXzcN7LdWZ6uAdKAVSjU5PqbBu/XQYw3z1kuq6EgYfkO2ZH1qsUl5n02q3rpdpi6U jP4w== X-Gm-Message-State: AOAM532Ndh4iqqRVCQJhKMrApKfl4NIjh3JC6rTb7INNRprgcUVZoeaJ 4CIyPom+OjN75aCAfZKamXOv5g== X-Received: by 2002:a17:902:9a90:b029:da:ba07:efdc with SMTP id w16-20020a1709029a90b02900daba07efdcmr23831204plp.1.1608696262931; Tue, 22 Dec 2020 20:04:22 -0800 (PST) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id z5sm21767236pff.44.2020.12.22.20.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 20:04:22 -0800 (PST) Date: Tue, 22 Dec 2020 20:04:22 -0800 (PST) X-Google-Original-Date: Tue, 22 Dec 2020 20:04:18 PST (-0800) Subject: Re: [PATCH] riscv: return -ENOSYS for syscall -1 In-Reply-To: <20201222162219.GA710211@cisco> CC: schwab@suse.de, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Paul Walmsley , david.abdurachmanov@sifive.com From: Palmer Dabbelt To: tycho@tycho.pizza Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Dec 2020 08:22:19 PST (-0800), tycho@tycho.pizza 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. > > Reviewed-by: Tycho Andersen Thanks, this is on fixes.