From patchwork Sun Oct 8 20:50:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 9991997 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9080760231 for ; Sun, 8 Oct 2017 20:57:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7690F28618 for ; Sun, 8 Oct 2017 20:57:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 693242861A; Sun, 8 Oct 2017 20:57:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF2E628618 for ; Sun, 8 Oct 2017 20:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbdJHU5p (ORCPT ); Sun, 8 Oct 2017 16:57:45 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:55007 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751489AbdJHU5p (ORCPT ); Sun, 8 Oct 2017 16:57:45 -0400 X-Greylist: delayed 400 seconds by postgrey-1.27 at vger.kernel.org; Sun, 08 Oct 2017 16:57:45 EDT Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 7fb45f8d; Sun, 8 Oct 2017 20:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id; s=mail; bh=THCo4ArDLu90PbjauBWyD3wrLy8 =; b=i6na3BaJDIZg9TWgN0c2SGK0TgzQcH2otmebXmaKJlzZ7z8+ZPnXXMkMAXq 00jKWzdhJg2NlBdV3rEbu4tsHWjAZQ7VPWtCPTDcxsNw2FvV0u8hpdqFNSvJuenu gEWHqPJDY+Zknt9wIUDHv6UfMY1F33zbHrhYdPx04mFfycvP4jIL8IenlxvoDwPL ZPAWwN7JkjqmluyQoeN27pew0UMqj2aB6CraxA/9CdlPUuXkbpVjBunRmxMJaCUY HHIiS/eMCVgxCIOK01/PpQ/zmD5+ZyYWc5uWxCRa60Btusw8JKylvU+1iEx82PFN z9aUyS/0wrOStG+8HhZumVjau0Q== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id e5262b24 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sun, 8 Oct 2017 20:40:33 +0000 (UTC) From: "Jason A. Donenfeld" To: Herbert Xu , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, martin@strongswan.org Cc: "Jason A. Donenfeld" Subject: [PATCH] chacha20-ssse3/avx2: satisfy stack validation 2.0 Date: Sun, 8 Oct 2017 22:50:53 +0200 Message-Id: <20171008205053.13201-1-Jason@zx2c4.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The new stack validator in objdump doesn't like directly assigning r11 to rsp, warning with something like: warning: objtool: chacha20_4block_xor_ssse3()+0xa: unsupported stack pointer realignment warning: objtool: chacha20_8block_xor_avx2()+0x6: unsupported stack pointer realignment This fixes things up to use code similar to gcc's DRAP register, so that objdump remains happy. Signed-off-by: Jason A. Donenfeld Fixes: baa41469a7b9 ("objtool: Implement stack validation 2.0") --- arch/x86/crypto/chacha20-avx2-x86_64.S | 4 ++-- arch/x86/crypto/chacha20-ssse3-x86_64.S | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/crypto/chacha20-avx2-x86_64.S b/arch/x86/crypto/chacha20-avx2-x86_64.S index 3a2dc3dc6cac..f3cd26f48332 100644 --- a/arch/x86/crypto/chacha20-avx2-x86_64.S +++ b/arch/x86/crypto/chacha20-avx2-x86_64.S @@ -45,7 +45,7 @@ ENTRY(chacha20_8block_xor_avx2) vzeroupper # 4 * 32 byte stack, 32-byte aligned - mov %rsp, %r8 + lea 8(%rsp),%r10 and $~31, %rsp sub $0x80, %rsp @@ -443,6 +443,6 @@ ENTRY(chacha20_8block_xor_avx2) vmovdqu %ymm15,0x01e0(%rsi) vzeroupper - mov %r8,%rsp + lea -8(%r10),%rsp ret ENDPROC(chacha20_8block_xor_avx2) diff --git a/arch/x86/crypto/chacha20-ssse3-x86_64.S b/arch/x86/crypto/chacha20-ssse3-x86_64.S index 3f511a7d73b8..512a2b500fd1 100644 --- a/arch/x86/crypto/chacha20-ssse3-x86_64.S +++ b/arch/x86/crypto/chacha20-ssse3-x86_64.S @@ -160,7 +160,7 @@ ENTRY(chacha20_4block_xor_ssse3) # done with the slightly better performing SSSE3 byte shuffling, # 7/12-bit word rotation uses traditional shift+OR. - mov %rsp,%r11 + lea 8(%rsp),%r10 sub $0x80,%rsp and $~63,%rsp @@ -625,6 +625,6 @@ ENTRY(chacha20_4block_xor_ssse3) pxor %xmm1,%xmm15 movdqu %xmm15,0xf0(%rsi) - mov %r11,%rsp + lea -8(%r10),%rsp ret ENDPROC(chacha20_4block_xor_ssse3)