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 X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80D90C433DB for ; Thu, 25 Feb 2021 10:14:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BD3F64F0D for ; Thu, 25 Feb 2021 10:14:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BD3F64F0D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IVga+nmsTlmwc1E6iphZQ27jKPsN5/Apx3YQf6R7rjk=; b=J22A+Dg5XwzTRpo/Uwnzitnd0 R9kzxJ2Ebm+nZPalRZgQakSYmo4sWsRNsGMVnjZeulKBOHh1sylnVFN0Hq4U7sx2LYovJHI34nMu4 JBKHZSb88003cHTYrDPJXGT4Xk2R0B2se/xW0cCfuCRGbpiUmig+ikwZlT//FbsGaccPR06eEVFvx nxG8ZeLhfSONH6YWLVVFHo390OX2RrvZGFR8giS5JQxy9DSFgphpz1kA97GqtqyuiA8rAzAWpV+Ir DgFdPf07aMJCn1MBWJCUT8BGpIedmrkrLNYyjmsXoSLT08zKmUKLpD4zGa4533n8XrnSFgqn9Rcgw SY9bbj2gQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFDdZ-0001lL-57; Thu, 25 Feb 2021 10:12:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFDdX-0001kf-LH for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2021 10:12:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5352364EFA; Thu, 25 Feb 2021 10:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614247965; bh=/o4v4ESWp77X1+sZxqxKir+XxCaDt6F1JTSLOiSkY/M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QEBR7BmsJ6pYi53sIyUsfzDIoLjwRtv/oDi51clBDaGx1DGdbv/O65Pz8y/qcMjES FlIF0RLgCIS/roHH6e08p6LYoZ48ra7Zox27GR51XaFVqLVQvylOctjiGWvekwXuzI E4EIcTb3CPmr4RPMWI6gIRbDFuXo4mRZSeK6e/22cN7z/mYE5M2KOwbJJGYDHkUdPW 4tymQIhEMqT8c6uOt+C/VnjVQtKlTtHUyauGUaow7Cv7JyTUndBTyhl8epiOWGRJJU AZicyQwVimc8uU1G0R7hS6InZjYKv1O8p2tWxugTouyJ59R/ltsW6r6fCtu9A5I1p/ ytJ/1BfLknktA== Date: Thu, 25 Feb 2021 10:12:39 +0000 From: Will Deacon To: Kees Cook Subject: Re: [PATCH] arm64: ptrace: Fix seccomp of traced syscall -1 (NO_SYSCALL) Message-ID: <20210225101239.GA12533@willie-the-truck> References: <90edd33b-6353-1228-791f-0336d94d5f8c@majoroak.me.uk> <20210224144920.jjk46kfgkokk4cck@bogus> <202102241444.A8BC2EC3@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202102241444.A8BC2EC3@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_051247_788817_08878491 X-CRM114-Status: GOOD ( 23.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haibo Xu , Catalin Marinas , Oleg Nesterov , Sudeep Holla , Timothy Baldwin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 24, 2021 at 02:48:05PM -0800, Kees Cook wrote: > On Wed, Feb 24, 2021 at 02:49:20PM +0000, Sudeep Holla wrote: > > On Mon, Jan 18, 2021 at 02:58:58AM +0000, Timothy Baldwin wrote: > > > From c047f549699d31ed91d5ac0cadbcf76a02cd801e Mon Sep 17 00:00:00 2001 > > > From: Timothy E Baldwin > > > Date: Sat, 16 Jan 2021 15:18:54 +0000 > > > Subject: [PATCH] arm64: ptrace: Fix seccomp of traced syscall -1 (NO_SYSCALL) > > > > > > Since commit f086f67485c5 ("arm64: ptrace: add support for syscall > > > emulation"), if system call number -1 is called and the process is being > > > traced with PTRACE_SYSCALL, for example by strace, the seccomp check is > > > skipped and -ENOSYS is returned unconditionally (unless altered by the > > > tracer) rather than carrying out action specified in the seccomp filter. > > > > > > The consequence of this is that it is not possible to reliably strace > > > a seccomp based implementation of a foreign system call interface in > > > which r7/x8 is permitted to be -1 on entry to a system call. > > > > > > Also trace_sys_enter and audit_syscall_entry are skipped if a system > > > call is skipped. > > > > > > Fix by removing the in_syscall(regs) check restoring the previous behaviour > > > which is like AArch32, x86 (which uses generic code) and everything else. > > > > > > > Ah, my fault. At the time of timing this I didn't test with seccomp and > > also for some reason IIRC I had assumed the flags SYSCALL_{EMU,TRACE} > > and seccomp calls are mutually exclusive and can't happen together. > > > > FWIW, > > Reviewed-by: Sudeep Holla > > > > Also I ran some minimal tests I have, so > > Tested-by: Sudeep Holla > > > > I have also asked Haibo Xu who help me testing back then > > to test again. > > Thanks for catching and fixing this! Does this pass the seccomp selftests? > > Reviewed-by: Kees Cook > > Will, do you want to take this? I don't usually put the arch-specific > seccomp bits through the seccomp tree. Sure, I'll add it to the fixes pile. Thanks! Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel