Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245810 > unrolled thread
| Started by | Sowmini Varadhan <sowmini.varadhan@oracle.com> |
|---|---|
| First post | 2015-10-13 17:00 +0200 |
| Last post | 2015-10-15 17:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] crypto/pkcs7_verify: Fix unaligned access in pkcs7_verify() Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-10-13 17:00 +0200
Re: [PATCH] crypto/pkcs7_verify: Fix unaligned access in pkcs7_verify() Herbert Xu <herbert@gondor.apana.org.au> - 2015-10-14 16:30 +0200
Re: [PATCH] crypto/pkcs7_verify: Fix unaligned access in pkcs7_verify() David Howells <dhowells@redhat.com> - 2015-10-15 17:20 +0200
| From | Sowmini Varadhan <sowmini.varadhan@oracle.com> |
|---|---|
| Date | 2015-10-13 17:00 +0200 |
| Subject | [PATCH] crypto/pkcs7_verify: Fix unaligned access in pkcs7_verify() |
| Message-ID | <qj9dw-1jL-11@gated-at.bofh.it> |
On sparc, we see unaligned access messages on each modprobe[-r]:
Kernel unaligned access at TPC[6ad9b4] pkcs7_verify [..]
Kernel unaligned access at TPC[6a5484] crypto_shash_finup [..]
Kernel unaligned access at TPC[6a5390] crypto_shash_update [..]
Kernel unaligned access at TPC[10150308] sha1_sparc64_update [..]
Kernel unaligned access at TPC[101501ac] __sha1_sparc64_update [..]
These ware triggered by mod_verify_sig() invocations of pkcs_verify(), and
are are being caused by an unaligned desc at (sha1, digest_size is 0x14)
desc = digest + digest_size;
To fix this, pkcs7_verify needs to make sure that desc is pointing
at an aligned value past the digest_size, and kzalloc appropriately,
taking alignment values into consideration.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
crypto/asymmetric_keys/pkcs7_verify.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
index d20c0b4..325575c 100644
--- a/crypto/asymmetric_keys/pkcs7_verify.c
+++ b/crypto/asymmetric_keys/pkcs7_verify.c
@@ -49,11 +49,12 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7,
sinfo->sig.digest_size = digest_size = crypto_shash_digestsize(tfm);
ret = -ENOMEM;
- digest = kzalloc(digest_size + desc_size, GFP_KERNEL);
+ digest = kzalloc(ALIGN(digest_size, __alignof__(*desc)) + desc_size,
+ GFP_KERNEL);
if (!digest)
goto error_no_desc;
- desc = digest + digest_size;
+ desc = PTR_ALIGN(digest + digest_size, __alignof__(*desc));
desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2015-10-14 16:30 +0200 |
| Subject | Re: [PATCH] crypto/pkcs7_verify: Fix unaligned access in pkcs7_verify() |
| Message-ID | <qjve3-17o-29@gated-at.bofh.it> |
| In reply to | #1245810 |
On Tue, Oct 13, 2015 at 10:54:01AM -0400, Sowmini Varadhan wrote: > > On sparc, we see unaligned access messages on each modprobe[-r]: > > Kernel unaligned access at TPC[6ad9b4] pkcs7_verify [..] > Kernel unaligned access at TPC[6a5484] crypto_shash_finup [..] > Kernel unaligned access at TPC[6a5390] crypto_shash_update [..] > Kernel unaligned access at TPC[10150308] sha1_sparc64_update [..] > Kernel unaligned access at TPC[101501ac] __sha1_sparc64_update [..] > > These ware triggered by mod_verify_sig() invocations of pkcs_verify(), and > are are being caused by an unaligned desc at (sha1, digest_size is 0x14) > desc = digest + digest_size; > > To fix this, pkcs7_verify needs to make sure that desc is pointing > at an aligned value past the digest_size, and kzalloc appropriately, > taking alignment values into consideration. > > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Patch applied. Thanks! -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2015-10-15 17:20 +0200 |
| Message-ID | <qjStY-1O0-29@gated-at.bofh.it> |
| In reply to | #1245810 |
Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On sparc, we see unaligned access messages on each modprobe[-r]: > > Kernel unaligned access at TPC[6ad9b4] pkcs7_verify [..] > Kernel unaligned access at TPC[6a5484] crypto_shash_finup [..] > Kernel unaligned access at TPC[6a5390] crypto_shash_update [..] > Kernel unaligned access at TPC[10150308] sha1_sparc64_update [..] > Kernel unaligned access at TPC[101501ac] __sha1_sparc64_update [..] > > These ware triggered by mod_verify_sig() invocations of pkcs_verify(), and > are are being caused by an unaligned desc at (sha1, digest_size is 0x14) > desc = digest + digest_size; > > To fix this, pkcs7_verify needs to make sure that desc is pointing > at an aligned value past the digest_size, and kzalloc appropriately, > taking alignment values into consideration. > > Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Acked-by: David Howells <dhowells@redhat.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web