Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4099563pxb; Sun, 24 Oct 2021 19:57:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyclU9ZsFgtSt55fANFE49o9Cdl79BTGNz7+LnuOIGL3tlNGxwxCW4XskkTh7f9Nz6lB/OA X-Received: by 2002:a17:907:2062:: with SMTP id qp2mr19355668ejb.453.1635130666371; Sun, 24 Oct 2021 19:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635130666; cv=none; d=google.com; s=arc-20160816; b=K9P2zRdk+18WyKW73m8vlI6uPFegW+aA4IVPmbqU0LJcE9x6KE4xNGLA2QcZyZ2P/w n8L/HS7l09+H9L7zEBKers1p+VPSpcal7pg9qqW5E7DOkHaB1SMKzkt4oP4mrlpUjKbr F+JyjDHLDcfZSdOhJwmxQfRxkWKip1+Cwm51Y/wO7df3Qi3SrcIcUfhdDHwZlkzJWUsd GlHrEsi789mzxPU+TTzj2IyUNDyNmI60vXPbCL6hXfl2PW5QSnAHSzDb3WA+XKCUKF3q 32ZvhZRudVMi0cZGVZ9bxnhmvyEJ8rNNM3340i1yX9uijg63t5Zp08CPylv4C7qNdZ23 /3zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=snDqskQOwki6Dh2JQqrrahz5BKzkcZDGdSj72+X9ug8=; b=AKDglmRm3zQOhNHV1dGLBHQBHo69NJ9lCeRA0QRbFYWuqdq/DS0w6yVLfm/Sfb2f/7 VmV6XNg2bkclAb31iVzlWmfjzETkKb4qGmjAVfaOefmRfAjCaynMGxY44V7Mu33f5KXe EtqcNwASAOdFVhRGKZlPvpamsCiqa61GOdrpL8C+urHcQYstnpMGF7GcbVTmVO12/a2i 3kUJ7dyAN465fnhpdqZkU2JCXxwvEb1s5BRAqtXPJgnFsgToDoEIOtIFlHwRiMfZZeEH FGwmcNs9mpvWuIXvTX7r90mdrGVVeDJcR2DTrzdiFQJfw9lSPKJbB2wIJMTUxUY8PbSy TFxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h7Q5HDx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm23si1217607edb.11.2021.10.24.19.57.23; Sun, 24 Oct 2021 19:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h7Q5HDx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231985AbhJYCgx (ORCPT + 99 others); Sun, 24 Oct 2021 22:36:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231938AbhJYCgw (ORCPT ); Sun, 24 Oct 2021 22:36:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A7360F22; Mon, 25 Oct 2021 02:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635129270; bh=f6OSyvhMIWi68Z3XkUru890c/lNshTQisOxI1LmUwK8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h7Q5HDx7kupXfXJzh6ltB73mY9CelxUv9F0vAvZZu5RVRj0/PZfDZhF8OfBeoGVAf lquY/afDsM82L/9LmVLvRRzFuE5Ykw9u0b0AE3EJIUpTxYM5FgR6yvP4aAQkxEof2O EffmgX+3COq6qu//2D2JTR+6G5oZPw/dtNcD5jFDLjU4qoBG8pSAPtXSIORwXBYwjA yyYOsRFUa4Rlo2F7Xdnp8BkzcKKC6ROc6bMT3KA0XlLKchwsRDV61Lm3MuMSgV5Bxr hCb9dAGCeQ0lN0YXxg2dK9p7VvT7HHRbEs5Byz3sE9/FJiQkIEyvJ+cjlhCozpOV5L Jcdo3lsWGI2UQ== Date: Mon, 25 Oct 2021 11:34:27 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, Sven Schnelle , Catalin Marinas , Will Deacon , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 2/9] kprobes: Add a test case for stacktrace from kretprobe handler Message-Id: <20211025113427.b3e29c2fe16564578c401387@kernel.org> In-Reply-To: <20211022121537.32821979@gandalf.local.home> References: <163477765570.264901.3851692300287671122.stgit@devnote2> <163477767243.264901.10894979830215919916.stgit@devnote2> <20211022121537.32821979@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Oct 2021 12:15:37 -0400 Steven Rostedt wrote: > On Thu, 21 Oct 2021 09:54:32 +0900 > Masami Hiramatsu wrote: > > > Add a test case for stacktrace from kretprobe handler and > > nested kretprobe handlers. > > > > This test checks both of stack trace inside kretprobe handler > > and stack trace from pt_regs. Those stack trace must include > > actual function return address instead of kretprobe trampoline. > > The nested kretprobe stacktrace test checks whether the unwinder > > can correctly unwind the call frame on the stack which has been > > modified by the kretprobe. > > > > Since the stacktrace on kretprobe is correctly fixed only on x86, > > this introduces a meta kconfig ARCH_CORRECT_STACKTRACE_ON_KRETPROBE > > which tells user that the stacktrace on kretprobe is correct or not. > > > > The test results will be shown like below; > > > > TAP version 14 > > 1..1 > > # Subtest: kprobes_test > > 1..6 > > ok 1 - test_kprobe > > ok 2 - test_kprobes > > ok 3 - test_kretprobe > > ok 4 - test_kretprobes > > ok 5 - test_stacktrace_on_kretprobe > > ok 6 - test_stacktrace_on_nested_kretprobe > > # kprobes_test: pass:6 fail:0 skip:0 total:6 > > # Totals: pass:6 fail:0 skip:0 total:6 > > ok 1 - kprobes_test > > So my allmodconfig test failed on this: > > ERROR: modpost: "stack_trace_save_regs" [kernel/test_kprobes.ko] undefined! Oops. > > + /* > > + * Test stacktrace from pt_regs at the return address. Thus the stack > > + * trace must start from the target return address. > > + */ > > + ret = stack_trace_save_regs(regs, stack_buf, STACK_BUF_SIZE, 0); > > + KUNIT_EXPECT_NE(current_test, ret, 0); > > + KUNIT_EXPECT_EQ(current_test, stack_buf[0], target_return_address[1]); > > + > > + return 0; > > +} > > It appears that that "stack_trace_save_regs" is not exported. And this code > can be compiled as a module. Yes, if the selftest is compiled as a module, it has to remove the stack_trace_save_regs(). > > I'm going to continue testing my code, as I have over 40 patches that need > to go into next. I'll just rebase removing this commit only (hopefully > nothing else breaks), and if everything then passes, I'll push to next. OK, let me fix that. Thank you, > > -- Steve -- Masami Hiramatsu