Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5894655iob; Tue, 10 May 2022 06:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys4l1e/TN7qHOxLXsk+J99FXIwiSMF+QZ+dqjywFY5YYSzfsobrAnBfXg/CQb0sx9siGFN X-Received: by 2002:a17:902:e94e:b0:15b:22a7:f593 with SMTP id b14-20020a170902e94e00b0015b22a7f593mr20981554pll.148.1652188442557; Tue, 10 May 2022 06:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652188442; cv=none; d=google.com; s=arc-20160816; b=w0olcqIIPsirMQ+HceLgUDhOUNLYY20c96rl2PX6WMzmBBdN28rLPl0pqz2WumT2hb ZU/LfwPd/sAUk1xiJ/xGaCyKOmYBr4yIyw+2KPOkM3iK2f3QlJB0NJGKrICsg4/9o9Fs HIDbh8d/KzfFL56V49cqtDxUHkmpmn90lytb9BQGE/thVuGILX+Nf9kdAi6lJfeu8Dmz KBaRwf7LP1FdiTIPt55vDPA8c+e7JFWO3RzW7JpK+2u+9wZbp3XhJgbiDmj1yvuSJz3o oiFI4OXGDZSsm9sCMgD8u909wJEla+xWml8hNKNwwnolErfGSLgL+eHfY7v9t8icGcff faMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=y+Yhzihy/SmEfvMVEPrI/1mmoPRaZRI8FRenfdJo1V4=; b=D860GfzPOteJercv3xBMe5BhkbH/y5TUKIaEcqBj+UftkOZKzEkGddDGrlho2Ogwmw ze/J4Tsaj/mpDtqRmlMaP8eP4E0HiZJQEN4j1kzGS1pvTwESKmDkCZYYgPE7Ro/GDS3R LxcQ15LKbjlHH/gYSrgmsEwqRzfrSI4vwLQvOmL+eb3EBZMqvXSTsGe9i0jrLXQBhICD SHyy8HlYAtdi/2NKgxQoQaWl3hOQSBmZEOeYlicPSZ5mE6bwwQXVbkNx7jS0lU+WjwjX ylZR4wzw60AROb9lwTblowZ4Rjgylz4csWS1zRql1JRuxOW59MM6guJz0X9Yc4/D57RD RUGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=faKPlVCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170902758400b0015cdfb5dc6asi3197984pll.84.2022.05.10.06.13.47; Tue, 10 May 2022 06:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=faKPlVCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240470AbiEJLD5 (ORCPT + 99 others); Tue, 10 May 2022 07:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240100AbiEJLDz (ORCPT ); Tue, 10 May 2022 07:03:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BE5623AE44; Tue, 10 May 2022 03:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AC9E6B81C64; Tue, 10 May 2022 10:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697D8C385C6; Tue, 10 May 2022 10:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652180394; bh=mP4OuZOhZwV/dmB0cFoVtzXacKFaCfNyN7n0iv1nrYI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=faKPlVCxpkkG+QMDYcrORj/z3MB5YVFqVu+wQbcaXs0+6tfnQX0e8v5XuzT70UFh/ CFLz978/VZkKdqD2rpT3tdddkPoibz/Vv0lgkzMx1B4I4d4p/58knNF8Y/vOwesRqQ RDH3snK1vaizTlvvk38vPSmYEaPI2W7gRXyQ/sL7XwoEFGzoEZdmrqvZfTcfUyH9GE Pt2LsQGvvSnAW73WmE789tP9DT0fT+eotIpxrELWuth2dYipmMFRfDzsfHeanyIpUi 3A7s6ky9+vlTiTXBBTljVMB9W3myNjG5ys1s0RwUQWzDhXrQCMuhvcBEYOzvqyW68c CeT3cBJ4Mcbgg== Date: Tue, 10 May 2022 11:59:48 +0100 From: Will Deacon To: Francis Laniel Cc: linux-arm-kernel@lists.infradead.org, linux-trace-devel@vger.kernel.org, Catalin Marinas , Mark Brown , Peter Collingbourne , Mark Rutland , Kees Cook , Daniel Kiss , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v1 1/1] arm64: Forget syscall if different from execve*() Message-ID: <20220510105948.GB27557@willie-the-truck> References: <20220509151958.441240-1-flaniel@linux.microsoft.com> <20220509151958.441240-2-flaniel@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509151958.441240-2-flaniel@linux.microsoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2022 at 04:19:57PM +0100, Francis Laniel wrote: > This patch enables exeve*() to be traced by syscalls:sys_exit_execve > tracepoint. > Previously, calling forget_syscall() would set syscall to -1, which impedes > this tracepoint to prints its information. > So, this patch makes call to forget_syscall() conditional by only calling > it when syscall number is not execve() or execveat(). > > Signed-off-by: Francis Laniel > --- > arch/arm64/include/asm/processor.h | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 73e38d9a540c..e12ceb363d6a 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -34,6 +34,8 @@ > > #include > > +#include > + > #include > #include > #include > @@ -250,8 +252,12 @@ void tls_preserve_current_state(void); > > static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) > { > + s32 previous_syscall = regs->syscallno; > memset(regs, 0, sizeof(*regs)); > - forget_syscall(regs); > + if (previous_syscall == __NR_execve || previous_syscall == __NR_execveat) > + regs->syscallno = previous_syscall; > + else > + forget_syscall(regs); Hmm, this really looks like a bodge and it doesn't handle the compat case either. How do other architectures handle this? Will