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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAA3AC43334 for ; Tue, 28 Jun 2022 19:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YE8vNSVXYdFHNvb2O+ULClLeCXzZOdgVya+pkOsTw0A=; b=OBGNK+loKilDRE kQSnkoL06bs6Io8nizKrdEA8L3DWwdpKgATVpA6HtNRltka4Je8msFj3VOZ4v6bV/mbTyoHqMRZBa 3KntjbEQmug9y4xGcPbCcWxl7+VSrHmKH/BJCzv7ozzjRaf39lHAM+XRAOhRi87fOK/iOZrgMCcqL Pz28QBlNRBdxLZGeg1O8Er8zkfVk6GeA3fU8X0KqeQbT+Tsai1D4wso/MtMLi6vZWufJRsC/+lXLB QWCcFax4OjsK0TxjXKO6u7ru8itfyUNm1ntotr/uhCfT+o/h5VNikHaSzmPgyYnx17KqTx8zlA5iH 4TcUOH5DOUnnm5Tpvxsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6GrG-007pg1-Hr; Tue, 28 Jun 2022 19:26:46 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6GrA-007peu-Ho for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 19:26:44 +0000 Received: from pwmachine.localnet (lfbn-lyo-1-1062-211.w86-248.abo.wanadoo.fr [86.248.131.211]) by linux.microsoft.com (Postfix) with ESMTPSA id 28D8620CDF22; Tue, 28 Jun 2022 12:26:35 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 28D8620CDF22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1656444397; bh=yr6ynDdw6pyVh9Iwg4x+jvCjxckbKOv/2p2g1OJXeOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mduRND+hdKqkoVwX7rwN2WOfSSmhv5moEqFiXNXdSoyWo8lF1IcJzK1POPG9dc71u hcOxNdCTFYo+kw2fDyx1WE3cXbj585ZTHmUK0vNTkkbW4ypZwnGgBHwP3coyHuMO0y mxSyI6BDmOlJM5RsyUO0sm4gNpKKdVXnW3+CPANQ= From: Francis Laniel To: Will Deacon Cc: linux-trace-devel@vger.kernel.org, James Morse , Daniel Kiss , Catalin Marinas , Mark Brown , Peter Collingbourne , Kees Cook , Mark Rutland , Christophe Leroy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] arm64: Do not forget syscall when starting a new thread. Date: Tue, 28 Jun 2022 21:26:32 +0200 Message-ID: <3439466.iIbC2pHGDl@pwmachine> Organization: Microsoft In-Reply-To: <20220628135834.GA24116@willie-the-truck> References: <20220608162447.666494-1-flaniel@linux.microsoft.com> <20220608162447.666494-2-flaniel@linux.microsoft.com> <20220628135834.GA24116@willie-the-truck> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_122640_678781_7CD2E651 X-CRM114-Status: GOOD ( 27.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi. Le mardi 28 juin 2022, 15:58:35 CEST Will Deacon a =E9crit : > On Wed, Jun 08, 2022 at 05:24:46PM +0100, Francis Laniel wrote: > > This patch enables exeve*() to be traced with syscalls:sys_exit_execve > > tracepoint. > > Previous to it, by calling forget_syscall(), this tracepoint would not > > print its information as syscall is -1. > > So, this patch removes call to forget_syscall() and set regs->syscallno > > to its previous value. > > = > > Signed-off-by: Francis Laniel > > --- > > = > > arch/arm64/include/asm/processor.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > = > > diff --git a/arch/arm64/include/asm/processor.h > > b/arch/arm64/include/asm/processor.h index 9e58749db21d..86eb0bfe3b38 > > 100644 > > --- a/arch/arm64/include/asm/processor.h > > +++ b/arch/arm64/include/asm/processor.h > > @@ -272,8 +272,9 @@ void tls_preserve_current_state(void); > > = > > static inline void start_thread_common(struct pt_regs *regs, unsigned > > long pc) { > > = > > + s32 previous_syscall =3D regs->syscallno; > > = > > memset(regs, 0, sizeof(*regs)); > > = > > - forget_syscall(regs); > > + regs->syscallno =3D previous_syscall; > = > I'm still unsure about this. Even if we preserve the syscall number here, > won't all the arguments be reported as 0? I am not really sure what you meant about arguments, can you please precise = between command line arguments (ls -al) and syscall arguments (argp, envp, = etc.)? Indeed, if my understanding is correct syscall arguments are showed by = sys_enter_* while sys_exit_* only reports the syscall return code. Regarding the return code I think the value is correct as it is used in = syscall_trace_exit() but set in invoke_syscall() after the syscall finishes= [1, = 2]. The comparison of arm64 and amd64 output also shows no difference: # amd64 ls 435739 [002] 24689.292479: syscalls:sys_exit_execve: 0x0 7fc43732e100 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) # arm64 ls 266 [000] 34.708444: syscalls:sys_exit_execve: 0x0 1140 [unknown] (/usr/lib/aarch64-linux-gnu/ld-2.31.so) = > I also looked quickly at the 32-bit arch/arm/ code and it looks like the > same behaviour exists there (module CONFIG_BINFMT_ELF_FDPIC). I can try to fix it for this architecture too. Can you please point me the part of the code which shows the same behavior? = > Will Best regards. --- [1] https://elixir.bootlin.com/linux/v5.18/source/arch/arm64/kernel/ ptrace.c#L1868 [2] https://elixir.bootlin.com/linux/v5.18/source/arch/arm64/kernel/ syscall.c#L57 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel