raspberrypi / raspberrypi/linux

linux-5.4.51 cfg80211 fails to load regulatory.db when compiled with gcc-10.1.0 and glibc-2.31

Open
#3,769 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Description

When compiling 5.4.51 natively on an RPi4 using bcm2711_defconfig with gcc-10.1.0 and glibc-2.31, cfg80211 fails to load regulatory.db - there are no errors or relevant warnings during the compilation.

Using a cross-compiler "arm-bcm2708hf-linux-gnueabihf-gcc (crosstool-NG 1.24.0.6-afaf7b9) 7.4.1 20181213" and glibc-2.28 with the same config except "CONFIG_CC_HAS_ASM_INLINE=y" (not supported by gcc-7) results in no problems.

In both cases wifi works.

[    1.215627] Asymmetric key parser 'x509' registered
[    1.491309] Loading compiled-in X.509 certificates
...
[60597.353367] cfg80211: Problem loading in-kernel X.509 certificate (-22)
[60597.365221] ------------[ cut here ]------------
[60597.365240] WARNING: CPU: 2 PID: 12380 at crypto/rsa-pkcs1pad.c:539 pkcs1pad_verify+0x158/0x174
[60597.365248] Modules linked in: cfg80211 rfkill snd_soc_bcm2835_i2s snd_soc_core snd_pcm_dmaengine snd_compress snd_bcm2835(C) snd_pcm snd_timer snd i2c_dev evdev squashfs spidev rpivid_mem raspberrypi_hwmon spi_bcm2835 i2c_bcm2835 zram zsmalloc uio_pdrv_genirq uio
[60597.365313] CPU: 2 PID: 12380 Comm: modprobe Not tainted 5.4.51-piCore-v7 #1
[60597.365317] Hardware name: BCM2711
[60597.365328] Workqueue: events request_firmware_work_func
[60597.365333] Backtrace: 
[60597.365346] [<c020df24>] (dump_backtrace) from [<c020e26c>] (show_stack+0x20/0x24)
[60597.365353]  r7:ffffffff r6:00000000 r5:60000013 r4:c129c7a0
[60597.365363] [<c020e24c>] (show_stack) from [<c0a5e38c>] (dump_stack+0xd0/0x114)
[60597.365372] [<c0a5e2bc>] (dump_stack) from [<c0221e28>] (__warn+0xe0/0x108)
[60597.365380]  r9:cfd14c00 r8:00000009 r7:0000021b r6:c0639948 r5:00000009 r4:c0dedd50
[60597.365389] [<c0221d48>] (__warn) from [<c02221f4>] (warn_slowpath_fmt+0x74/0xcc)
[60597.365395]  r7:c0639948 r6:0000021b r5:c0dedd50 r4:00000000
[60597.365404] [<c0222184>] (warn_slowpath_fmt) from [<c0639948>] (pkcs1pad_verify+0x158/0x174)
[60597.365411]  r8:cfd27300 r7:cfdf4880 r6:cfdacdc0 r5:00000000 r4:cfd27300
[60597.365421] [<c06397f0>] (pkcs1pad_verify) from [<c06432c4>] (public_key_verify_signature+0x258/0x304)
[60597.365428]  r9:cfd14c00 r8:cfd27300 r7:cfdf4880 r6:cfdacdc0 r5:00000000 r4:d1467c0c
[60597.365437] [<c064306c>] (public_key_verify_signature) from [<c06448cc>] (x509_check_for_self_signed+0xcc/0x128)
[60597.365444]  r9:000000ef r8:000002a8 r7:cfdacd80 r6:00000000 r5:cfdacdc0 r4:cfdf4780
[60597.365453] [<c0644800>] (x509_check_for_self_signed) from [<c0643cc0>] (x509_cert_parse+0x178/0x1c8)
[60597.365459]  r7:f082103c r6:cfdf4800 r5:cfdacf00 r4:cfdf4780
[60597.365468] [<c0643b48>] (x509_cert_parse) from [<c0644f94>] (pkcs7_extract_cert+0x3c/0x70)
[60597.365475]  r9:000000ef r8:0000004f r7:00000000 r6:000002a4 r5:00000002 r4:cfdacc80
[60597.365484] [<c0644f58>] (pkcs7_extract_cert) from [<c06a4270>] (asn1_ber_decoder+0x648/0x920)
[60597.365489]  r5:00000002 r4:00000040
[60597.365497] [<c06a3c28>] (asn1_ber_decoder) from [<c0644b18>] (pkcs7_parse_message+0xdc/0x1ac)
[60597.365504]  r10:00000000 r9:cfdacd00 r8:cfdacd00 r7:0000049e r6:f0821000 r5:c0e4040c
[60597.365509]  r4:cfdacc80
[60597.365519] [<c0644a3c>] (pkcs7_parse_message) from [<c037aa04>] (verify_pkcs7_signature+0x2c/0x80)
[60597.365527]  r9:00000080 r8:00000000 r7:eff3e600 r6:00000eb4 r5:f081b000 r4:f081b000
[60597.365641] [<c037a9d8>] (verify_pkcs7_signature) from [<bf1ae104>] (valid_regdb+0xd8/0x228 [cfg80211])
[60597.365647]  r6:bf21f554 r5:00000eb4 r4:f081b000
[60597.365827] [<bf1ae02c>] (valid_regdb [cfg80211]) from [<bf1b20d4>] (regdb_fw_cb+0x34/0x114 [cfg80211])
[60597.365835]  r10:00000000 r9:00000080 r8:00000000 r7:eff3e600 r6:cfdac900 r5:bf21f554
[60597.365840]  r4:cfdac840
[60597.365933] [<bf1b20a0>] (regdb_fw_cb [cfg80211]) from [<c078b628>] (request_firmware_work_func+0x60/0xa4)
[60597.365940]  r7:eff3e600 r6:eff3b340 r5:eee87e00 r4:cfdac8c0
[60597.365951] [<c078b5c8>] (request_firmware_work_func) from [<c023f468>] (process_one_work+0x21c/0x544)
[60597.365956]  r4:cfdac8c0
[60597.365964] [<c023f24c>] (process_one_work) from [<c023f7fc>] (worker_thread+0x6c/0x5d8)
[60597.365972]  r10:eff3b340 r9:00000008 r8:c1203d00 r7:eff3b358 r6:eee87e14 r5:eff3b340
[60597.365976]  r4:eee87e00
[60597.365984] [<c023f790>] (worker_thread) from [<c02460a8>] (kthread+0x16c/0x170)
[60597.365992]  r10:d0f57e84 r9:c023f790 r8:eee87e00 r7:d1466000 r6:00000000 r5:eee86a40
[60597.365996]  r4:efbb6540
[60597.366004] [<c0245f3c>] (kthread) from [<c02010ac>] (ret_from_fork+0x14/0x28)
[60597.366009] Exception stack(0xd1467fb0 to 0xd1467ff8)
[60597.366015] 7fa0:                                     00000000 00000000 00000000 00000000
[60597.366022] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[60597.366028] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[60597.366036]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0245f3c
[60597.366040]  r4:eee86a40
[60597.366046] ---[ end trace 8ac9463ac2468c2b ]---
[60597.366072] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with crypto/rsa-pkcs1pad.c at pkcs1pad_verify, then follow cfg80211's valid_regdb and regdb_fw_cb paths shown in the trace. Reproduce the native GCC 10.1.0/glibc 2.31 build and compare it with the GCC 7.4.1 cross-build; done means regulatory.db loads without the certificate or malformed-signature warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
networking, operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.