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>] [day] [month] [year] [list]
Message-ID: <Yh9mdzA9R8jFJxO7@Red>
Date:   Wed, 2 Mar 2022 13:43:35 +0100
From:   Corentin Labbe <clabbe.montjoie@...il.com>
To:     Ard Biesheuvel <ardb@...nel.org>
Cc:     linux-arm-kernel@...ts.infradead.org, linux@...linux.org.uk,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: return_address: disable again for
 CONFIG_ARM_UNWIND=y

Le Wed, Mar 02, 2022 at 12:32:01PM +0100, Ard Biesheuvel a écrit :
> Commit 41918ec82eb6 ("ARM: ftrace: enable the graph tracer with the EABI
> unwinder") removed the dummy version of return_address() that was
> provided for the CONFIG_ARM_UNWIND=y case, on the assumption that the
> removal of the kernel_text_address() call from unwind_frame() in the
> preceding patch made it safe to do so.
> 
> However, this turns out not to be the case: Corentin reports warnings
> about suspicious RCU usage and other strange behavior that seems to
> originate in the stack unwinding that occurs in return_address().
> 
> Given that the function graph tracer (which is what these changes were
> enabling for CONFIG_ARM_UNWIND=y builds) does not appear to care about
> this distinction, let's revert return_address() to the old state.
> 
> Cc: Corentin Labbe <clabbe.montjoie@...il.com>
> Fixes: 41918ec82eb6 ("ARM: ftrace: enable the graph tracer with the EABI unwinder")
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> ---
>  arch/arm/include/asm/ftrace.h | 18 ++++++++++++++++++
>  arch/arm/kernel/Makefile      |  5 ++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
> index 5358aad67831..7e9251ca29fe 100644
> --- a/arch/arm/include/asm/ftrace.h
> +++ b/arch/arm/include/asm/ftrace.h
> @@ -35,8 +35,26 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
>  
>  #ifndef __ASSEMBLY__
>  
> +#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
> +/*
> + * return_address uses walk_stackframe to do it's work.  If both
> + * CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses unwind
> + * information.  For this to work in the function tracer many functions would
> + * have to be marked with __notrace.  So for now just depend on
> + * !CONFIG_ARM_UNWIND.
> + */
> +
>  void *return_address(unsigned int);
>  
> +#else
> +
> +static inline void *return_address(unsigned int level)
> +{
> +       return NULL;
> +}
> +
> +#endif
> +
>  #define ftrace_return_address(n) return_address(n)
>  
>  #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
> diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
> index 5cebb8d5a1d6..56511856ff9d 100644
> --- a/arch/arm/kernel/Makefile
> +++ b/arch/arm/kernel/Makefile
> @@ -25,7 +25,10 @@ obj-y		:= elf.o entry-common.o irq.o opcodes.o \
>  KASAN_SANITIZE_stacktrace.o := n
>  KASAN_SANITIZE_traps.o := n
>  
> -obj-y				+= return_address.o
> +ifneq ($(CONFIG_ARM_UNWIND),y)
> +obj-$(CONFIG_FRAME_POINTER)	+= return_address.o
> +endif
> +
>  obj-$(CONFIG_ATAGS)		+= atags_parse.o
>  obj-$(CONFIG_ATAGS_PROC)	+= atags_proc.o
>  obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o
> -- 
> 2.30.2
> 

This patch remove the RCU warning and the boot is now clean.

Reported-by: Corentin Labbe <clabbe.montjoie@...il.com>
Tested-by: Corentin Labbe <clabbe.montjoie@...il.com>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ