2023-06-26 07:10:26

by kernel test robot

[permalink] [raw]
Subject: [herbert-cryptodev-2.6:master] [KEYS] 63ba4d6759: BUG:kernel_NULL_pointer_dereference,address



Hello,

kernel test robot noticed "BUG:kernel_NULL_pointer_dereference,address" on:

commit: 63ba4d67594ad05b2c899b5a3a8cc7581052dd13 ("KEYS: asymmetric: Use new crypto interface without scatterlists")
https://git.kernel.org/cgit/linux/kernel/git/herbert/cryptodev-2.6.git master

in testcase: boot

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

(please refer to attached dmesg/kmsg for entire log/backtrace)


+---------------------------------------------+------------+------------+
| | e5221fa6a3 | 63ba4d6759 |
+---------------------------------------------+------------+------------+
| boot_successes | 11 | 0 |
| boot_failures | 0 | 12 |
| BUG:kernel_NULL_pointer_dereference,address | 0 | 12 |
| Oops:#[##] | 0 | 12 |
| EIP:crypto_sig_verify | 0 | 12 |
| Kernel_panic-not_syncing:Fatal_exception | 0 | 12 |
+---------------------------------------------+------------+------------+


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]



[ 7.727242][ T1] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 7.737831][ T1] BUG: kernel NULL pointer dereference, address: 00000010
[ 7.739122][ T1] #PF: supervisor read access in kernel mode
[ 7.740125][ T1] #PF: error_code(0x0000) - not-present page
[ 7.741135][ T1] *pdpt = 0000000000000000 *pde = f000ff53f000ff53
[ 7.742337][ T1] Oops: 0000 [#1]
[ 7.742986][ T1] CPU: 0 PID: 1 Comm: swapper Tainted: G S 6.4.0-rc1-00077-g63ba4d67594a #2
[ 7.744804][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 7.746660][ T1] EIP: crypto_sig_verify+0x82/0xa4
[ 7.747504][ T1] Code: c0 e8 ea 62 08 00 8b 95 70 ff ff ff 89 d9 8d 45 c0 e8 16 ff ff ff 8b 4d 0c 8b 55 08 8d 45 d8 e8 08 ff ff ff 8b 45 88 8b 50
10 <8b> 52 10 ff 52 dc 89 c2 8d 85 74 ff ff ff e8 cf fa ff ff 81 c4 84
[ 7.750845][ T1] EAX: c7676a00 EBX: 00000100 ECX: 00000000 EDX: 00000000
[ 7.752017][ T1] ESI: c76c4840 EDI: c0773d40 EBP: c0773d4c ESP: c0773cbc
[ 7.753196][ T1] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 EFLAGS: 00010246
[ 7.754461][ T1] CR0: 80050033 CR2: 00000010 CR3: 034e8000 CR4: 000406b0
[ 7.755664][ T1] Call Trace:
[ 7.756232][ T1] public_key_verify_signature+0x1a8/0x1db
[ 7.757243][ T1] x509_check_for_self_signed+0x45/0xb3
[ 7.758287][ T1] x509_cert_parse+0x162/0x196
[ 7.759181][ T1] x509_key_preparse+0x1c/0x189
[ 7.760097][ T1] ? __down_read+0xd/0x13
[ 7.760873][ T1] ? down_read+0x36/0x44
[ 7.761667][ T1] asymmetric_key_preparse+0x35/0x56
[ 7.762669][ T1] __key_create_or_update+0x126/0x342
[ 7.763673][ T1] key_create_or_update+0x1b/0x21
[ 7.764563][ T1] x509_load_certificate_list+0x65/0xba
[ 7.765558][ T1] regulatory_init_db+0x7b/0xd6
[ 7.766396][ T1] ? regulatory_init+0x55/0x55
[ 7.767214][ T1] do_one_initcall+0x65/0x146
[ 7.768020][ T1] do_initcalls+0x108/0x12c
[ 7.768802][ T1] kernel_init_freeable+0xa3/0xd3
[ 7.769674][ T1] ? rest_init+0xac/0xac
[ 7.770468][ T1] kernel_init+0x17/0xf8
[ 7.771237][ T1] ret_from_fork+0x19/0x24
[ 7.772047][ T1] Modules linked in:
[ 7.772742][ T1] CR2: 0000000000000010
[ 7.773509][ T1] ---[ end trace 0000000000000000 ]---
[ 7.774516][ T1] EIP: crypto_sig_verify+0x82/0xa4
[ 7.775472][ T1] Code: c0 e8 ea 62 08 00 8b 95 70 ff ff ff 89 d9 8d 45 c0 e8 16 ff ff ff 8b 4d 0c 8b 55 08 8d 45 d8 e8 08 ff ff ff 8b 45 88 8b 50 10 <8b> 52 10 ff 52 dc 89 c2 8d 85 74 ff ff ff e8 cf fa ff ff 81 c4 84
[ 7.778919][ T1] EAX: c7676a00 EBX: 00000100 ECX: 00000000 EDX: 00000000
[ 7.780102][ T1] ESI: c76c4840 EDI: c0773d40 EBP: c0773d4c ESP: c0773cbc
[ 7.781464][ T1] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 EFLAGS: 00010246
[ 7.782823][ T1] CR0: 80050033 CR2: 00000010 CR3: 034e8000 CR4: 000406b0
[ 7.784055][ T1] Kernel panic - not syncing: Fatal exception
[ 7.785124][ T1] Kernel Offset: disabled



To reproduce:

# build kernel
cd linux
cp config-6.4.0-rc1-00077-g63ba4d67594a .config
make HOSTCC=gcc-12 CC=gcc-12 ARCH=i386 olddefconfig prepare modules_prepare bzImage modules
make HOSTCC=gcc-12 CC=gcc-12 ARCH=i386 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.



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



Attachments:
(No filename) (5.31 kB)
config-6.4.0-rc1-00077-g63ba4d67594a (136.62 kB)
job-script (4.99 kB)
dmesg.xz (19.15 kB)
Download all attachments

2023-06-26 10:34:48

by Herbert Xu

[permalink] [raw]
Subject: [PATCH] crypto: akcipher - Set request tfm on sync path

On Mon, Jun 26, 2023 at 03:07:01PM +0800, kernel test robot wrote:
>
> [ 7.727242][ T1] cfg80211: Loading compiled-in X.509 certificates for regulatory database
> [ 7.737831][ T1] BUG: kernel NULL pointer dereference, address: 00000010
> [ 7.739122][ T1] #PF: supervisor read access in kernel mode
> [ 7.740125][ T1] #PF: error_code(0x0000) - not-present page
> [ 7.741135][ T1] *pdpt = 0000000000000000 *pde = f000ff53f000ff53
> [ 7.742337][ T1] Oops: 0000 [#1]
> [ 7.742986][ T1] CPU: 0 PID: 1 Comm: swapper Tainted: G S 6.4.0-rc1-00077-g63ba4d67594a #2
> [ 7.744804][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
> [ 7.746660][ T1] EIP: crypto_sig_verify+0x82/0xa4

---8<---
The request tfm needs to be set.

Fixes: addde1f2c966 ("crypto: akcipher - Add sync interface without SG lists")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-lkp/[email protected]

diff --git a/crypto/akcipher.c b/crypto/akcipher.c
index 152cfba1346c..8ffd31c44cf6 100644
--- a/crypto/akcipher.c
+++ b/crypto/akcipher.c
@@ -207,6 +207,7 @@ int crypto_akcipher_sync_prep(struct crypto_akcipher_sync_data *data)
return -ENOMEM;

data->req = req;
+ akcipher_request_set_tfm(req, data->tfm);

buf = (u8 *)(req + 1) + reqsize;
data->buf = buf;
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt