Hello!
I have git kernel OOPS (4.6.0-rc6) on sparc64. This OOPS does not
happen, if I set the following kernel option:
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
Can someone please look at https://bugzilla.kernel.org/show_bug.cgi?id=117551 ?
Thanks.
There's attached kernel config on bugzilla.
kernel OOPS:
SPARC Enterprise T5120, No Keyboard
Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.33.6.f, 16256 MB memory available, Serial #78400024.
Ethernet address 0:14:4f:ac:4a:18, Host ID: 84ac4a18.
Boot device: disk1 File and args:
SILO Version 1.4.14
boot:
Linux LinuxOLD 6
boot: 6
Allocated 64 Megs of memory at 0x40000000 for kernel
Uncompressing image...
Loaded kernel version 4.6.0
Loading initial ramdisk (14627617 bytes at 0xC800000 phys, 0x40C00000 virt)...
/
[ 0.000000] PROMLIB: Sun IEEE Boot Prom 'OBP 4.33.6.f 2014/07/10 10:23'
[ 0.000000] PROMLIB: Root node compatible: sun4v
[ 0.000000] Linux version 4.6.0-rc6+ (mator@deb4g) (gcc version
6.0.1 20160423 (prerelease) (Debian 6.0.1-2) ) #1 SMP Tue May 3
13:49:36 MSK 2016
[ 0.000000] debug: skip boot console de-registration.
[ 0.000000] bootconsole [earlyprom0] enabled
[ 0.000000] ARCH: SUN4V
[ 0.000000] Ethernet address: 00:14:4f:ac:4a:18
[ 0.000000] MM: PAGE_OFFSET is 0xffff800000000000 (max_phys_bits == 39)
[ 0.000000] MM: VMALLOC [0x0000000100000000 --> 0x0000600000000000]
[ 0.000000] MM: VMEMMAP [0x0000600000000000 --> 0x0000c00000000000]
[ 0.000000] Kernel: Using 3 locked TLB entries for main kernel image.
[ 0.000000] Remapping the kernel... done.
[ 0.000000] OF stdout device is: /virtual-devices@100/console@1
[ 0.000000] PROM: Built device tree with 195069 bytes of memory.
[ 0.000000] MDESC: Size is 61728 bytes.
[ 0.000000] PLATFORM: banner-name [SPARC Enterprise T5120]
[ 0.000000] PLATFORM: name [SUNW,SPARC-Enterprise-T5120]
[ 0.000000] PLATFORM: hostid [84ac4a18]
[ 0.000000] PLATFORM: serial# [00ab4130]
[ 0.000000] PLATFORM: stick-frequency [457646c0]
[ 0.000000] PLATFORM: mac-address [144fac4a18]
[ 0.000000] PLATFORM: watchdog-resolution [1000 ms]
[ 0.000000] PLATFORM: watchdog-max-timeout [31536000000 ms]
[ 0.000000] PLATFORM: max-cpus [64]
[ 0.000000] Top of RAM: 0x3ffb16000, Total RAM: 0x3f76ac000
[ 0.000000] Memory hole size: 132MB
[ 0.000000] Allocated 16384 bytes for kernel page tables.
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000008400000-0x00000003ffb15fff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000008400000-0x00000003ffa89fff]
[ 0.000000] node 0: [mem 0x00000003ffa9a000-0x00000003ffaadfff]
[ 0.000000] node 0: [mem 0x00000003ffb08000-0x00000003ffb15fff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000008400000-0x00000003ffb15fff]
[ 0.000000] Booting Linux...
[ 0.000000] CPU CAPS: [flush,stbar,swap,muldiv,v9,blkinit,n2,mul32]
[ 0.000000] CPU CAPS: [div32,v8plus,popc,vis,vis2,ASIBlkInit]
[ 0.000000] percpu: Embedded 9 pages/cpu @ffff8003ff000000 s29528
r8192 d36008 u131072
[ 0.000000] SUN4V: Mondo queue sizes [cpu(8192) dev(16384) r(8192) nr(256)]
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 2061296
[ 0.000000] Kernel command line: root=/dev/mapper/vg1-root ro
keep_bootcon console=ttyS0
[ 0.000000] log_buf_len individual max cpu contribution: 4096 bytes
[ 0.000000] log_buf_len total cpu_extra contributions: 258048 bytes
[ 0.000000] log_buf_len min size: 131072 bytes
[ 0.000000] log_buf_len: 524288 bytes
[ 0.000000] early log buf free: 127592(97%)
[ 0.000000] PID hash table entries: 4096 (order: 2, 32768 bytes)
[ 0.000000] Dentry cache hash table entries: 2097152 (order: 11,
16777216 bytes)
[ 0.000000] Inode-cache hash table entries: 1048576 (order: 10,
8388608 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 16433448K/16636592K available (5565K kernel
code, 733K rwdata, 1392K rodata, 456K init, 742K bss, 203144K
reserved, 0K cma-reserved)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 64.
[ 0.000000] RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=64.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=64
[ 0.000000] NR_IRQS:2048 nr_irqs:2048 1
[ 0.000000] SUN4V: Using IRQ API major 1, cookie only virqs disabled
[ 7218.283063] clocksource: stick: mask: 0xffffffffffffffff
max_cycles: 0x10cc5ac4c8a, max_idle_ns: 440795218862 ns
[ 7218.283875] clocksource: mult[dbabc5] shift[24]
[ 7218.284206] clockevent: mult[952b25d1] shift[31]
[ 7218.286792] Console: colour dummy device 80x25
[ 7218.364903] Calibrating delay using timer specific routine..
2337.22 BogoMIPS (lpj=4674457)
[ 7218.365869] pid_max: default: 65536 minimum: 512
[ 7218.367733] Security Framework initialized
[ 7218.368387] Yama: becoming mindful.
[ 7218.369633] AppArmor: AppArmor disabled by boot time parameter
[ 7218.370843] Mount-cache hash table entries: 32768 (order: 5, 262144 bytes)
[ 7218.372659] Mountpoint-cache hash table entries: 32768 (order: 5,
262144 bytes)
[ 7218.377060] ftrace: allocating 18467 entries in 37 pages
[ 7218.491669] Brought up 64 CPUs
[ 7218.501017] devtmpfs: initialized
[ 7218.512380] Performance events:
[ 7218.513039] Testing NMI watchdog ... OK.
[ 7218.594081] Supported PMU type is 'niagara2'
[ 7218.632340] ldc.c:v1.1 (July 22, 2008)
[ 7218.633966] clocksource: jiffies: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 7645041785100000 ns
[ 7218.637279] NET: Registered protocol family 16
[ 7218.662264] VIO: Adding device channel-devices
[ 7218.663207] VIO: Adding device vlds-port-0-0
[ 7218.663753] VIO: Adding device vldc-port-3-0
[ 7218.664311] VIO: Adding device vldc-port-3-1
[ 7218.664857] VIO: Adding device vldc-port-3-2
[ 7218.665415] VIO: Adding device vldc-port-3-3
[ 7218.665982] VIO: Adding device vldc-port-3-4
[ 7218.666530] VIO: Adding device vldc-port-3-5
[ 7218.667347] VIO: Adding device vldc-port-2-0
[ 7218.667917] VIO: Adding device vldc-port-0-0
[ 7218.668745] VIO: Adding device vldc-port-0-1
[ 7218.669829] VIO: Adding device vldc-port-0-2
[ 7218.671328] VIO: Adding device vldc-port-1-0
[ 7218.672168] VIO: Adding device vldc-port-3-7
[ 7218.673495] VIO: Adding device vldc-port-3-8
[ 7218.674065] VIO: Adding device ds-1
[ 7218.674596] VIO: Adding device ds-0
[ 7218.692674] pci_sun4v: Registered hvapi major[1] minor[0]
[ 7218.693713] /pci@0: SUN4V PCI Bus Module
[ 7218.694017] /pci@0: On NUMA node -1
[ 7218.694302] /pci@0: PCI IO[c0f0000000] MEM[c100000000] MEM64[c200000000]
[ 7218.694846] /pci@0: Unable to request IOMMU resource.
[ 7218.744155] /pci@0: Imported 3 TSB entries from OBP
[ 7218.748187] /pci@0: MSI Queue first[0] num[36] count[128] devino[0x18]
[ 7218.748680] /pci@0: MSI first[0] num[256] mask[0xff] width[32]
[ 7218.749144] /pci@0: MSI addr32[0x7fff0000:0x10000]
addr64[0x3ffff0000:0x10000]
[ 7218.749696] /pci@0: MSI queues at RA [00000003f1e00000]
[ 7218.750157] PCI: Scanning PBM /pci@0
[ 7218.750786] pci_sun4v f028ca10: PCI host bridge to bus 0000:02
[ 7218.751347] pci_bus 0000:02: root bus resource [io
0xc0f0000000-0xc0ffffffff] (bus address [0x0000-0xfffffff])
[ 7218.752160] pci_bus 0000:02: root bus resource [mem
0xc100000000-0xc17ffeffff] (bus address [0x00000000-0x7ffeffff])
[ 7218.753086] pci_bus 0000:02: root bus resource [mem
0xc200000000-0xc3fffeffff] (bus address [0x100000000-0x2fffeffff])
[ 7218.753888] pci_bus 0000:02: root bus resource [bus 02-12]
[ 7218.793314] HugeTLB registered 8 MB page size, pre-allocated 0 pages
[ 7218.798204] vgaarb: loaded
[ 7218.801710] SUN4V: Reboot data supported (maj=1,min=0).
[ 7218.802613] ds.c:v1.0 (Jul 11, 2007)
[ 7218.804525] clocksource: Switched to clocksource stick
[ 7218.826813] ds-1: Registered pri service.
[ 7218.831038] ds-1: Registered var-config-backup service.
[ 7218.861476] VFS: Disk quotas dquot_6.6.0
[ 7218.862524] VFS: Dquot-cache hash table entries: 1024 (order 0, 8192 bytes)
[ 7218.880853] NET: Registered protocol family 2
[ 7218.883989] TCP established hash table entries: 131072 (order: 7,
1048576 bytes)
[ 7218.888309] TCP bind hash table entries: 65536 (order: 7, 1048576 bytes)
[ 7218.893181] TCP: Hash tables configured (established 131072 bind 65536)
[ 7218.894190] UDP hash table entries: 8192 (order: 5, 262144 bytes)
[ 7218.895694] UDP-Lite hash table entries: 8192 (order: 5, 262144 bytes)
[ 7218.898883] NET: Registered protocol family 1
[ 7219.009101] Unpacking initramfs...
[ 7220.326000] Freeing initrd memory: 14280K (ffff80000c800000 -
ffff80000d5f2000)
[ 7220.339774] futex hash table entries: 16384 (order: 7, 1048576 bytes)
[ 7220.340944] audit: initializing netlink subsys (disabled)
[ 7220.341448] audit: type=2000 audit(1.971:1): initialized
[ 7220.342562] Initialise system trusted keyring
[ 7220.344050] workingset: timestamp_bits=45 max_order=21 bucket_order=0
[ 7220.344704] zbud: loaded
[ 7220.346807] Unable to handle kernel paging request at virtual
address 0000612000016000
[ 7220.347392] tsk->{mm,active_mm}->context = 0000000000000000
[ 7220.347800] tsk->{mm,active_mm}->pgd = ffff800008802000
[ 7220.348185] \|/ ____ \|/
[ 7220.348185] "@'/ .. \`@"
[ 7220.348185] /_| \__/ |_\
[ 7220.348185] \__U_/
[ 7220.349273] cryptomgr_test(412): Oops [#1]
[ 7220.349595] CPU: 45 PID: 412 Comm: cryptomgr_test Not tainted 4.6.0-rc6+ #1
[ 7220.350102] task: ffff8003ee232b80 ti: ffff8003ee254000 task.ti:
ffff8003ee254000
[ 7220.350651] TSTATE: 0000000080001600 TPC: 000000000073d530 TNPC:
000000000073d534 Y: 00000000 Not tainted
[ 7220.351363] TPC: <mpi_read_raw_from_sgl+0x30/0x2c0>
[ 7220.351729] g0: 0000000000000000 g1: 0000612000017658 g2:
0000000000000002 g3: 0000000000000068
[ 7220.352355] g4: ffff8003ee232b80 g5: ffff8003fe9a4000 g6:
ffff8003ee254000 g7: 0000000000000008
[ 7220.352995] o0: 0000000000000002 o1: 00000000024000c0 o2:
0000000000000020 o3: ffff8000084020c0
[ 7220.353624] o4: ffff8003ee2128e0 o5: 0000000000000480 sp:
ffff8003ee257091 ret_pc: 000000000073d508
[ 7220.354280] RPC: <mpi_read_raw_from_sgl+0x8/0x2c0>
[ 7220.354641] l0: 0000000000000002 l1: 00000000024000c0 l2:
ffff800008404208 l3: 0000000040000000
[ 7220.355268] l4: ffff800008404218 l5: 0000600008de6d90 l6:
ffffffffffffffff l7: ffff8003ff5ab688
[ 7220.355894] i0: ffff8003ee257b10 i1: 0000000000000008 i2:
ffff8003ee257b10 i3: ffff8003ee257ad0
[ 7220.356508] i4: 0000000000000000 i5: 0000000000000000 i6:
ffff8003ee257141 i7: 00000000006bb7a0
[ 7220.357165] I7: <rsa_enc+0x40/0xc0>
[ 7220.357438] Call Trace:
[ 7220.357639] [00000000006bb7a0] rsa_enc+0x40/0xc0
[ 7220.357998] [00000000006c08c0] do_test_rsa+0x1e0/0x440
[ 7220.358388] [00000000006c0ba0] alg_test_akcipher+0x80/0x100
[ 7220.358819] [00000000006c01a8] alg_test+0x188/0x3c0
[ 7220.359191] [00000000006bd3e8] cryptomgr_test+0x48/0x60
[ 7220.359593] [000000000048716c] kthread+0xac/0xe0
[ 7220.359957] [00000000004060a4] ret_from_fork+0x1c/0x2c
[ 7220.360343] [0000000000000000] (null)
[ 7220.360687] Disabling lock debugging due to kernel taint
[ 7220.361113] Caller[00000000006bb7a0]: rsa_enc+0x40/0xc0
[ 7220.361512] Caller[00000000006c08c0]: do_test_rsa+0x1e0/0x440
[ 7220.361937] Caller[00000000006c0ba0]: alg_test_akcipher+0x80/0x100
[ 7220.362389] Caller[00000000006c01a8]: alg_test+0x188/0x3c0
[ 7220.362796] Caller[00000000006bd3e8]: cryptomgr_test+0x48/0x60
[ 7220.363240] Caller[000000000048716c]: kthread+0xac/0xe0
[ 7220.363634] Caller[00000000004060a4]: ret_from_fork+0x1c/0x2c
[ 7220.364054] Caller[0000000000000000]: (null)
[ 7220.364431] Instruction DUMP: c606a008 82087ffc ce06a00c
<c2586040> 80a1e000 02400010 84004003 c2084003 80a06000
From: Anatoly Pugachev <[email protected]>
Date: Tue, 3 May 2016 16:54:18 +0300
> I have git kernel OOPS (4.6.0-rc6) on sparc64. This OOPS does not
> happen, if I set the following kernel option:
>
> CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
>
> Can someone please look at https://bugzilla.kernel.org/show_bug.cgi?id=117551 ?
The lib/mpi/ code hasn't been touched in a long time, so I can only see that it might
be the crypto/rsa.c changes that happened this release.
Can you possibly bisect this or at least tell us that 4.5 doesn't have this problem?
David Miller <[email protected]> wrote:
> From: Anatoly Pugachev <[email protected]>
> Date: Tue, 3 May 2016 16:54:18 +0300
>
>> I have git kernel OOPS (4.6.0-rc6) on sparc64. This OOPS does not
>> happen, if I set the following kernel option:
>>
>> CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
>>
>> Can someone please look at https://bugzilla.kernel.org/show_bug.cgi?id=117551 ?
>
> The lib/mpi/ code hasn't been touched in a long time, so I can only see that it might
> be the crypto/rsa.c changes that happened this release.
>
> Can you possibly bisect this or at least tell us that 4.5 doesn't have this problem?
It would also be helpful to test the latest cryptodev tree which
has a large number of MPI fixes from Nicolai Stange.
Thanks,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
On Wed, May 4, 2016 at 7:07 AM, Herbert Xu <[email protected]> wrote:
> David Miller <[email protected]> wrote:
>> From: Anatoly Pugachev <[email protected]>
>> Date: Tue, 3 May 2016 16:54:18 +0300
>>
>>> I have git kernel OOPS (4.6.0-rc6) on sparc64. This OOPS does not
>>> happen, if I set the following kernel option:
>>>
>>> CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
>>>
>>> Can someone please look at https://bugzilla.kernel.org/show_bug.cgi?id=117551 ?
>>
>> The lib/mpi/ code hasn't been touched in a long time, so I can only see that it might
>> be the crypto/rsa.c changes that happened this release.
>>
>> Can you possibly bisect this or at least tell us that 4.5 doesn't have this problem?
>
> It would also be helpful to test the latest cryptodev tree which
> has a large number of MPI fixes from Nicolai Stange.
Herbert,
just tested cryptodev (
http://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
) kernel, same OOPS, but kernel version is 4.6.0-rc2+ .
kernel OOPS message - https://paste.fedoraproject.org/362554/23732641/
On Tue, May 3, 2016 at 7:33 PM, David Miller <[email protected]> wrote:
> From: Anatoly Pugachev <[email protected]>
> Date: Tue, 3 May 2016 16:54:18 +0300
>
>> I have git kernel OOPS (4.6.0-rc6) on sparc64. This OOPS does not
>> happen, if I set the following kernel option:
>>
>> CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
>>
>> Can someone please look at https://bugzilla.kernel.org/show_bug.cgi?id=117551 ?
>
> The lib/mpi/ code hasn't been touched in a long time, so I can only see that it might
> be the crypto/rsa.c changes that happened this release.
>
> Can you possibly bisect this or at least tell us that 4.5 doesn't have this problem?
David,
we're using 4.5.2 debian kernel here without this problem. I'm not
sure I would be able to bisect, never did it before, but I could
try...
Here's a quick diff related to crypto for debian kernel configs:
$ diff -u /boot/config-4.5.0-2-sparc64-smp /boot/config-4.6.0-rc5-sparc64-smp
@@ -5299,10 +5380,9 @@
CONFIG_CRYPTO_RNG=m
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_RNG_DEFAULT=m
-CONFIG_CRYPTO_PCOMP=m
-CONFIG_CRYPTO_PCOMP2=y
CONFIG_CRYPTO_AKCIPHER2=y
-# CONFIG_CRYPTO_RSA is not set
+CONFIG_CRYPTO_AKCIPHER=y
+CONFIG_CRYPTO_RSA=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_USER is not set
so, I need to compile 4.5.x kernel (or even older kernels) with
CRYPTO_RSA=y and test how it would act. And if it would not crash, I
could try to bisect.
Thanks.
Hi Anatoly,
On 05/04/2016 12:10 PM, Anatoly Pugachev wrote:
> we're using 4.5.2 debian kernel here without this problem. I'm not
> sure I would be able to bisect, never did it before, but I could
> try...
On 4.5.2 could you try "modprobe rsa"
--
TS
From: Anatoly Pugachev <[email protected]>
Date: Wed, 4 May 2016 22:10:47 +0300
> Here's a quick diff related to crypto for debian kernel configs:
>
> $ diff -u /boot/config-4.5.0-2-sparc64-smp /boot/config-4.6.0-rc5-sparc64-smp
> @@ -5299,10 +5380,9 @@
> CONFIG_CRYPTO_RNG=m
> CONFIG_CRYPTO_RNG2=y
> CONFIG_CRYPTO_RNG_DEFAULT=m
> -CONFIG_CRYPTO_PCOMP=m
> -CONFIG_CRYPTO_PCOMP2=y
> CONFIG_CRYPTO_AKCIPHER2=y
> -# CONFIG_CRYPTO_RSA is not set
> +CONFIG_CRYPTO_AKCIPHER=y
> +CONFIG_CRYPTO_RSA=y
> CONFIG_CRYPTO_MANAGER=y
> CONFIG_CRYPTO_MANAGER2=y
> # CONFIG_CRYPTO_USER is not set
>
> so, I need to compile 4.5.x kernel (or even older kernels) with
> CRYPTO_RSA=y and test how it would act.
Well yes, that would be an absolutely critical datapoint.
On Wed, May 04, 2016 at 05:49:04PM +0300, Anatoly Pugachev wrote:
>
> just tested cryptodev (
> http://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> ) kernel, same OOPS, but kernel version is 4.6.0-rc2+ .
> kernel OOPS message - https://paste.fedoraproject.org/362554/23732641/
Anatoly, could you please test this patch on top of cryptodev?
Thanks!
---8<---
Subject: crypto: testmgr - Use kmalloc memory for RSA input
As akcipher uses an SG interface, you must not use vmalloc memory
as input for it. This patch fixes testmgr to copy the vmalloc
test vectors to kmalloc memory before running the test.
This patch also removes a superfluous sg_virt call in do_test_rsa.
Cc: <[email protected]>
Reported-by: Anatoly Pugachev <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index fcd89fe..c727fb0 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1780,6 +1780,7 @@ static int alg_test_drbg(const struct alg_test_desc *desc, const char *driver,
static int do_test_rsa(struct crypto_akcipher *tfm,
struct akcipher_testvec *vecs)
{
+ char *xbuf[XBUFSIZE];
struct akcipher_request *req;
void *outbuf_enc = NULL;
void *outbuf_dec = NULL;
@@ -1788,9 +1789,12 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
int err = -ENOMEM;
struct scatterlist src, dst, src_tab[2];
+ if (testmgr_alloc_buf(xbuf))
+ return err;
+
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (!req)
- return err;
+ goto free_xbuf;
init_completion(&result.completion);
@@ -1808,9 +1812,14 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
if (!outbuf_enc)
goto free_req;
+ if (WARN_ON(vecs->m_size > PAGE_SIZE))
+ goto free_all;
+
+ memcpy(xbuf[0], vecs->m, vecs->m_size);
+
sg_init_table(src_tab, 2);
- sg_set_buf(&src_tab[0], vecs->m, 8);
- sg_set_buf(&src_tab[1], vecs->m + 8, vecs->m_size - 8);
+ sg_set_buf(&src_tab[0], xbuf[0], 8);
+ sg_set_buf(&src_tab[1], xbuf[0] + 8, vecs->m_size - 8);
sg_init_one(&dst, outbuf_enc, out_len_max);
akcipher_request_set_crypt(req, src_tab, &dst, vecs->m_size,
out_len_max);
@@ -1829,7 +1838,7 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
goto free_all;
}
/* verify that encrypted message is equal to expected */
- if (memcmp(vecs->c, sg_virt(req->dst), vecs->c_size)) {
+ if (memcmp(vecs->c, outbuf_enc, vecs->c_size)) {
pr_err("alg: rsa: encrypt test failed. Invalid output\n");
err = -EINVAL;
goto free_all;
@@ -1844,7 +1853,13 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
err = -ENOMEM;
goto free_all;
}
- sg_init_one(&src, vecs->c, vecs->c_size);
+
+ if (WARN_ON(vecs->c_size > PAGE_SIZE))
+ goto free_all;
+
+ memcpy(xbuf[0], vecs->c, vecs->c_size);
+
+ sg_init_one(&src, xbuf[0], vecs->c_size);
sg_init_one(&dst, outbuf_dec, out_len_max);
init_completion(&result.completion);
akcipher_request_set_crypt(req, &src, &dst, vecs->c_size, out_len_max);
@@ -1871,6 +1886,8 @@ free_all:
kfree(outbuf_enc);
free_req:
akcipher_request_free(req);
+free_xbuf:
+ testmgr_free_buf(xbuf);
return err;
}
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
On Thu, May 5, 2016 at 11:42 AM, Herbert Xu <[email protected]> wrote:
> On Wed, May 04, 2016 at 05:49:04PM +0300, Anatoly Pugachev wrote:
>>
>> just tested cryptodev (
>> http://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
>> ) kernel, same OOPS, but kernel version is 4.6.0-rc2+ .
>> kernel OOPS message - https://paste.fedoraproject.org/362554/23732641/
>
> Anatoly, could you please test this patch on top of cryptodev?
Herbert,
sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
kernel in attempt to find (bisect) when RSA code break, already tested
4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
Going to try your patch soon (when I'm back home).
So far 4.3 passes RSA stage without OOPS, but for other reason does
not boot to login prompt. Boot log exempt (4.3), this is with
CONFIG_CRYPTO_RSA=y :
[ 0.000000] PROMLIB: Sun IEEE Boot Prom 'OBP 4.38.3 2015/11/11 10:38'
[ 0.000000] PROMLIB: Root node compatible: sun4v
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.3.0+ (mator@ttip) (gcc version 6.0.1
20160423 (prerelease) (Debian 6.0.1-2) ) #4 SMP Thu May 5 05:26:2
8 EDT 2016
[ 0.000000] debug: skip boot console de-registration.
[ 0.000000] bootconsole [earlyprom0] enabled
[ 0.000000] ARCH: SUN4V
[ 0.000000] Ethernet address: 00:14:4f:f8:be:54
[ 0.000000] MM: PAGE_OFFSET is 0xfff8000000000000 (max_phys_bits == 47)
[ 0.000000] MM: VMALLOC [0x0000000100000000 --> 0x0006000000000000]
[ 0.000000] MM: VMEMMAP [0x0006000000000000 --> 0x000c000000000000]
[ 0.000000] Kernel: Using 3 locked TLB entries for main kernel image.
[ 0.000000] Remapping the kernel... done.
[ 0.000000] OF stdout device is: /virtual-devices@100/console@1
[ 0.000000] PROM: Built device tree with 76231 bytes of memory.
[ 0.000000] MDESC: Size is 35264 bytes.
[ 0.000000] PLATFORM: banner-name [SPARC T5-2]
[ 0.000000] PLATFORM: name [ORCL,SPARC-T5-2]
[ 0.000000] PLATFORM: hostid [84f8be54]
[ 0.000000] PLATFORM: serial# [0035260e]
[ 0.000000] PLATFORM: stick-frequency [3b9aca00]
[ 0.000000] PLATFORM: mac-address [144ff8be54]
[ 0.000000] PLATFORM: watchdog-resolution [1000 ms]
[ 0.000000] PLATFORM: watchdog-max-timeout [31536000000 ms]
[ 0.000000] PLATFORM: max-cpus [1024]
[ 0.000000] Top of RAM: 0x20afff0000, Total RAM: 0x2ffa06000
[ 0.000000] Memory hole size: 121605MB
[ 0.000000] Allocated 32768 bytes for kernel page tables.
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000030400000-0x00000020affeffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000030400000-0x000000006fe7ffff]
[ 0.000000] node 0: [mem 0x000000006ff00000-0x000000006ff25fff]
[ 0.000000] node 0: [mem 0x0000000070000000-0x00000002afffffff]
[ 0.000000] node 0: [mem 0x0000002030000000-0x00000020aff3ffff]
[ 0.000000] node 0: [mem 0x00000020affc0000-0x00000020affd5fff]
[ 0.000000] node 0: [mem 0x00000020affe6000-0x00000020affeffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000030400000-0x00000020affeffff]
[ 0.000000] Booting Linux...
[ 0.000000] CPU CAPS: [flush,stbar,swap,muldiv,v9,blkinit,n2,mul32]
[ 0.000000] CPU CAPS: [div32,v8plus,popc,vis,vis2,ASIBlkInit,fmaf,vis3]
[ 0.000000] CPU CAPS: [hpc,ima,pause,cbcond,aes,des,kasumi,camellia]
[ 0.000000] CPU CAPS: [md5,sha1,sha256,sha512,mpmul,montmul,montsqr,crc32c]
[ 0.000000] PERCPU: Embedded 8 pages/cpu @fff80020ae400000 s28184
r8192 d29160 u65536
[ 0.000000] SUN4V: Mondo queue sizes [cpu(131072) dev(16384) r(8192) nr(256)]
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 1558281
[ 0.000000] Kernel command line: root=/dev/vdiska2 ro keep_bootcon
noresume debug loglevel=7
[ 0.000000] log_buf_len individual max cpu contribution: 4096 bytes
[ 0.000000] log_buf_len total cpu_extra contributions: 1044480 bytes
[ 0.000000] log_buf_len min size: 131072 bytes
[ 0.000000] log_buf_len: 2097152 bytes
[ 0.000000] early log buf free: 126168(96%)
[ 0.000000] PID hash table entries: 4096 (order: 2, 32768 bytes)
[ 0.000000] Dentry cache hash table entries: 2097152 (order: 11,
16777216 bytes)
[ 0.000000] Inode-cache hash table entries: 1048576 (order: 10,
8388608 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 12364272K/12576792K available (5381K kernel
code, 702K rwdata, 1424K rodata, 440K init, 747K bss, 212520K rese
rved, 0K cma-reserved)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 64.
[ 0.000000] NR_IRQS:2048 nr_irqs:2048 1
[ 0.000000] SUN4V: Using IRQ API major 3, cookie only virqs enabled
[5664484.612319] clocksource: stick: mask: 0xffffffffffffffff
max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[5664484.612410] clocksource: mult[800000] shift[23]
[5664484.612453] clockevent: mult[80000000] shift[31]
[5664484.613868] Console: colour dummy device 80x25
[5664484.613915] console [tty0] enabled
[5664484.705131] Calibrating delay using timer specific routine..
2001.42 BogoMIPS (lpj=4002844)
[5664484.705214] pid_max: default: 262144 minimum: 2048
[5664484.705712] Security Framework initialized
[5664484.705757] Yama: becoming mindful.
[5664484.705801] AppArmor: AppArmor disabled by boot time parameter
[5664484.706096] Mount-cache hash table entries: 32768 (order: 5, 262144 bytes)
[5664484.706162] Mountpoint-cache hash table entries: 32768 (order: 5,
262144 bytes)
[5664484.707010] Initializing cgroup subsys io
[5664484.707062] Initializing cgroup subsys memory
[5664484.707169] Initializing cgroup subsys devices
[5664484.707216] Initializing cgroup subsys freezer
[5664484.707262] Initializing cgroup subsys net_cls
[5664484.707308] Initializing cgroup subsys perf_event
[5664484.707361] Initializing cgroup subsys net_prio
[5664484.707406] Initializing cgroup subsys pids
[5664484.707528] ftrace: allocating 17874 entries in 35 pages
[5664484.728490] Brought up 32 CPUs
[5664484.729958] devtmpfs: initialized
[5664484.731055] Performance events:
[5664484.731109] Testing NMI watchdog ... OK.
[5664484.811243] Supported PMU type is 'niagara5'
[5664484.857536] ldc.c:v1.1 (July 22, 2008)
[5664484.857924] clocksource: jiffies: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 7645041785100000 ns
[5664484.859295] NET: Registered protocol family 16
[5664484.861480] VIO: Adding device channel-devices
[5664484.861591] VIO: Adding device vnet-port-0-0
[5664484.861689] VIO: Adding device vnet-port-0-1
[5664484.861784] VIO: Adding device vnet-port-0-2
[5664484.861879] VIO: Adding device vnet-port-0-3
[5664484.861986] VIO: Adding device vnet-port-0-4
[5664484.862095] VIO: Adding device vnet-port-0-5
[5664484.862204] VIO: Adding device vdc-port-0-0
[5664484.862313] VIO: Adding device vdc-port-1-0
[5664484.862423] VIO: Adding device vlds-port-0-0
[5664484.862537] VIO: Adding device ds-0
[5664484.887582] vgaarb: loaded
[5664484.888156] SUN4V: Reboot data supported (maj=1,min=0).
[5664484.888252] ds.c:v1.0 (Jul 11, 2007)
[5664484.888413] ds-0: ds_conn_reset() from send_events
[5664484.888574] clocksource: Switched to clocksource stick
[5664484.907509] NET: Registered protocol family 2
[5664484.908786] TCP established hash table entries: 131072 (order: 7,
1048576 bytes)
[5664484.909367] TCP bind hash table entries: 65536 (order: 7, 1048576 bytes)
[5664484.909935] TCP: Hash tables configured (established 131072 bind 65536)
[5664484.910043] UDP hash table entries: 8192 (order: 5, 262144 bytes)
[5664484.910229] UDP-Lite hash table entries: 8192 (order: 5, 262144 bytes)
[5664484.911380] NET: Registered protocol family 1
[5664484.911536] Unpacking initramfs...
[5664485.168111] Freeing initrd memory: 12856K (fff8002034000000 -
fff8002034c8e000)
[5664485.175591] futex hash table entries: 65536 (order: 9, 4194304 bytes)
[5664485.176769] audit: initializing netlink subsys (disabled)
[5664485.176857] audit: type=2000 audit(0.472:1): initialized
[5664485.177082] Initialise system trusted keyring
[5664485.177318] HugeTLB registered 8 MB page size, pre-allocated 0 pages
[5664485.177453] zbud: loaded
[5664485.177840] VFS: Disk quotas dquot_6.6.0
[5664485.178033] VFS: Dquot-cache hash table entries: 1024 (order 0, 8192 bytes)
[5664485.218487] alg: rsa: test failed on vector 2, err=-76
[5664485.219462] Key type asymmetric registered
[5664485.219513] Asymmetric key parser 'x509' registered
[5664485.219583] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 252)
[5664485.220292] io scheduler noop registered
[5664485.220341] io scheduler deadline registered
[5664485.220467] io scheduler cfq registered (default)
[5664485.220950] f029b808: ttyS0 at I/O 0x0 (irq = 1, base_baud =
115200) is a SUN4V HCONS
[5664485.221197] console [ttyHV0] enabled
Thanks.
On Thu, May 05, 2016 at 12:40:18PM +0300, Anatoly Pugachev wrote:
>
> sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
> kernel in attempt to find (bisect) when RSA code break, already tested
> 4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
> Going to try your patch soon (when I'm back home).
> So far 4.3 passes RSA stage without OOPS, but for other reason does
> not boot to login prompt. Boot log exempt (4.3), this is with
> CONFIG_CRYPTO_RSA=y :
That jibes with this being a problem with the SG list since it
was only added in 4.4.
Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
On 05/05/2016 02:40 AM, Anatoly Pugachev wrote:
> sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
> kernel in attempt to find (bisect) when RSA code break, already tested
> 4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
> Going to try your patch soon (when I'm back home).
> So far 4.3 passes RSA stage without OOPS, but for other reason does
> not boot to login prompt. Boot log exempt (4.3), this is with
> CONFIG_CRYPTO_RSA=y :
Anatoly, could you also give this a try please:
Thanks
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index b86883a..770970ff 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1805,8 +1805,8 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
goto free_req;
sg_init_table(src_tab, 2);
- sg_set_buf(&src_tab[0], vecs->m, 8);
- sg_set_buf(&src_tab[1], vecs->m + 8, vecs->m_size - 8);
+ sg_set_buf(&src_tab[0], vecs->m, 4);
+ sg_set_buf(&src_tab[1], vecs->m + 4, vecs->m_size - 4);
sg_init_one(&dst, outbuf_enc, out_len_max);
akcipher_request_set_crypt(req, src_tab, &dst, vecs->m_size,
out_len_max);
--
TS
On Thu, May 5, 2016 at 11:42 AM, Herbert Xu <[email protected]> wrote:
> On Wed, May 04, 2016 at 05:49:04PM +0300, Anatoly Pugachev wrote:
>>
>> just tested cryptodev (
>> http://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
>> ) kernel, same OOPS, but kernel version is 4.6.0-rc2+ .
>> kernel OOPS message - https://paste.fedoraproject.org/362554/23732641/
>
> Anatoly, could you please test this patch on top of cryptodev?
> Thanks!
>
> ---8<---
> Subject: crypto: testmgr - Use kmalloc memory for RSA input
>
> As akcipher uses an SG interface, you must not use vmalloc memory
> as input for it. This patch fixes testmgr to copy the vmalloc
> test vectors to kmalloc memory before running the test.
>
> This patch also removes a superfluous sg_virt call in do_test_rsa.
Herbert,
this patch, applied to your cryptodev git kernel, fixes OOPS and my
debian sparc64 installation boots successfully:
[5684721.625447] Unpacking initramfs...
[5684721.858235] Freeing initrd memory: 11720K (fff8002034000000 -
fff8002034b72000)
[5684721.867127] futex hash table entries: 65536 (order: 9, 4194304 bytes)
[5684721.868551] audit: initializing netlink subsys (disabled)
[5684721.868640] audit: type=2000 audit(0.476:1): initialized
[5684721.868868] Initialise system trusted keyring
[5684721.869765] workingset: timestamp_bits=45 max_order=21 bucket_order=0
[5684721.869879] zbud: loaded
[5684721.920120] Key type asymmetric registered
[5684721.920173] Asymmetric key parser 'x509' registered
[5684721.920582] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 252)
[5684721.921249] io scheduler noop registered
[5684721.921297] io scheduler deadline registered
[5684721.921628] io scheduler cfq registered (default)
[5684721.922101] f029b808: ttyS0 at I/O 0x0 (irq = 1, base_baud =
115200) is a SUN4V HCONS
[5684721.922352] console [ttyHV0] enabled
[5684721.923480] sunvdc.c:v1.2 (November 24, 2014)
Thanks.
On 05/05/2016 05:12 PM, Anatoly Pugachev wrote:
> this patch, applied to your cryptodev git kernel, fixes OOPS and my
> debian sparc64 installation boots successfully:
Awesome to hear, thanks for investigating and fixing this :).
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On Thu, May 5, 2016 at 6:00 PM, Tadeusz Struk <[email protected]> wrote:
> On 05/05/2016 02:40 AM, Anatoly Pugachev wrote:
>> sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
>> kernel in attempt to find (bisect) when RSA code break, already tested
>> 4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
>> Going to try your patch soon (when I'm back home).
>> So far 4.3 passes RSA stage without OOPS, but for other reason does
>> not boot to login prompt. Boot log exempt (4.3), this is with
>> CONFIG_CRYPTO_RSA=y :
>
> Anatoly, could you also give this a try please:
> Thanks
>
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index b86883a..770970ff 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -1805,8 +1805,8 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
> goto free_req;
>
> sg_init_table(src_tab, 2);
> - sg_set_buf(&src_tab[0], vecs->m, 8);
> - sg_set_buf(&src_tab[1], vecs->m + 8, vecs->m_size - 8);
> + sg_set_buf(&src_tab[0], vecs->m, 4);
> + sg_set_buf(&src_tab[1], vecs->m + 4, vecs->m_size - 4);
> sg_init_one(&dst, outbuf_enc, out_len_max);
> akcipher_request_set_crypt(req, src_tab, &dst, vecs->m_size,
> out_len_max);
Tadeusz,
do you still want to test it , after I have reported that Herbert patch works?
Thanks.
On 05/05/2016 05:31 PM, Anatoly Pugachev wrote:
> do you still want to test it , after I have reported that Herbert patch works?
Maybe you should ack the patch with:
Tested-By: Anatoly Pugachev <[email protected]>
?
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On 05/05/2016 08:31 AM, Anatoly Pugachev wrote:
> On Thu, May 5, 2016 at 6:00 PM, Tadeusz Struk <[email protected]> wrote:
>> On 05/05/2016 02:40 AM, Anatoly Pugachev wrote:
>>> sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
>>> kernel in attempt to find (bisect) when RSA code break, already tested
>>> 4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
>>> Going to try your patch soon (when I'm back home).
>>> So far 4.3 passes RSA stage without OOPS, but for other reason does
>>> not boot to login prompt. Boot log exempt (4.3), this is with
>>> CONFIG_CRYPTO_RSA=y :
>>
>> Anatoly, could you also give this a try please:
>> Thanks
>>
>> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
>> index b86883a..770970ff 100644
>> --- a/crypto/testmgr.c
>> +++ b/crypto/testmgr.c
>> @@ -1805,8 +1805,8 @@ static int do_test_rsa(struct crypto_akcipher *tfm,
>> goto free_req;
>>
>> sg_init_table(src_tab, 2);
>> - sg_set_buf(&src_tab[0], vecs->m, 8);
>> - sg_set_buf(&src_tab[1], vecs->m + 8, vecs->m_size - 8);
>> + sg_set_buf(&src_tab[0], vecs->m, 4);
>> + sg_set_buf(&src_tab[1], vecs->m + 4, vecs->m_size - 4);
>> sg_init_one(&dst, outbuf_enc, out_len_max);
>> akcipher_request_set_crypt(req, src_tab, &dst, vecs->m_size,
>> out_len_max);
>
>
> Tadeusz,
>
> do you still want to test it , after I have reported that Herbert patch works?
>
Hi Anatoly,
Since Herbert's patch fixes it for you here is no need to test this one.
Thanks,
--
TS
On 05/05/2016 02:50 AM, Herbert Xu wrote:
> On Thu, May 05, 2016 at 12:40:18PM +0300, Anatoly Pugachev wrote:
>>
>> sure, based on your cryptodev git, just tried 4.3 (6a13feb , good)
>> kernel in attempt to find (bisect) when RSA code break, already tested
>> 4.5 (44d1b6d , bad) , 4.4 (afd2ff9 , bad).
>> Going to try your patch soon (when I'm back home).
>> So far 4.3 passes RSA stage without OOPS, but for other reason does
>> not boot to login prompt. Boot log exempt (4.3), this is with
>> CONFIG_CRYPTO_RSA=y :
>
> That jibes with this being a problem with the SG list since it
> was only added in 4.4.
Before 4.4 the rsa sw implementation kmalloced intermediate flat buffer
and copied the data internally.
Thanks,
--
TS
From: Herbert Xu <[email protected]>
Date: Thu, 5 May 2016 16:42:49 +0800
> Subject: crypto: testmgr - Use kmalloc memory for RSA input
>
> As akcipher uses an SG interface, you must not use vmalloc memory
> as input for it. This patch fixes testmgr to copy the vmalloc
> test vectors to kmalloc memory before running the test.
>
> This patch also removes a superfluous sg_virt call in do_test_rsa.
>
> Cc: <[email protected]>
> Reported-by: Anatoly Pugachev <[email protected]>
> Signed-off-by: Herbert Xu <[email protected]>
I'm really surprised this didn't trigger on non-sparc64 systems, but
what do I know :-)