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 557F4C433EF for ; Mon, 9 May 2022 15:21:57 +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=4lRlNj2tyCT1eQwxTA7dcsMO5S9/0nBMyV4Rvy2slHE=; b=w7XcNqJnt2yLJC lGxFc+zrI+30LyRZKc1+DVKrHzaSEwGTPqIlaRjmyCnQH09eKkvO93v7ouoM2CyOv+t8rox/UhDDL KJXbdl51R+s8z7y/FTweVK9ZFeHObyiH0Ja7nmXZCoitxO1EmjXQ2koS3gOg++38Vpo9g2ntf9hVo kXB3lAnvtHyxT53m697o1OkPqZ33/G3Lytfe9zOHQ6CCIwABuvZt/EwZv5kTj15U6ZH37u9dQ7PpK U8hTM9R3IxX02amOiIhlzSewCLC09e4spnQhlkoBWa4fMTj4+S5hdn4G1R3IYEMcpn1uNgGpofHZI ZDbnjFm8ufD5x0vjVzRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1no5Bx-00F4Li-DG; Mon, 09 May 2022 15:20:57 +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 1no5BM-00F44W-9F for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2022 15:20:21 +0000 Received: from localhost.localdomain (154.pool92-186-13.dynamic.orange.es [92.186.13.154]) by linux.microsoft.com (Postfix) with ESMTPSA id AD3C920EC5B5; Mon, 9 May 2022 08:20:14 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AD3C920EC5B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1652109618; bh=XfhHrRThZF8aOS0rr6qXUwCmQQucSBuKvTVfiEM2qbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfP8DfNAI4MBKVrm9g3GFZPRXm2UsXbAXmZc9kUs++r8+cQlyhl2L3hojSj8kbyi4 Vksl/ezacECICq5brWkqXPeiatkBkOPvlSoGfhRmHcvqaLVLc9mAWgvZaAN2kd2Whq xO/hMuKxaUpjSDLfB2hPytjNjVLDSjgFwtltB4lo= From: Francis Laniel To: linux-arm-kernel@lists.infradead.org Cc: linux-trace-devel@vger.kernel.org, Francis Laniel , Catalin Marinas , Will Deacon , Mark Brown , Peter Collingbourne , Mark Rutland , Kees Cook , Daniel Kiss , linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 1/1] arm64: Forget syscall if different from execve*() Date: Mon, 9 May 2022 16:19:57 +0100 Message-Id: <20220509151958.441240-2-flaniel@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509151958.441240-1-flaniel@linux.microsoft.com> References: <20220509151958.441240-1-flaniel@linux.microsoft.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220509_082020_393319_3529BCEB X-CRM114-Status: GOOD ( 13.83 ) 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="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 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); regs->pc = pc; if (system_uses_irq_prio_masking()) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel