From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBD84C433F5 for ; Wed, 22 Sep 2021 02:29:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97496610A1 for ; Wed, 22 Sep 2021 02:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbhIVCad (ORCPT ); Tue, 21 Sep 2021 22:30:33 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:52889 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhIVCac (ORCPT ); Tue, 21 Sep 2021 22:30:32 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UpB2F3U_1632277730; Received: from B-455UMD6M-2027.local(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UpB2F3U_1632277730) by smtp.aliyun-inc.com(127.0.0.1); Wed, 22 Sep 2021 10:28:51 +0800 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 To: Josh Poimboeuf , Arnd Bergmann Cc: kernel test robot , kbuild-all@lists.01.org, clang-built-linux , Peter Zijlstra , Linux Kernel Mailing List , Herbert Xu References: <202108160330.T1EbbpCi-lkp@intel.com> <20210920175656.cjvrr4wn7a3k6tnx@treble> From: Tianjia Zhang Message-ID: <6d49d3ba-ae5d-cd57-d1fb-d9df5b859cbe@linux.alibaba.com> Date: Wed, 22 Sep 2021 10:28:49 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210920175656.cjvrr4wn7a3k6tnx@treble> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/21/21 1:56 AM, Josh Poimboeuf wrote: > From: Josh Poimboeuf > 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 > Reported-by: Arnd Bergmann > Signed-off-by: Josh Poimboeuf Thanks for your fix. Reviewed-by: Tianjia Zhang 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; >