Padlock SHA1 failed at boot time
Hi,
With 2.6.31, at boot time,i got this error.
The previous version i use was 2.6.31-rc6 and work fine for me.
cpuidle: using governor menu
padlock: Using VIA PadLock ACE for AES algorithm.
general protection fault: 0000 [#1] PREEMPT
last sysfs file:
Pid: 83, comm: cryptomgr_test Not tainted (2.6.31EPIA_NAB7500 #311) CN896-8251
EIP: 0060:[<c1247ef5>] EFLAGS: 00010202 CPU: 0
EIP is at padlock_sha1_finup+0x1a2/0x1f3
EAX: 00000000 EBX: 00000003 ECX: 00000003 EDX: 00000001
ESI: f734f000 EDI: f7367c88 EBP: f7367d18 ESP: f7367c18
DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068
Process cryptomgr_test (pid: 83, ti=f7366000 task=f71c9460 task.ti=f7366000)
Stack: f7367ed0 f734f000 f734eee8 f734eef0 00000000 00000000 00000000 67452301 <0> efcdab89 98badcfe 10325476 c3d2e1f0 00000000 00000000 00000000 00000000 <0> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Call Trace: [<c101dc1d>] ? kmap_atomic_prot+0xb5/0xc3 [<c101dc48>] ? kmap_atomic+0x1d/0x30 [<c1103f76>] ? hash_walk_next+0x43/0x7d [<c1104ccd>] ? crypto_shash_finup+0x3d/0x57 [<c1104ed8>] ? shash_ahash_finup+0x4d/0x81 [<c1104fff>] ? shash_ahash_digest+0xb7/0xd4 [<c1105045>] ? shash_async_digest+0x29/0x3c [<c1103bc6>] ? crypto_ahash_op+0x9a/0xb6 [<c110501c>] ? shash_async_digest+0x0/0x3c [<c1103bff>] ? crypto_ahash_digest+0x1d/0x30 [<c110626a>] ? test_hash+0x196/0x53a [<c10fe1fd>] ? crypto_alloc_tfm+0x51/0x96 [<c1104980>] ? crypto_alloc_shash+0x20/0x36 [<c1247fd4>] ? padlock_cra_init+0x2a/0x6a [<c10fe16b>] ? crypto_create_tfm+0x67/0xa8 [<c1104488>] ? crypto_init_shash_ops_async+0x39/0xca [<c110665c>] ? alg_test_hash+0x4e/0x75 [<c1107f91>] ? alg_test+0x11a/0x171 [<c1022291>] ? finish_task_switch+0x48/0x97 [<c13a80c1>] ? schedule+0x364/0x385 [<c1105614>] ? cryptomgr_test+0x0/0x48 [<c1105642>] ? cryptomgr_test+0x2e/0x48 [<c1039bbe>] ? kthread+0x6b/0x70 [<c1039b53>] ? kthread+0x0/0x70 [<c100353b>] ? kernel_thread_helper+0x7/0x10 Code: 39 c2 74 10 0f 20 c0 a8 08 74 09 0f 06 ba 01 00 00 00 eb 02 31 d2 8b 85 14 ff ff ff 8d bd 70 ff ff ff 8b b5 04 ff ff ff 8d 0c 03 <f3> 0f a6 c8 85 d2 74 09 0f 20 c0 83 c8 08 0f 22 c0 8b 8d 00 ff EIP: [<c1247ef5>] padlock_sha1_finup+0x1a2/0x1f3 SS:ESP 0068:f7367c18 ---[ end trace 853c7a9cbb58c0f4 ]---
note: cryptomgr_test[83] exited with preempt_count 1
/proc/cpuinfo :
processor : 0vendor_id : CentaurHauls
cpu family : 6
model : 10
model name : VIA Esther processor 1500MHz
stepping : 9
cpu MHz : 798.040
cache size : 128 KBfdiv_bug : nohlt_bug : nof00f_bug : nocoma_bug : no
fpu : yesfpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov pat clflush acpi mmx fxsr sse sse2 tm nx pni est tm2 rng rng_en ace ace_en ace2 ace2_en phe phe_en pmm pmm_en
bogomips : 1596.08
clflush size : 64cache_alignment : 64
address sizes : 36 bits physical, 32 bits virtual
power management:
Signature · 5 lines
Régis Séguier -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Herbert Xu
maintainerQuoted 8 lines · Séguier Régis
Hi,
With 2.6.31, at boot time,i got this error.
The previous version i use was 2.6.31-rc6 and work fine for me.cpuidle: using governor menu
padlock: Using VIA PadLock ACE for AES algorithm.general protection fault: 0000 [#1] PREEMPT
Quoted 8 lines
last sysfs file:
Pid: 83, comm:
cryptomgr_testNot tainted (2.6.31EPIA_NAB7500 #311) CN896-8251
EIP: 0060:[<c1247ef5>] EFLAGS: 00010202 CPU: 0
EIP is atpadlock_sha1_finup+0x1a2/0x1f3
EAX: 00000000 EBX: 00000003 ECX: 00000003 EDX: 00000001
ESI:f734f000EDI:f7367c88EBP:f7367d18ESP:f7367c18
This looks like an alignment fault.
Can you please try this patch? Thanks!
drivers/crypto/padlock-sha.c +10 -2
@@ -24,6 +24,12 @@#include <asm/i387.h> #include "padlock.h" +#ifdef CONFIG_64BIT +#define STACK_ALIGN 16 +#else +#define STACK_ALIGN 4 +#endif +struct padlock_sha_desc {struct shash_desc fallback; };
@@ -64,7 +70,8 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ - char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); +char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; +char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha1_state state;unsigned int space;
@@ -128,7 +135,8 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ - char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); +char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; +char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha256_state state;unsigned int space;
Signature · 8 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
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-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 53 lines · Herbert Xu
Quoted 7 lines · Séguier Régis
Hi,
With 2.6.31, at boot time,i got this error.
The previous version i use was 2.6.31-rc6 and work fine for me.cpuidle: using governor menu
padlock: Using VIA PadLock ACE for AES algorithm.Quoted 9 lines
general protection fault: 0000 [#1] PREEMPTlast sysfs file:
Pid: 83, comm:
cryptomgr_testNot tainted (2.6.31EPIA_NAB7500 #311) CN896-8251
EIP: 0060:[<c1247ef5>] EFLAGS: 00010202 CPU: 0
EIP is atpadlock_sha1_finup+0x1a2/0x1f3
EAX: 00000000 EBX: 00000003 ECX: 00000003 EDX: 00000001
ESI:f734f000EDI:f7367c88EBP:f7367d18ESP:f7367c18This looks like an alignment fault.
Can you please try this patch? Thanks!
drivers/crypto/padlock-sha.c +8
-1@@ -24,6 +24,12 @@#include <asm/i387.h> #include "padlock.h" +#ifdef CONFIG_64BIT +#define STACK_ALIGN 16 +#else +#define STACK_ALIGN 4 +#endif +struct padlock_sha_desc {struct shash_desc fallback; };@@ -64,7 +70,8 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ - char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); +char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; +char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha1_state state;unsigned int space;
drivers/crypto/padlock-sha.c static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in, · line 142
Quoted 9 lines
drivers/crypto/padlock-sha.c +2
-1@@ -128,7 +135,8 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ - char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); +char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; +char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha256_state state;unsigned int space;
it's good for me now.
Thanks.
Signature · 5 lines
Régis Séguier -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Séguier Régis
it's good for me now.
Thanks for confirming! I'll push it with this changelog
crypto: padlock-sha - Fix stack alignment
The PadLock hardware requires the output buffer for SHA to be 128-bit aligned. We currentply place the buffer on the stack, and ask gcc to align it to 128 bits. That doesn't work on i386 because the kernel stack is only aligned to 32 bits. This patch changes the code to align the buffer by hand so that the hardware doesn't fault on unaligned buffers.
Signature · 8 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
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-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlHerbert Xu
maintainerQuoted 10 lines · Herbert Xu
crypto: padlock-sha - Fix stack alignment
The PadLock hardware requires the output buffer for SHA to be 128-bit aligned. We currentply place the buffer on the stack, and ask gcc to align it to 128 bits. That doesn't work on i386 because the kernel stack is only aligned to 32 bits. This patch changes the code to align the buffer by hand so that the hardware doesn't fault on unaligned buffers.
Quoted 3 lines
Reported-by Séguier Régis <[email protected]>Tested-by Séguier Régis <[email protected]>Signed-off-by Herbert Xu <[email protected]>
For the record I modified the patch slightly to ensure that we get the minimum alignment from gcc.
drivers/crypto/padlock-sha.c +4 -2
@@ -70,7 +70,8 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ -char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; + char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ + ((aligned(STACK_ALIGN)));char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha1_state state;
@@ -135,7 +136,8 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,/* We can't store directly to *out as it may be unaligned. */ /* BTW Don't reduce the buffer size below 128 Bytes! * PadLock microcode needs it that big. */ -char buf[128 +PADLOCK_ALIGNMENT -STACK_ALIGN ]; + char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ + ((aligned(STACK_ALIGN)));char *result =PTR_ALIGN (&buf[0 ],PADLOCK_ALIGNMENT );struct padlock_sha_desc *dctx =shash_desc_ctx (desc);struct sha256_state state;
Signature · 8 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
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-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 11 lines · Herbert Xu
Quoted 9 lines · Herbert Xu
crypto: padlock-sha - Fix stack alignment
The PadLock hardware requires the output buffer for SHA to be 128-bit aligned. We currentply place the buffer on the stack, and ask gcc to align it to 128 bits. That doesn't work on i386 because the kernel stack is only aligned to 32 bits. This patch changes the code to align the buffer by hand so that the hardware doesn't fault on unaligned buffers.
Quoted 7 lines
Quoted 4 lines
Reported-by Séguier Régis <[email protected]>Tested-by Séguier Régis <[email protected]>Signed-off-by Herbert Xu <[email protected]>For the record I modified the patch slightly to ensure that we get the minimum alignment from gcc
Ok, tested, good for me.
Just, not important, my mail is not [email protected] but [email protected] for the changelog.
Signature · 5 lines
Régis Séguier -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Herbert Xu
maintainerQuoted 2 lines · Séguier Régis
Ok, tested, good for me.
Thanks!
Quoted 2 lines
Just, not important, my mail is not [email protected] but [email protected] for the changelog.
Sorry! But look on the bright side, at least you won't get spammed because of this :)
Signature · 8 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
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-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html