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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Sep 2021 16:03:55 +0200
From:   Vasily Gorbik <gor@...ux.ibm.com>
To:     Marco Elver <elver@...gle.com>
Cc:     Heiko Carstens <hca@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, qemu-s390x <qemu-s390x@...gnu.org>
Subject: Re: [GIT PULL] s390 updates for 5.15 merge window

On Tue, Aug 31, 2021 at 05:02:15PM +0200, Marco Elver wrote:
> 2. stack_trace_save() is subtly broken on s390: it starts the trace in
>    stack_trace_save() itself. This is incorrect, as the trace should
>    start with the caller. We reported something similar to arm64, also
>    because one of our sanitizer tests failed:
>    https://lkml.kernel.org/r/20210319184106.5688-1-mark.rutland@arm.com

Thanks a lot for looking into it and debugging it!

> Fix it by skipping the initial entry in s390's arch_stack_walk().

...

> diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c
> index 101477b3e263..47d1841af03e 100644
> --- a/arch/s390/kernel/stacktrace.c
> +++ b/arch/s390/kernel/stacktrace.c
> @@ -16,11 +16,16 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
>  {
>  	struct unwind_state state;
>  	unsigned long addr;
> +	bool init = true;
>  
>  	unwind_for_each_frame(&state, task, regs, 0) {
>  		addr = unwind_get_return_address(&state);
> -		if (!addr || !consume_entry(cookie, addr))
> +		if (!addr)
> +			break;
> +
> +		if (!init && !consume_entry(cookie, addr))
>  			break;
> +		init = false;
>  	}

I believe we don't need to skip the first unwinder result if task != current
or regs != NULL. Same for arch_stack_walk_reliable.

But after you pinpointed the problem I see that the actual difference
with x86 implementation comes from get_stack_pointer(). I'll send a patch
as reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ