From patchwork Fri Oct 8 12:28:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12545227 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8684C433F5 for ; Fri, 8 Oct 2021 12:31:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8C5AD60FC2 for ; Fri, 8 Oct 2021 12:31:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8C5AD60FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=JczNrKKTvEfIBRD2aURMFtuVcuVvUMY4Z8n1oyaeLVc=; b=fQd33Zt6RPbenV PB19WHutUFCIHDeBCU/Iywi1oqC9i/tg8Pv3rz7TQ7dg4pEkQZ1EGnSoClni8AHThWDN+goc8S06Z Ou20RoMcIFPkXrnA0Q2YIqy6oqxaDRS/21yrLHVjTv8gUev/oO9PecMCjp7O79zNmkGtC/P12eAcA O3nNxZPwjn8DwF+c/+yFns+sfxjgXXY/oFFHfBSaZ74/lZkOkgqFpM+LAd8o0HNBTzRHaQWt2a3yq zwe3xqkJXWe6ysO5tzAwHwPZqeslzGyfY882AI0vz1AMscpbutM0rkZCLJZU0JYDBPjoJVJyHgvCr RpZwKgozImfrFHEF6T8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYozy-002iCA-GM; Fri, 08 Oct 2021 12:29:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYoz4-002hsY-8x for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 12:28:19 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2F8760F48; Fri, 8 Oct 2021 12:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633696097; bh=JfCUmjaLkUSD15VcAhkRn1LbezN+xsj1TN/vh4p83DE=; h=From:To:Cc:Subject:Date:From; b=g223vqRtq6KNgcgConU7RQQ+pVnkqgzBTKCdbqP/UzuJd+cgEgn056KrocDoLfZa4 MtbdsjG5gheIHe2VcjX96J05tJ6rI0IWuNcyeF7X9pWrMNmsqU3JB04CCvetasCGfR FgfUYgoJ/kOJKJD5PhiQ58YhPb6y+CSv5s3AIoQZDcxJqnaHEtJWBt2C7TWdysjg5F jZTesbId0gF2LoL4THkndVZgTUcXohkxklQ21mRxcMuYXqH+Ahy/qYqYs+zDqoUdkS 2hepQ9aNFoJK3wksFv2FScFPfr35B4onnXyxTooKgt5XqN1DYfculQQThqqRIjq7sz CCtTleXUT1rzg== From: Masami Hiramatsu To: Steven Rostedt Cc: "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, mhiramat@kernel.org, Sven Schnelle , Catalin Marinas , Will Deacon , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/8] kprobes: Make KUnit and add stacktrace on kretprobe tests Date: Fri, 8 Oct 2021 21:28:13 +0900 Message-Id: <163369609308.636038.15295764725220907794.stgit@devnote2> X-Mailer: git-send-email 2.25.1 User-Agent: StGit/0.19 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211008_052818_387049_A0525CF0 X-CRM114-Status: GOOD ( 12.29 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Here is the series to change the kprobes selftest to KUnit and add testcases for stacktrace on kretprobes, which has been fixed recently on x86. KUnit conversion work has been done by Sven. (Thanks!) I found that if there are testcases for the stacktrace on kretprobes we can make sure that the stacktrace can work or not while booting. So I added 2 additinal Kunit test cases for stacktrace on kretprobe. One is for a simple stacktrace on kretprobe, the other is for the stacktrace with kretprobes on nested functions. But actually, this is currently only for the x86. Thus I also added some fixes to enable stacktrace on kretprobe on arm and arm64. Note that for the arm, this series only supports framepointer based stacktrace. To support ARM unwinder, will need more work. Thank you, --- Masami Hiramatsu (7): kprobes: Add a test case for stacktrace from kretprobe handler arm64: kprobes: Record frame pointer with kretprobe instance arm64: kprobes: Make a frame pointer on __kretprobe_trampoline arm64: Recover kretprobe modified return address in stacktrace ARM: clang: Do not relay on lr register for stacktrace ARM: kprobes: Make a frame pointer on __kretprobe_trampoline ARM: Recover kretprobe modified return address in stacktrace Sven Schnelle (1): kprobes: convert tests to kunit arch/Kconfig | 8 + arch/arm/Kconfig | 1 arch/arm/include/asm/stacktrace.h | 5 arch/arm/kernel/return_address.c | 2 arch/arm/kernel/stacktrace.c | 11 + arch/arm/probes/kprobes/core.c | 29 ++ arch/arm64/Kconfig | 1 arch/arm64/include/asm/stacktrace.h | 2 arch/arm64/kernel/probes/kprobes.c | 4 arch/arm64/kernel/probes/kprobes_trampoline.S | 4 arch/arm64/kernel/stacktrace.c | 3 arch/x86/Kconfig | 1 kernel/kprobes.c | 3 kernel/test_kprobes.c | 374 ++++++++++++++----------- lib/Kconfig.debug | 3 15 files changed, 278 insertions(+), 173 deletions(-) -- Masami Hiramatsu (Linaro)