2022-01-18 03:12:36

by kernel test robot

[permalink] [raw]
Subject: [security] d3b04a4398: WARNING:at_crypto/kdf_sp800108.c:#crypto_kdf108_init


(please be noted we reported this commit as
"[security] d3b04a4398: WARNING:at_crypto/kdf_sp800108.c:#crypto_kdf108_init"
when it's on linux-next/master
https://lists.01.org/hyperkitty/list/[email protected]/thread/5B23YXI7UOBEBJXXKHV2SPDN7PUE7RW7/
where we saw discussion about solution.
since now it's on mainline and the issue still exists, we reported this again
as a reminder)


Greeting,

FYI, we noticed the following commit (built with clang-14):

commit: d3b04a4398fe8022c9ca4b5ac6ab08059334b180 ("security: DH - use KDF implementation from crypto API")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

in testcase: boot

on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):



If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email protected]>


[ 42.753085][ T1] WARNING: CPU: 1 PID: 1 at crypto/kdf_sp800108.c:138 crypto_kdf108_init (crypto/kdf_sp800108.c:136)
[ 42.754665][ T1] Modules linked in:
[ 42.755366][ T1] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.16.0-rc1-00049-gd3b04a4398fe #2
[ 42.756752][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[ 42.758199][ T1] RIP: 0010:crypto_kdf108_init (crypto/kdf_sp800108.c:136)
[ 42.759125][ T1] Code: 89 de 48 83 c6 08 48 89 df e8 18 02 6d fc 4c 89 f7 e8 50 4b fd fb 85 ed 74 41 90 48 c7 c7 a0 9d 3b a8 89 ee e8 fd 15 b5 fb 90 <0f> 0b 90 90 89 e8 5b 41 5e 41 5f 5d c3 48 c7 c7 a0 9e 3b a8 48 c7
All code
========
0: 89 de mov %ebx,%esi
2: 48 83 c6 08 add $0x8,%rsi
6: 48 89 df mov %rbx,%rdi
9: e8 18 02 6d fc callq 0xfffffffffc6d0226
e: 4c 89 f7 mov %r14,%rdi
11: e8 50 4b fd fb callq 0xfffffffffbfd4b66
16: 85 ed test %ebp,%ebp
18: 74 41 je 0x5b
1a: 90 nop
1b: 48 c7 c7 a0 9d 3b a8 mov $0xffffffffa83b9da0,%rdi
22: 89 ee mov %ebp,%esi
24: e8 fd 15 b5 fb callq 0xfffffffffbb51626
29: 90 nop
2a:* 0f 0b ud2 <-- trapping instruction
2c: 90 nop
2d: 90 nop
2e: 89 e8 mov %ebp,%eax
30: 5b pop %rbx
31: 41 5e pop %r14
33: 41 5f pop %r15
35: 5d pop %rbp
36: c3 retq
37: 48 c7 c7 a0 9e 3b a8 mov $0xffffffffa83b9ea0,%rdi
3e: 48 rex.W
3f: c7 .byte 0xc7

Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: 90 nop
3: 90 nop
4: 89 e8 mov %ebp,%eax
6: 5b pop %rbx
7: 41 5e pop %r14
9: 41 5f pop %r15
b: 5d pop %rbp
c: c3 retq
d: 48 c7 c7 a0 9e 3b a8 mov $0xffffffffa83b9ea0,%rdi
14: 48 rex.W
15: c7 .byte 0xc7
[ 42.762103][ T1] RSP: 0000:ffffc9000001fce8 EFLAGS: 00010286
[ 42.763114][ T1] RAX: 000000000000003a RBX: 0000000000000001 RCX: ffffffffa8cf6c80
[ 42.764320][ T1] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffffc9000001fa68
[ 42.765555][ T1] RBP: 00000000fffffff4 R08: dffffc0000000000 R09: fffff52000003f4e
[ 42.766791][ T1] R10: 0000000000000000 R11: dffff12000003f4f R12: ffffffffa9f515c4
[ 42.768018][ T1] R13: 0000000080000000 R14: ffff88811cc81810 R15: dffffc0000000000
[ 42.769296][ T1] FS: 0000000000000000(0000) GS:ffff8883af100000(0000) knlGS:0000000000000000
[ 42.770717][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 42.771785][ T1] CR2: 0000000000000000 CR3: 000000027a416000 CR4: 00000000000406a0
[ 42.773108][ T1] Call Trace:
[ 42.773668][ T1] <TASK>
[ 42.774210][ T1] do_one_initcall (init/main.c:1297)
[ 42.775218][ T1] ? ca_keys_setup (crypto/kdf_sp800108.c:127)
[ 42.775989][ T1] ? rcu_read_lock_sched_held (include/linux/lockdep.h:? kernel/rcu/update.c:125)
[ 42.776935][ T1] do_initcall_level (init/main.c:1369)
[ 42.777736][ T1] do_initcalls (init/main.c:1383)
[ 42.778474][ T1] kernel_init_freeable (init/main.c:1614)
[ 42.779311][ T1] ? rest_init (init/main.c:1491)
[ 42.780126][ T1] kernel_init (init/main.c:1501)
[ 42.780816][ T1] ? rest_init (init/main.c:1491)
[ 42.781551][ T1] ret_from_fork (??:?)
[ 42.782285][ T1] </TASK>
[ 42.782774][ T1] irq event stamp: 377787
[ 42.783453][ T1] hardirqs last enabled at (377795): __up_console_sem (arch/x86/include/asm/irqflags.h:22 arch/x86/include/asm/irqflags.h:70 arch/x86/include/asm/irqflags.h:132 kernel/printk/printk.c:255)
[ 42.784998][ T1] hardirqs last disabled at (377804): __up_console_sem (kernel/printk/printk.c:253)
[ 42.786520][ T1] softirqs last enabled at (377700): __do_softirq (arch/x86/include/asm/preempt.h:27 kernel/softirq.c:402 kernel/softirq.c:587)
[ 42.788096][ T1] softirqs last disabled at (377677): __irq_exit_rcu (kernel/softirq.c:? kernel/softirq.c:636)
[ 42.789665][ T1] ---[ end trace b31286580039568f ]---
[ 42.796879][ T1] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
[ 42.802438][ T1] io scheduler mq-deadline registered
[ 42.806384][ T1] crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
[ 42.807361][ T1] crc32: self tests passed, processed 225944 bytes in 503210 nsec
[ 42.809123][ T1] crc32c: CRC_LE_BITS = 32
[ 42.809830][ T1] crc32c: self tests passed, processed 225944 bytes in 245030 nsec
[ 42.845225][ T1] crc32_combine: 8373 self tests passed
[ 42.876255][ T1] crc32c_combine: 8373 self tests passed
[ 42.901332][ T1] gpio_winbond: chip ID at 2e is ffff
[ 42.902303][ T1] gpio_winbond: not an our chip
[ 42.903183][ T1] gpio_winbond: chip ID at 4e is ffff
[ 42.904047][ T1] gpio_winbond: not an our chip
[ 42.946447][ T1] IPMI message handler: version 39.2
[ 42.948023][ T1] ipmi_si: IPMI System Interface driver
[ 42.951967][ T1] ipmi_si: Unable to find any System Interface(s)
[ 42.953042][ T1] ipmi_ssif: IPMI SSIF Interface driver
[ 44.060392][ T1] N_HDLC line discipline registered with maxframe=4096
[ 44.061589][ T1] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 44.063981][ T1] serial 00:05: GPIO lookup for consumer rs485-term
[ 44.065202][ T1] serial 00:05: using ACPI for GPIO lookup
[ 44.066193][ T1] acpi PNP0501:00: GPIO: looking up rs485-term-gpios
[ 44.067284][ T1] acpi PNP0501:00: GPIO: looking up rs485-term-gpio
[ 44.068360][ T1] serial 00:05: using lookup tables for GPIO lookup
[ 44.069524][ T1] serial 00:05: No GPIO consumer rs485-term found
[ 44.106838][ T1] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 44.117852][ T1] serial 00:06: GPIO lookup for consumer rs485-term
[ 44.119004][ T1] serial 00:06: using ACPI for GPIO lookup
[ 44.119929][ T1] acpi PNP0501:01: GPIO: looking up rs485-term-gpios
[ 44.120977][ T1] acpi PNP0501:01: GPIO: looking up rs485-term-gpio
[ 44.122053][ T1] serial 00:06: using lookup tables for GPIO lookup
[ 44.123113][ T1] serial 00:06: No GPIO consumer rs485-term found
[ 44.154749][ T1] 00:06: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[ 44.182277][ T1] telclk_interrupt = 0xf non-mcpbl0010 hw.
[ 44.207166][ T1] _warn_unseeded_randomness: 7 callbacks suppressed
[ 44.207179][ T1] random: get_random_u64 called from cache_random_seq_create+0x5e/0x140 with crng_init=0
[ 44.216194][ T1] hp_sw: device handler registered
[ 44.295846][ T2] random: get_random_u64 called from dup_task_struct+0x59a/0x900 with crng_init=0
[ 44.302804][ T1] scsi_debug:sdebug_driver_probe: scsi_debug: trim poll_queues to 0. poll_q/nr_hw = (0/1)
[ 44.304482][ T1] scsi host0: scsi_debug: version 0190 [20200710]
[ 44.304482][ T1] dev_size_mb=8, opts=0x0, submit_queues=1, statistics=0
[ 44.306922][ T1] random: get_random_u64 called from cache_random_seq_create+0x5e/0x140 with crng_init=0
[ 44.327167][ T1] scsi 0:0:0:0: Direct-Access Linux scsi_debug 0190 PQ: 0 ANSI: 7
[ 44.337441][ T1] scsi 0:0:0:0: Attached scsi generic sg0 type 0
[ 44.379479][ T1] Rounding down aligned max_sectors from 4294967295 to 4294967288
[ 44.385389][ T1] db_root: cannot open: /etc/target
[ 44.392443][ T1] platform physmap-flash.0: failed to claim resource 0: [mem 0x08000000-0x07ffffff]
[ 44.395648][ T1] e1000: Intel(R) PRO/1000 Network Driver
[ 44.396621][ T1] e1000: Copyright (c) 1999-2006 Intel Corporation.
[ 50.061744][ T1] ACPI: _SB_.LNKC: Enabled at IRQ 11
[ 50.528966][ T1] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[ 50.530547][ T1] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 50.535580][ T1] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[ 50.541874][ T1] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 50.543195][ T1] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 50.551639][ T1] mousedev: PS/2 mouse device common for all mice
[ 50.557528][ T26] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
[ 50.575247][ T26] evbug: Connected device: input0 (AT Translated Set 2 keyboard at isa0060/serio0/input0)
[ 50.585299][ T1] rtc-test rtc-test.0: char device (0:0)
[ 50.586268][ T1] rtc-test rtc-test.0: registered as rtc0
[ 50.587402][ T1] rtc-test rtc-test.0: setting system clock to 2022-01-17T23:31:28 UTC (1642462288)
[ 50.593215][ T1] rtc-test rtc-test.1: char device (0:1)
[ 50.594249][ T1] rtc-test rtc-test.1: registered as rtc1
[ 50.597134][ T1] rtc-test rtc-test.2: char device (0:2)
[ 50.598045][ T1] rtc-test rtc-test.2: registered as rtc2
[ 50.602016][ T1] pps pps0: new PPS source ktimer
[ 50.602939][ T1] pps pps0: ktimer PPS source registered
[ 50.604273][ T1] Driver for 1-wire Dallas network protocol.
[ 50.608496][ T1] __power_supply_register: Expected proper parent device for 'test_ac'
[ 50.611397][ T1] __power_supply_register: Expected proper parent device for 'test_battery'
[ 50.617810][ T1] __power_supply_register: Expected proper parent device for 'test_usb'
[ 50.628083][ T1] Driver 'corsair-psu' was unable to register with bus_type 'hid' because the bus was not initialized.
[ 50.647132][ T1] cpu5wdt: init success
[ 50.648266][ T1] w83877f_wdt: cannot register miscdev on minor=130 (err=-16)
[ 50.649465][ T1] w83977f_wdt: driver v1.00
[ 50.650233][ T1] w83977f_wdt: cannot register miscdev on minor=130 (err=-16)
[ 50.651537][ T1] machzwd: MachZ ZF-Logic Watchdog driver initializing


To reproduce:

# build kernel
cd linux
cp config-5.16.0-rc1-00049-gd3b04a4398fe .config
make HOSTCC=clang-14 CC=clang-14 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage modules
make HOSTCC=clang-14 CC=clang-14 ARCH=x86_64 INSTALL_MOD_PATH=<mod-install-dir> modules_install
cd <mod-install-dir>
find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz


git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
bin/lkp qemu -k <bzImage> -m modules.cgz job-script # job-script is attached in this email

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.



---
0DAY/LKP+ Test Infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation

Thanks,
Oliver Sang


Attachments:
(No filename) (11.87 kB)
config-5.16.0-rc1-00049-gd3b04a4398fe (130.88 kB)
job-script (4.72 kB)
dmesg.xz (16.41 kB)
Download all attachments

2022-01-19 19:07:52

by Herbert Xu

[permalink] [raw]
Subject: [PATCH] crypto: kdf - Select hmac in addition to sha256

On Tue, Jan 18, 2022 at 09:56:49AM +0800, kernel test robot wrote:
>
> [ 42.753085][ T1] WARNING: CPU: 1 PID: 1 at crypto/kdf_sp800108.c:138 crypto_kdf108_init (crypto/kdf_sp800108.c:136)
> [ 42.754665][ T1] Modules linked in:
> [ 42.755366][ T1] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.16.0-rc1-00049-gd3b04a4398fe #2
> [ 42.756752][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> [ 42.758199][ T1] RIP: 0010:crypto_kdf108_init (crypto/kdf_sp800108.c:136)
>
> CONFIG_CRYPTO_HMAC=m
> CONFIG_CRYPTO_KDF800108_CTR=y

---8<---
In addition to sha256 we must also enable hmac for the kdf self-test
to work.

Reported-by: kernel test robot <[email protected]>
Fixes: 304b4acee2f0 ("crypto: kdf - select SHA-256 required...")
Fixes: 026a733e6659 ("crypto: kdf - add SP800-108 counter key...")
Signed-off-by: Herbert Xu <[email protected]>

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 3ba2f532d79c..2b0456731603 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1850,6 +1850,7 @@ config CRYPTO_JITTERENTROPY

config CRYPTO_KDF800108_CTR
tristate
+ select CRYPTO_HMAC
select CRYPTO_SHA256

config CRYPTO_USER_API
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt