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] [day] [month] [year] [list]
Date:   Wed, 8 Jan 2020 11:57:07 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Russell King <linux@...linux.org.uk>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...en8.de>,
        Brian Gerst <brgerst@...il.com>,
        Denys Vlasenko <dvlasenk@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Mark Rutland <mark.rutland@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        ard.biesheuvel@...aro.org, james.morse@....com, rabin@....in,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Enrico Weigelt <info@...ux.net>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm/ftrace: fix building on BE32

On Wed,  8 Jan 2020 15:36:30 +0100
Arnd Bergmann <arnd@...db.de> wrote:

> Compiling patch.c on BE32 fails because there is no definition
> of __opcode_to_mem_thumb32()
> 
> arch/arm/kernel/patch.c: In function '__patch_text_real':
> arch/arm/kernel/patch.c:94:11: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
> 
> Since we don't actually call it, only a declaration is required
> here, add one without a definition that fixes the build here
> but will cause a link failure if someone actually relies on the
> result.
> 
> Fixes: 5a735583b764 ("arm/ftrace: Use __patch_text()")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> Not sure if this version is any less ugly than the first
> approach of adding an #ifdef in patch.c

Adding #ifdef in headers is always better than adding it in C code.

Reviewed-by: Steven Rostedt (VMware) <rostedt@...dmis.org>

-- Steve

> ---
>  arch/arm/include/asm/opcodes.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h
> index 6bff94b2372b..f75f59c1257a 100644
> --- a/arch/arm/include/asm/opcodes.h
> +++ b/arch/arm/include/asm/opcodes.h
> @@ -110,14 +110,19 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
>  #define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
>  #define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
>  #define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
> -#ifndef CONFIG_CPU_ENDIAN_BE32
>  /*
>   * On BE32 systems, using 32-bit accesses to store Thumb instructions will not
>   * work in all cases, due to alignment constraints.  For now, a correct
> - * version is not provided for BE32.
> + * version is not provided for BE32, only an extern declaration to allow
> + * compiling patch.c
>   */
> +#ifndef CONFIG_CPU_ENDIAN_BE32
>  #define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
>  #define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
> +#else
> +#ifndef __ASSEMBLY__
> +extern unsigned __opcode_to_mem_thumb32(unsigned);
> +#endif
>  #endif
>  
>  #endif /* ! CONFIG_CPU_ENDIAN_BE8 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ