lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211022121537.32821979@gandalf.local.home>
Date:   Fri, 22 Oct 2021 12:15:37 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Masami Hiramatsu <mhiramat@...nel.org>
Cc:     "Naveen N . Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        Ananth N Mavinakayanahalli <ananth@...ux.ibm.com>,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
        Sven Schnelle <svens@...ux.ibm.com>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 2/9] kprobes: Add a test case for stacktrace from
 kretprobe handler

On Thu, 21 Oct 2021 09:54:32 +0900
Masami Hiramatsu <mhiramat@...nel.org> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ