From patchwork Fri Oct 2 14:00:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sowmini Varadhan X-Patchwork-Id: 7316611 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 93AAEBEEA4 for ; Fri, 2 Oct 2015 14:00:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E38320412 for ; Fri, 2 Oct 2015 14:00:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E311220858 for ; Fri, 2 Oct 2015 14:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751841AbbJBOAi (ORCPT ); Fri, 2 Oct 2015 10:00:38 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:33443 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbbJBOAh (ORCPT ); Fri, 2 Oct 2015 10:00:37 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t92E0ZI0001187 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Oct 2015 14:00:35 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t92E0ZYb023824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 2 Oct 2015 14:00:35 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t92E0FJu012967; Fri, 2 Oct 2015 14:00:34 GMT Received: from oracle.com (/10.154.148.208) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 02 Oct 2015 07:00:15 -0700 Date: Fri, 2 Oct 2015 10:00:14 -0400 From: Sowmini Varadhan To: dhowells@redhat.com, linux-crypto@vger.kernel.org Cc: sowmini.varadhan@oracle.com Subject: unaligned access in pkcs7_verify Message-ID: <20151002140014.GI18263@oracle.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, I'm getting a lot of unaligned access messages each time I do "modprobe [-r] " on sparc: Kernel unaligned access at TPC[6ad9b4] pkcs7_verify+0x1ec/0x5e0 Kernel unaligned access at TPC[6a5484] crypto_shash_finup+0xc/0x5c Kernel unaligned access at TPC[6a5390] crypto_shash_update+0xc/0x54 Kernel unaligned access at TPC[10150308] sha1_sparc64_update+0x14/0x5c [sha1_sparc64] Kernel unaligned access at TPC[101501ac] __sha1_sparc64_update+0xc/0x98 [sha1_sparc64] Looks like these are being caused by an unaligned desc at desc = digest + digest_size; Doing this: makes the unaliagned message go away, but I dont know if sinfo->sig.digest_size needs to be set to the (unaligned) raw value of crypto_shash_digestsize() itself, and how to verify that this doesnt break something else in crypto --Sowmini --- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/crypto/asymmetric_keys/pkcs7_verify.c +++ b/crypto/asymmetric_keys/pkcs7_verify.c @@ -46,7 +46,8 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7, return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm); desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); - sinfo->sig.digest_size = digest_size = crypto_shash_digestsize(tfm); + sinfo->sig.digest_size = digest_size = + ALIGN(crypto_shash_digestsize(tfm), sizeof (*desc)); ret = -ENOMEM; digest = kzalloc(digest_size + desc_size, GFP_KERNEL);