From patchwork Fri Oct 15 12:50:43 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: 12561441 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 005A5C433EF for ; Fri, 15 Oct 2021 12:53:39 +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 BF4FB60F56 for ; Fri, 15 Oct 2021 12:53:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF4FB60F56 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=UOBXgOMzB7b5kFjpplHyWULWuzyRNM0cTQqJopmKlwI=; b=wHD2M2U0vyO2DQ fcYAxeunHzSdjkaU1/LLEwfwxDou2baIbVxyjzW34UIIBi67RmKhi33yP7zdHWb7r3/WeIPB7o3O/ 7DoeTSf5zebMdzeegNqUWjKVDOm/02NLsNJXZxrPzJys8W4v9JPurgoyVwXJcxc1rAbTdew4pID88 p7OT2Juai1KnGW0C8g9aOxW30Cz9w8Xfu6frtP6vmyyaui+7cFcUFTHXTIeFlVhguiCQszvkEFw/o 9Sm7sjqrLNMhIeiRN8k2dDqIsWc+E0Eu8WJoLSlckVnFbl3UenlCFYM2b2S6zqw5YK+oJzLVqc/EK ycSct4XVHTwRQa/qlOQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbMgz-0071cl-2I; Fri, 15 Oct 2021 12:52:09 +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 1mbMfh-0070qQ-FR for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 12:50:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id AA77860ED4; Fri, 15 Oct 2021 12:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634302248; bh=h8PVGKy7AZLLt4A4MFd/SwUgcbAlvVwYsYk9VVpprvg=; h=From:To:Cc:Subject:Date:From; b=ITg7dZgMJi6lOjRNDFvnzxW58CJUmOePHIZxeSrw3f74wsHcFm/LeipMq4mONGwYF o1pLz0jDbSNnrEbQYwdl8pLpFSCJ7tmUBlNcw7gR4mFNoC5S933VpuRFmLMuIDlMW4 t6B7tPTDK5G+shBplIMpS0z2wY2cWS8p+NTPBXw7tKnjgP2Mu2U0LbSoSSh2F7j/hl 9iF3nPtlXBu7GHrcJ7aGY3/ICsvYX0WL/qVGnzl/fZmSilVlCIK8k82HhO9lVQqcWP rqvZxUnc0n0BACKjTR1V9AAoUtpiRiL43rD8SxRN/NsM9Vk+cBUg2ApDyKYjxtcnBf F40XWrVcPSRRg== 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 00/10] kprobes: Make KUnit and add stacktrace on kretprobe tests Date: Fri, 15 Oct 2021 21:50:43 +0900 Message-Id: <163430224341.459050.2369208860773018092.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-20211015_055049_593983_F9F007D4 X-CRM114-Status: GOOD ( 13.74 ) 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 2nd version of the series to change the kprobes selftest to KUnit and add testcases for stacktrace on kretprobes, which has been fixed recently on x86. The previous version is here; https://lore.kernel.org/all/163369609308.636038.15295764725220907794.stgit@devnote2/ In this version, I fixed some typos and coding issues according to Will and Mark's comments. Thanks! And I added 1 RFC patch, which will detect the unwinding error on arm64 (just for testing) according to Mark's comment. But since I'm not sure how to handle that error correctly in the unwinder code. So this is just for testing. Mark, can you tell me how can I handle it? Just asserted by WARN_ON_ONCE() is OK? Or print out more error information? For the debugging, we need more information, so I printed out the error code. Thank you, --- Masami Hiramatsu (9): kprobes: Add a test case for stacktrace from kretprobe handler x86/unwind: Compile kretprobe fixup code only if CONFIG_KRETPROBES=y 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 rely on lr register for stacktrace ARM: kprobes: Make a frame pointer on __kretprobe_trampoline ARM: Recover kretprobe modified return address in stacktrace [RFC] arm64: kprobes: Detect error of kretprobe return address fixup Sven Schnelle (1): kprobes: convert tests to kunit arch/Kconfig | 8 + arch/arm/Kconfig | 1 arch/arm/include/asm/stacktrace.h | 9 + arch/arm/kernel/return_address.c | 4 arch/arm/kernel/stacktrace.c | 17 + arch/arm/probes/kprobes/core.c | 29 ++ arch/arm64/Kconfig | 1 arch/arm64/include/asm/stacktrace.h | 4 arch/arm64/kernel/probes/kprobes.c | 4 arch/arm64/kernel/probes/kprobes_trampoline.S | 4 arch/arm64/kernel/stacktrace.c | 13 + arch/x86/Kconfig | 1 arch/x86/include/asm/unwind.h | 6 include/linux/kprobes.h | 2 kernel/kprobes.c | 52 +++ kernel/test_kprobes.c | 374 ++++++++++++++----------- lib/Kconfig.debug | 3 17 files changed, 359 insertions(+), 173 deletions(-) -- Masami Hiramatsu (Linaro)