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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 1E0BFC433EF for ; Tue, 21 Sep 2021 06:58:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03B7461166 for ; Tue, 21 Sep 2021 06:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbhIUG7o (ORCPT ); Tue, 21 Sep 2021 02:59:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhIUG7n (ORCPT ); Tue, 21 Sep 2021 02:59:43 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0BBC061574 for ; Mon, 20 Sep 2021 23:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=p0YkjdTTA6iER5m9azQvivqmBm9b0xcRpaf9uMBcLQI=; b=mQY84ctDtKQ6Vz7/pmkUEcIwVO sLfCNnMGVZ9ORJAT27FXfL/Uu4WcSWbscoF5ZCoXzfWVn4omyXkbSKVwOHLZJXBzzgu0g4q/Bu2+s 4JU7UY3piyFafcoVHdTsMNZiJfNwtuMsbS5m6fU6Jo/FmFltWYlFV6ymFU84YEaGUD2c3am6BX7u1 OAsz4e/4uwpSh29LZpcz0muEcW6sjGMMtAf8XbkkEY/RWzQ/4/tsE8MDd0xkpiTye0l69MJVFgKrT pKNC17rm7lj13QUOOBi7vsreW7OPBk6fwp/0Qk4dLAZhzpRWsjfg88GczmkkIoLIV+9WwZ7Lrs29r G+VrUcbQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSZi7-003a0w-2i; Tue, 21 Sep 2021 06:57:18 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 311D5300274; Tue, 21 Sep 2021 08:56:56 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 541072C3EE3EA; Tue, 21 Sep 2021 08:56:56 +0200 (CEST) Date: Tue, 21 Sep 2021 08:56:56 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: Arnd Bergmann , kernel test robot , kbuild-all@lists.01.org, clang-built-linux , Linux Kernel Mailing List , Tianjia Zhang , Herbert Xu 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 Message-ID: References: <202108160330.T1EbbpCi-lkp@intel.com> <20210920175656.cjvrr4wn7a3k6tnx@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210920175656.cjvrr4wn7a3k6tnx@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 20, 2021 at 10:56:56AM -0700, 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 Acked-by: Peter Zijlstra (Intel) > --- > 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; > -- > 2.31.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6520749658885951090==" MIME-Version: 1.0 From: Peter Zijlstra To: kbuild-all@lists.01.org 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 Date: Tue, 21 Sep 2021 08:56:56 +0200 Message-ID: In-Reply-To: <20210920175656.cjvrr4wn7a3k6tnx@treble> List-Id: --===============6520749658885951090== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Sep 20, 2021 at 10:56:56AM -0700, 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 f= rame > = > Fixes: a7ee22ee1445 ("crypto: x86/sm4 - add AES-NI/AVX/x86_64 implementat= ion") > Reported-by: kernel test robot > Reported-by: Arnd Bergmann > Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) > --- > 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; > -- = > 2.31.1 >=20 --===============6520749658885951090==--