Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1876305pxb; Fri, 22 Oct 2021 09:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGHD8AhyS4YMEnunpT/zvpiKGJxik0kT6elUt9SNxmOj4VvN8fhKmnJCq8TinphHCXz5mQ X-Received: by 2002:a17:90b:3b44:: with SMTP id ot4mr1002498pjb.114.1634919422398; Fri, 22 Oct 2021 09:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634919422; cv=none; d=google.com; s=arc-20160816; b=09Apb+cQQgv1AqAceyJtBRDNRrRo0ZSl7SCK1Ri9uOll26h4h2PwEgrbC2mBSZcxtP FOKJWLXm2KSxHs02nTRwgZDnfAQoxAnapcZONVwQX0GS1VJ5E7yytU8mFAQjIgT5dA3P UMNSjfGJyUKNviL3t8vCXnpgLNxqUoGKiFLT12r5IrAG8FLZwcAtJV+SYdKlHhQN6b4Y O/PZR4FLIPKN1vNVWDmKy/SjNdDQqz7q+1hsZn8jLTaR0mU6hR0s/Uan6ku1hKrbWBgT N3Bxr6eZooLkGRWDQMbl/lx7HLJcrQtN1uP+5Ui1EzpPqh7GO4lJxbh1ruGITr1gErHQ ivSQ== 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; bh=O0C+zriYCSF0v845wiFInaWnPsCQNe/gjaeUTBB09jw=; b=ps6+PbZFDu3wuOABtK4Mlm7A/2BZ3untjqWoGTr93I8Kj5iyR+dpnj7837m+d2ASJE U8k5yLL883RD6h2B7GAkPSe6ib8+fPojQ/I5wjadCYuyjFoEGlQoS2XmApV9pdFwhYZl LT0talY32hKAHboOMJ5vWjARSarGbQWD17Ks1s+kJL6KSnvvbAwQIs8nV7/0BwWYzXOU YRiZrRfx2YQJrg97bVAETqRt8X06ugZPx71wF8F9AzLyHGW//dqZnfg9vlV7O+Ax/EkU PQD/wBQ1Mzf3HKSmDM6JhU9m2Dtgdp9v4JvmcD6EhKRI7+wW35CEPUSB/crIdqLmTvBX Njnw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si10497978pjs.122.2021.10.22.09.16.49; Fri, 22 Oct 2021 09:17:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbhJVQR6 (ORCPT + 99 others); Fri, 22 Oct 2021 12:17:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:57860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233562AbhJVQR5 (ORCPT ); Fri, 22 Oct 2021 12:17:57 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6F406112F; Fri, 22 Oct 2021 16:15:38 +0000 (UTC) Date: Fri, 22 Oct 2021 12:15:37 -0400 From: Steven Rostedt To: Masami Hiramatsu 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: <20211022121537.32821979@gandalf.local.home> In-Reply-To: <163477767243.264901.10894979830215919916.stgit@devnote2> References: <163477765570.264901.3851692300287671122.stgit@devnote2> <163477767243.264901.10894979830215919916.stgit@devnote2> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; 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 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! > + /* > + * 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. 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. -- Steve