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]
Message-ID: <6d49d3ba-ae5d-cd57-d1fb-d9df5b859cbe@linux.alibaba.com>
Date:   Wed, 22 Sep 2021 10:28:49 +0800
From:   Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>,
        Arnd Bergmann <arnd@...nel.org>
Cc:     kernel test robot <lkp@...el.com>, kbuild-all@...ts.01.org,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [linux-next:master 3857/7963]
 arch/x86/crypto/sm4-aesni-avx-asm_64.o: warning: objtool:
 sm4_aesni_avx_crypt8()+0x8: sibling call from callable instruction with
 modified stack frame



On 9/21/21 1:56 AM, Josh Poimboeuf wrote:
> From: Josh Poimboeuf <jpoimboe@...hat.com>
> Subject: [PATCH] x86/crypto/sm4: Fix frame pointer stack corruption
> 
> sm4_aesni_avx_crypt8() sets up the frame pointer (which includes pushing
> RBP) before doing a conditional sibling call to sm4_aesni_avx_crypt4(),
> which sets up an additional frame pointer.  Things will not go well when
> sm4_aesni_avx_crypt4() pops only the innermost single frame pointer and
> then tries to return to the outermost frame pointer.
> 
> Sibling calls need to occur with an empty stack frame.  Do the
> conditional sibling call *before* setting up the stack pointer.
> 
> This fixes the following warning:
> 
>    arch/x86/crypto/sm4-aesni-avx-asm_64.o: warning: objtool: sm4_aesni_avx_crypt8()+0x8: sibling call from callable instruction with modified stack frame
> 
> Fixes: a7ee22ee1445 ("crypto: x86/sm4 - add AES-NI/AVX/x86_64 implementation")
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Arnd Bergmann <arnd@...nel.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>

Thanks for your fix.

Reviewed-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>

Thanks.

> ---
>   arch/x86/crypto/sm4-aesni-avx-asm_64.S | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/sm4-aesni-avx-asm_64.S b/arch/x86/crypto/sm4-aesni-avx-asm_64.S
> index fa2c3f50aecb..a50df13de222 100644
> --- a/arch/x86/crypto/sm4-aesni-avx-asm_64.S
> +++ b/arch/x86/crypto/sm4-aesni-avx-asm_64.S
> @@ -367,10 +367,12 @@ SYM_FUNC_START(sm4_aesni_avx_crypt8)
>   	 *	%rdx: src (1..8 blocks)
>   	 *	%rcx: num blocks (1..8)
>   	 */
> -	FRAME_BEGIN
>   
>   	cmpq $5, %rcx;
>   	jb sm4_aesni_avx_crypt4;
> +
> +	FRAME_BEGIN
> +
>   	vmovdqu (0 * 16)(%rdx), RA0;
>   	vmovdqu (1 * 16)(%rdx), RA1;
>   	vmovdqu (2 * 16)(%rdx), RA2;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ