Received: by 10.223.164.202 with SMTP id h10csp210489wrb; Mon, 13 Nov 2017 05:19:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMY/UbnVluRT3na3/C5WglwBWw523tcmfKuVeAgFmf/C4CL9BmeFgTjHo3ipHXpcL0Ax8gRL X-Received: by 10.84.235.137 with SMTP id p9mr8512237plk.291.1510579192925; Mon, 13 Nov 2017 05:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510579192; cv=none; d=google.com; s=arc-20160816; b=XwBgKfQfkVj5zNLJidgOBKnetfnWpQL9AN9OunU9XMV4LviEOsO24paQGIfBEKIVHl Gk8bqakLSRRPZy9vegS/PmhveTYNC+Lft/5Gi9/4gX7EgpAl5SCypcAD+/GomMdZdVV5 xdIG2YDmS7C859AO3eQJtib9y2hynnIqxadresq3nsoHe+uEjr5h5zcWm6sGFPqiwnMs qm5ZVGvvu9eRDAD7hB6XCBfCvgLOHpjv9oBqZTWm8/TSY3uvLnJ60HUECG996MD23coh ju1DuFHZ7PKItZ19qX981+t3S0aXi0QGblyz8Q/85ktHlq03qX468cwRFJgqTt8CAB/z CddQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SZX2kG9y78gxHSSjlEpobz8IB6QnDeuBxZqSQmmxByE=; b=eZ0p14g0gPsXYUnonl3xMiZGPI2ACbaiVYGRu5R+bptHilzM4AjX69dCpA2PUkDu0t /2s04QXczrGF+nDg4j9NEJxIYk4kex2mcsW0HH1t6eIKuoJGpqeFdSluppRhRCPPYRez N6rTGt+PtHL1UUFdSxEKrsh729QfQz9MOC82sHmakduLMKQY7xP7sPj5FysDhbZpIgdy AsUupEqMI3/VhFDqLJyOnL5SzdWPAgvHVhu9wQU4RNY2k0dlqcA5UmaBelrqEZadvu1v D1wu7EWFIIhrxtZZsF9pIkIMU3gND9N0WbSCkJzvM2xN+E1Wy2xkI2USj+bwMvOROFTs gkWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si13696610pgr.323.2017.11.13.05.19.40; Mon, 13 Nov 2017 05:19:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755108AbdKMNRn (ORCPT + 95 others); Mon, 13 Nov 2017 08:17:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51222 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754882AbdKMNCe (ORCPT ); Mon, 13 Nov 2017 08:02:34 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 221049C; Mon, 13 Nov 2017 13:02:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Andrey Ryabinin , Herbert Xu Subject: [PATCH 4.9 59/87] crypto: x86/sha256-mb - fix panic due to unaligned access Date: Mon, 13 Nov 2017 13:56:16 +0100 Message-Id: <20171113125620.756782658@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrey Ryabinin commit 5dfeaac15f2b1abb5a53c9146041c7235eb9aa04 upstream. struct sha256_ctx_mgr allocated in sha256_mb_mod_init() via kzalloc() and later passed in sha256_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 sha256_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: a377c6b1876e ("crypto: sha256-mb - submit/flush routines for AVX2") Reported-by: Josh Poimboeuf Signed-off-by: Andrey Ryabinin Acked-by: Tim Chen Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S +++ b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S @@ -155,8 +155,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} @@ -176,8 +176,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 @@ -234,8 +234,8 @@ ENTRY(sha256_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} From 1583956721236526075@xxx Mon Nov 13 13:14:03 +0000 2017 X-GM-THRID: 1583956721236526075 X-Gmail-Labels: Inbox,Category Promotions,HistoricalUnread