Hi Phil,

On Sat, Aug 06, 2016 at 12:24:28PM +0200, Phil Sutter wrote:

> > > > What is your take on supporting old kernel versions: Should I #ifdef for
> > > > < 4.3 or can I just drop ablkcipher like I've done now?
> > > Yes, sadly we have to support older kernels as well (see existing compat
> > > code). That's the curse of out-of-tree modules, I fear.
[...]
> Well, doing it as beautiful as possible is preferred, but eventually it
> will boil down to a ton of #ifdefs anyway. So no need to bust a gut over
> it. :)

I've opened a pull request for this. I tried to put all the relevant 
info in there. I think it turned out pretty pretty, ifdef-wise.

> > > Well, after compiling and loading the module, you could run the tests in
> > > test/ subdir (note how I subtly try to push you into testing).
> > I expected nothing else and you've done it very smoothly. ;) I was on

I did run make check and it (mostly) passed. Mostly, that is, all but
cipher-gcm. The cipher-gcm test always causes a null pointer dereference, even
with vanilla ablkcipher code on kernel 4.6.4. Also it happens in the
AEAD codepath, not ablk/skcipher. It reads:

[   26.758956] cryptodev: driver 1.8 loaded.
[   32.531775] alg: No test for fips(ansi_cprng) (fips_ansi_cprng)
[   32.539338] BUG: unable to handle kernel NULL pointer dereference at 
000000000000000c
[   32.539386] IP: [<ffffffff812c5bb3>] 
scatterwalk_pagedone.isra.8.part.9+0x33/0x50
[   32.539416] PGD 1a0cf067 PUD 1f891067 PMD 0 
[   32.539434] Oops: 0000 [#1] SMP 
[   32.539447] Modules linked in: hmac(E) drbg(E) ansi_cprng(E) gcm(E) 
cryptodev(OE) ppdev(E) coretemp(E) vmw_balloon(E) crct10dif_pclmul(E) 
crc32_pclmul(E) ghash_clmulni_intel(E) joydev(E)
serio_raw(E) pcspkr(E) vmw_vsock_vmci_transport(E) vsock(E) evdev(E) btusb(E) 
btrtl(E) btbcm(E) btintel(E) bluetooth(E) rfkill(E) vmwgfx(E) ttm(E) sg(E) 
drm_kms_helper(E) drm(E) vmw_vmci(E)
i2c_piix4(E) shpchp(E) parport_pc(E) 8250_fintek(E) parport(E) nfit(E) 
libnvdimm(E) battery(E) acpi_cpufreq(E) ac(E) tpm_tis(E) tpm(E) processor(E) 
button(E) fuse(E) autofs4(E) ext4(E) ecb(E) crc16(E)
jbd2(E) crc32c_generic(E) mbcache(E) hid_generic(E) usbhid(E) hid(E) 
crc32c_intel(E) sd_mod(E) sr_mod(E) cdrom(E) aesni_intel(E) aes_x86_64(E) 
glue_helper(E) lrw(E) gf128mul(E) ablk_helper(E)
cryptd(E) psmouse(E) ata_generic(E) uhci_hcd(E)
[   32.539873]  e1000(E) ehci_pci(E) ehci_hcd(E) xhci_pci(E) xhci_hcd(E) 
usbcore(E) usb_common(E) mptspi(E) scsi_transport_spi(E) mptscsih(E) mptbase(E) 
ata_piix(E) libata(E) scsi_mod(E) fjes(E)
[   32.539943] CPU: 0 PID: 3881 Comm: cipher-gcm Tainted: G           OE   
4.6.0-1-amd64 #1 Debian 4.6.4-1
[   32.539972] Hardware name: VMware, Inc. VMware Virtual Platform/440BX 
Desktop Reference Platform, BIOS 6.00 07/02/2015
[   32.540005] task: ffff88001a9be440 ti: ffff88001ab48000 task.ti: 
ffff88001ab48000
[   32.540028] RIP: 0010:[<ffffffff812c5bb3>]  [<ffffffff812c5bb3>] 
scatterwalk_pagedone.isra.8.part.9+0x33/0x50
[   32.540062] RSP: 0018:ffff88001ab4bab8  EFLAGS: 00010246
[   32.540079] RAX: 0000000000000000 RBX: ffff88001ab4bb70 RCX: ffff88001a8ce8a0
[   32.540133] RDX: 0000000000000f3c RSI: ffff8800004a6f3c RDI: ffff88001a8ce8a0
[   32.540156] RBP: ffff88001a9be440 R08: ffff88001ab2a8d8 R09: 000000000000022c
[   32.540177] R10: 00000000000000cc R11: 0000000000000000 R12: ffff88001a9be440
[   32.540199] R13: 0000000000000008 R14: 0000000000000008 R15: ffff88001ab4bb70
[   32.540221] FS:  00007f02dcd9b700(0000) GS:ffff88001ca00000(0000) 
knlGS:0000000000000000
[   32.540245] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   32.540263] CR2: 000000000000000c CR3: 000000001a11c000 CR4: 00000000001406f0
[   32.540334] Stack:
[   32.540344]  0000000000000008 ffffffff812c5c8f ffff88001ab2a8d8 
00000000811a0258
[   32.540372]  ffff88001ab4bb50 0000000000000010 0000000000000010 
ffff88001ab4bc28
[   32.541175]  0000000000000000 ffff88001ab4bd68 ffffffff812c8778 
0000000000000008
[   32.541884] Call Trace:
[   32.542582]  [<ffffffff812c5c8f>] ? scatterwalk_copychunks+0x7f/0x1a0
[   32.543283]  [<ffffffff812c8778>] ? blkcipher_walk_next+0x2b8/0x3a0
[   32.543978]  [<ffffffffc01f6548>] ? ctr_crypt+0xa8/0x1e0 [aesni_intel]
[   32.544663]  [<ffffffff811a0a94>] ? __get_user_pages+0xd4/0x6b0
[   32.545393]  [<ffffffff81321c55>] ? sg_init_table+0x15/0x30
[   32.546092]  [<ffffffffc0069090>] ? __ablk_encrypt+0x50/0x70 [ablk_helper]
[   32.547650]  [<ffffffffc03db1ba>] ? crypto_gcm_encrypt+0xba/0xe0 [gcm]
[   32.549055]  [<ffffffffc03ccd06>] ? cryptodev_cipher_encrypt+0x76/0xe0 
[cryptodev]
[   32.550194]  [<ffffffffc03ce516>] ? crypto_auth_run+0x316/0xec0 [cryptodev]
[   32.551350]  [<ffffffffc03cb6db>] ? cryptodev_ioctl+0x21b/0x5a0 [cryptodev]
[   32.552032]  [<ffffffff811a66a4>] ? handle_mm_fault+0x14f4/0x1d00
[   32.552757]  [<ffffffff812083a6>] ? dput+0x26/0x210
[   32.553420]  [<ffffffff81204a8d>] ? do_vfs_ioctl+0x9d/0x5c0
[   32.554055]  [<ffffffff81205024>] ? SyS_ioctl+0x74/0x80
[   32.554705]  [<ffffffff815c6776>] ? system_call_fast_compare_end+0xc/0x96
[   32.555306] Code: 48 8b 0f 05 ff 0f 00 00 25 00 f0 ff ff 89 47 08 8b 51 0c 
03 51 08 39 d0 73 02 f3 c3 53 48 89 fb 48 89 cf e8 80 bf 05 00 48 89 03 <8b> 50 
0c 85 d2 74 08 8b 40 08 89 43 08 5b c3 e8
89 ff ff ff 66 
[   32.557261] RIP  [<ffffffff812c5bb3>] 
scatterwalk_pagedone.isra.8.part.9+0x33/0x50
[   32.557865]  RSP <ffff88001ab4bab8>
[   32.558493] CR2: 000000000000000c
[   32.559110] ---[ end trace da88ec35f8a8df3a ]---

I've tried to track down the cause but after two hours of poking the
code had to admit that it is beyond my kernel-debugging-fu.
-- 
Thanks,
Michael

_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to