Message ID | 20171016155131.10118-2-aryabinin@virtuozzo.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show
Return-Path: <linux-crypto-owner@kernel.org> 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 0258C60235 for <patchwork-linux-crypto@patchwork.kernel.org>; Mon, 16 Oct 2017 15:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8506285CD for <patchwork-linux-crypto@patchwork.kernel.org>; Mon, 16 Oct 2017 15:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAB4C285D9; Mon, 16 Oct 2017 15:49:13 +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 7ED68285CD for <patchwork-linux-crypto@patchwork.kernel.org>; Mon, 16 Oct 2017 15:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753766AbdJPPs7 (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Mon, 16 Oct 2017 11:48:59 -0400 Received: from mail-db5eur01on0116.outbound.protection.outlook.com ([104.47.2.116]:39335 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753904AbdJPPso (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Mon, 16 Oct 2017 11:48:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=umGg23oceT3TbH60BWpOE/cloQdRN7bbNlSZZASpG5s=; b=ggSVe5/purpHZjc/4vo63MUrq/hIsOH//DpqKO3E6Tur9Xp15s8gVDQC4yjuCgfSwBhmFynvikpZCybSBfZSymhKxjTJsJeBKdKX5/+kQblObOSbTkyys68+3GNOdV6kBlvuA7wsg9w9H34bS5pZJQvGrQMAP4+CHI21Tnxota8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from localhost.sw.ru (195.214.232.6) by VI1PR08MB2832.eurprd08.prod.outlook.com (2603:10a6:802:25::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 16 Oct 2017 15:48:38 +0000 From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, Linus Torvalds <torvalds@linux-foundation.org>, Jeffrey Walton <noloader@gmail.com>, Megha Dey <megha.dey@linux.intel.com>, Tim Chen <tim.c.chen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Andrey Ryabinin <aryabinin@virtuozzo.com>, stable@vger.kernel.org Subject: [PATCH 2/2] x86/crypto/sha1-mb: fix panic due to unaligned access Date: Mon, 16 Oct 2017 18:51:31 +0300 Message-Id: <20171016155131.10118-2-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171016155131.10118-1-aryabinin@virtuozzo.com> References: <20171016155131.10118-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0701CA0013.eurprd07.prod.outlook.com (2603:10a6:203:51::23) To VI1PR08MB2832.eurprd08.prod.outlook.com (2603:10a6:802:25::31) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d7e43ba-a9e5-48af-3c81-08d514ad5eed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:VI1PR08MB2832; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB2832; 3:NFonaJgiMkMqqyOUoSBTDvU6TWMdwgp+Sfd/Z58tUgFKGjCfavsxUTa1bldCjTTdsTdfzFV3cVYe1RI984tPET2T5In5NOHRbyAuEx8GxoyPFWllyPDrEGFLMEalsyYaCoJx/0Odd0oCJCZQ1meFvjl+rsFcrPyCzTrrQN4/dwtVr8cLVYe6fxjJqjSNqRw1zWB4QzFhFpKvKLBd0OqKWo7lvSb1mfTIDLOhl9t9fzidPvXvyUA6debbdk0W2eMD; 25:/Ktrd+AsngIgIhbM6q6V7/LyvAEDy4+gnV7jrlCoI2FhrPK/vuL4D1A6iHqadKMEbLTuxV53I3N33c4O7d5UeIdBFTpd28mhIScSSNT7eEGd+2jcEy7C9nbTFqF5zwSG60eAhCffAb+O7XmliCHXddFoIuEQQSaAQ5gLl/vD0WLy18kGxlYdLxvCRZmdcv4CQ2PPwZhOtTWpdpSptb9eiMWuxEMza9VH6NWcrkFvjLQb3b80llv/P0JS+Dizd5lrTZX4TXaFielkDna7VBQi5qpUMOrho1fdfAYMHiQZ5Sy3qQDGLWawcl6ydOCtLVRo9q9Kro86Dx+g/DeCHQdyNw==; 31:4hmsfjhFBzTimvK57d5yYx1/bH0+cwncYici5tROw4hjLwsmpoAFkQ01ARVTU1d8u8bhn8bvj0ZGQMwtxRgPQg8YhYX6ez6PplCwGal2EzcnxtrVr2rR1dGnsLCd3s5uFOcMp2s66z9MThAB54m1ZANHniWvd7u+WfvzsALf8qq5hkdT/OKzPTAcZbdYnYruq1ycOWD+kvilm6kMEcG2CM1hJBP5+VTe6VKkoGMwuXI= X-MS-TrafficTypeDiagnostic: VI1PR08MB2832: X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB2832; 20:TV3WtThWZo0NYZiSOu+JvzJr+rFx7hharb98iLsMYMJdeFAjRy8E6jNJI4IeztcoQUAFE1kGqXfDo7EnDeoHMuHtNUszXgB2pRZ21R8DWo3V0fYAojCinegx5Xeno+qFO+TMYjPn3Sc2Zd43vYku7MlrA7x/jbPgG7pUJGVNCyZD31RK13NL91xA9Y9VEN4gtT0TUxCOcHWMn0PAZ+JratB2XpwIBCR+bEI3objFzGjKejKhZW8LuR/EnhJpU/SjxaYdc5eIdLXJX2XCf0tIX8V/4GZY1PFLL5RnuMWe2bwtnfZgkyD9zgfz3VAe/AAY6H1Bw8PPUZ4shJd0ukYmjjPEMeAVk9OyjjlzTlrXJaoi5KljGypRYu4/0V46MfXkV3nn8qdhifBW5FSZKvvCipRG3khxMd5W0MW3dLFap68=; 4:fRoUnoiNgAdvaXVWIzvNe32IIfsXHm5jGjG2f0oNrM5M02yZsjtdAoyT08ruyYVYs4CHopDZQB6D9+pPubRJ0+Tu/2zf3924PLaUXrz7NIKkTox6+4aQiTFWoW1m9Ww8dhMnCi3DMv4gIZKSSfwuprC0bjXgAL6Az6BXnqb9As7h5F8w4lOR2/3zna6Ql2eBwjnFZmi3P+SnrFuE/i8sm/Xwuob/v2hww/MyiQ37Zp1iw8axrfqSzTIT+GsUsaoGlp7712Nyg/Md95xgCTiEOHLEqRKM24FLozHCIQ06Yac= X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Microsoft-Antispam-PRVS: <VI1PR08MB2832FFC6A6F3E0713D2FA008B04F0@VI1PR08MB2832.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR08MB2832; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR08MB2832; X-Forefront-PRVS: 0462918D61 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(6069001)(6009001)(346002)(39830400002)(376002)(199003)(189002)(305945005)(81166006)(81156014)(189998001)(7736002)(54906003)(6512007)(6506006)(36756003)(6116002)(3846002)(8936002)(97736004)(16526018)(69596002)(7416002)(5660300001)(50226002)(4326008)(39060400002)(53936002)(86362001)(68736007)(50986999)(76176999)(33646002)(50466002)(478600001)(53416004)(66066001)(76506005)(6666003)(2950100002)(6916009)(25786009)(8676002)(2906002)(105586002)(5003940100001)(47776003)(48376002)(1076002)(16586007)(6486002)(106356001)(101416001)(316002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB2832; H:localhost.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB2832; 23:mcsso8rzfbU37v/3Cck+YcFfHbRnjokY+04VtXmWa?= =?us-ascii?Q?6GcfqNaR2u8Q2kgEly4SQ8Z++5X5LU+s2toeMhqRXPzxCta0E7k0/YDybVGx?= =?us-ascii?Q?l29/7/web58+ysiKGhcC6H3te0M1p7Yoiq71b221SbP8pEvFDkBLdNWQhy1y?= =?us-ascii?Q?o23OWP3Bhix8bKd1VQFODao9Ds76zEk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tcrbVaksRmdSURyDIwYkheVEDmx++CdmznedXUYgRWT6c/u5MGEwwMdxtKanSXurtgNy4Wgl4TJ+3cXeAB0xz+NkYvHRyvOB55+knOwpnv7FHd6CnnecZ8LcFl626ROYCcyyLrK7J8kEZ0BgF0+HYyF2cC8dCzHkyorN3GJLYdfp43vx2MNqsA0kHYY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB2832; 20:r8MQYE/Kq/9hlSmGaH11nsmykQnfjtlH7nuv7z9oVOOn0W186Vtvs7aDqPf1XHFRZk/RpXyzAs/VwBT6z8JJ0epLi07e11gycM2yuqmSiNYQ/0KPasXnwq1NaseoC5YcxxUZ/9RqSzc4bL83YRqWEZWwmUjbtEhPQX0JZiZHV9Q= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2017 15:48:38.3859 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2832 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S index 93b945597ecf..7cfba738f104 100644 --- a/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S +++ b/arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S @@ -157,8 +157,8 @@ LABEL skip_ %I .endr # Find min length - vmovdqa _lens+0*16(state), %xmm0 - vmovdqa _lens+1*16(state), %xmm1 + vmovdqu _lens+0*16(state), %xmm0 + vmovdqu _lens+1*16(state), %xmm1 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} @@ -178,8 +178,8 @@ LABEL skip_ %I vpsubd %xmm2, %xmm0, %xmm0 vpsubd %xmm2, %xmm1, %xmm1 - vmovdqa %xmm0, _lens+0*16(state) - vmovdqa %xmm1, _lens+1*16(state) + vmovdqu %xmm0, _lens+0*16(state) + vmovdqu %xmm1, _lens+1*16(state) # "state" and "args" are the same address, arg1 # len is arg2 @@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2) jc .return_null # Find min length - vmovdqa _lens(state), %xmm0 - vmovdqa _lens+1*16(state), %xmm1 + vmovdqu _lens(state), %xmm0 + vmovdqu _lens+1*16(state), %xmm1 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
struct sha1_ctx_mgr allocated in sha1_mb_mod_init() via kzalloc() and later passed in sha1_mb_flusher_mgr_flush_avx2() function where instructions vmovdqa used to access the struct. vmovdqa requires 16-bytes aligned argument, but nothing guarantees that struct sha1_ctx_mgr will have that alignment. Unaligned vmovdqa will generate GP fault. Fix this by replacing vmovdqa with vmovdqu which doesn't have alignment requirements. Fixes: 2249cbb53ead ("crypto: sha-mb - SHA1 multibuffer submit and flush routines for AVX2") Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: <stable@vger.kernel.org> --- arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)