Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp508426ybt; Fri, 10 Jul 2020 05:43:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXH9sqUyYC2D8QMXqpagrcO2jTV90VhqCCJbj14lk1GHMXJBY6bnx7qKlj5jxGYGnQUWw8 X-Received: by 2002:a17:906:f2c1:: with SMTP id gz1mr63265337ejb.88.1594385024442; Fri, 10 Jul 2020 05:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594385024; cv=none; d=google.com; s=arc-20160816; b=DZt+sfcYu5sHikpezHetYRqzjQEPe4eu+dZnuB1d5jDmnznbKk05AjvbiVhwZYWMyH wW5QsoIna0d8NRo2oo5tvgfa2qFTR2+RQKQv3nk3HT8vxriLE0wRuozBM8q2MN1IBEzY BhvVIHibnJm4GTcaYdT3B0tzJ+DDYrUjNzXfLeScuR7rdXmFk0skNdgbRrAJnP6iW5+t uM9KDL1aAIAlOvC4LZUwfQBHlurztLB00rrfI2QUGkcy3m7Fc2vuEyJHO5k/NykhoPeK QFhivgbP/TQu5meDJKkep7v84oJTvgMHcudYEvzFVqukiDso1vcqSiKrdbm+g1LKe2bI LUVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vuD6Ex+HRtzWCz3Lv8CqoEyMOIIPmWkxDfawBlIrOKA=; b=uT0s8s1DMCQiMUEeWawFizTWp/51OyjVLyoOP+oSKPrErVV0ANfwIVc0etUqmY4p7q Gq0dhC1Ssd1GizVDEDGkf9blnkGF60+xjjRBijW93CBRpr8p9WG0+u/QihYucFEuYwCg ckD+6odkCM3qJML3PhFmYhdNFSEO0V6MRmL5FDZdZ26k4ZkHnUh7+bPGnxC9Dm+SPXC3 w9JOhnpO6pYNJyWR2r723u55OmcdY+msc7HrE93UbbiLoCsTxX1a/24reTTDxqjCYa38 Jb4ev+/XYEQsRUOcJzWfQL0tZsH/A1M34kAODlgM1TBUA8mU0bGZM/cORGEKXE8Xlk6F S/2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g9TPmzN1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si3804706ejb.116.2020.07.10.05.43.21; Fri, 10 Jul 2020 05:43:44 -0700 (PDT) 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=@kernel.org header.s=default header.b=g9TPmzN1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727076AbgGJMm6 (ORCPT + 99 others); Fri, 10 Jul 2020 08:42:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:37828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgGJMm6 (ORCPT ); Fri, 10 Jul 2020 08:42:58 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0053420772; Fri, 10 Jul 2020 12:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594384978; bh=xRBtzclHlMuakub8GY8QxjRYcXXc0+XpksOWyODqDVs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g9TPmzN1z6IrexQ84CPBYnNFt6sF+IyyWq4/DpzSu7Iqos/jXzh+ld+I67sPG/TCh hIpdCWv1RAJblEeF7FdjeCnnj+jUvQK3oVnO3oEwCnGBlE3N0vtW/TARSjjqKqbW6H YuGUDYZbYf0qzjxfoVljEGxjWtOp32tjL0LMXdHI= Date: Fri, 10 Jul 2020 13:42:54 +0100 From: Will Deacon To: Kees Cook Cc: Keno Fischer , Linux Kernel Mailing List , Oleg Nesterov , Andy Lutomirski , Will Drewry Subject: Re: ptrace: seccomp: Return value when the call was already invalid Message-ID: <20200710124253.GB30458@willie-the-truck> References: <20200703083914.GA18516@willie-the-truck> <202007030815.744AAB35D@keescook> <20200703154426.GA19406@willie-the-truck> <202007030851.D11F1EFA@keescook> <20200704123355.GA21185@willie-the-truck> <202007042132.DAFA2C2@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007042132.DAFA2C2@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 04, 2020 at 09:56:50PM -0700, Kees Cook wrote: > On Sat, Jul 04, 2020 at 01:33:56PM +0100, Will Deacon wrote: > > On Fri, Jul 03, 2020 at 08:52:05AM -0700, Kees Cook wrote: > > > On Fri, Jul 03, 2020 at 04:44:27PM +0100, Will Deacon wrote: > > > > On Fri, Jul 03, 2020 at 08:17:19AM -0700, Kees Cook wrote: > > > > > On Fri, Jul 03, 2020 at 09:39:14AM +0100, Will Deacon wrote: > > > > > > diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c > > > > > > index 5f5b868292f5..a13661f44818 100644 > > > > > > --- a/arch/arm64/kernel/syscall.c > > > > > > +++ b/arch/arm64/kernel/syscall.c > > > > > > @@ -121,12 +121,10 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, > > > > > > user_exit(); > > > > > > > > > > > > if (has_syscall_work(flags)) { > > > > > > - /* set default errno for user-issued syscall(-1) */ > > > > > > - if (scno == NO_SYSCALL) > > > > > > - regs->regs[0] = -ENOSYS; > > > > > > - scno = syscall_trace_enter(regs); > > > > > > - if (scno == NO_SYSCALL) > > > > > > + if (syscall_trace_enter(regs)) > > > > > > goto trace_exit; > > > > > > + > > > > > > + scno = regs->syscallno; > > > > > > } > > > > > > > > > > > > invoke_syscall(regs, scno, sc_nr, syscall_table); > > > > > > > > > > What effect do either of these patches have on the existing seccomp > > > > > selftests: tools/testing/selftests/seccomp/seccomp_bpf ? > > > > > > > > Tests! Thanks, I'll have a look. > > > > > > Thanks! > > > > > > (And either way, that this behavioral difference went unnoticed means we > > > need to add a test to the selftests for this patch.) > > > > Unsurprisingly, I don't think the tests go near this. I get 75/77 passes > > on arm64 defconfig with or without these changes. > > (What doesn't pass for you? I tried to go find kernelci.org test output, > but it doesn't appear to actually run selftests yet?) Sorry, realised I forgot to reply to this point. I was seeing assertion failures in 'global.user_notification_with_tsync' and 'user_notification_sibling_pid_ns'. I started looking into the first one, saw an -EACCESS kicking around, re-ran the tests as root and now they all pass. Are they expected to pass as a normal user? Will