โšก Embedded Security

Triage of ARM ET_REL Kernel Modules, .rel.rodata Tables & D11 Microcode (Part 2)

Beginner reverse engineers often make the mistake of dragging a 7.2-megabyte proprietary kernel module like wl.ko straight into Ghidra or IDA Pro and staring at 14,000 unnamed ARMv7 functions. Experienced kernel researchers start with structural ELF triage: before reading a single instruction of .text, the module's section headers, .modinfo tags, SHN_UNDEF symbol imports, and .rel.rodata relocation records tell you the exact kernel ABI boundary, hardware bus architecture, and read-only calibration table geometry.

Architectural diagram showing ARM Elf32 ET_REL .ko section headers, .rel.rodata descriptor relocations, and SoftMAC D11 rev 42 PSM microcode versus FullMAC architecture
Figure 2.1 โ€” Left: Why Linux ET_REL kernel modules preserve .symtab and .rel.rodata metadata. Right: Why BCM4360 (14e4:43a0) is a SoftMAC device incompatible with brcmfmac.

1. SoftMAC vs. FullMAC: Why brcmfmac Refuses 14e4:43a0

Before inspecting any ELF sections, let's answer the architectural question every OpenWrt developer asks first: "Linux 6.12 already ships brcmfmac for Broadcom 802.11ac chips โ€” why can't we simply add PCI ID 14e4:43a0 to brcmfmac's device table?"

Broadcom built two fundamentally different silicon families during the 802.11ac Wave-1/Wave-2 transition:

Architectural Dimension SoftMAC Silicon (BCM4360 โ€” 14e4:43a0) FullMAC Silicon (BCM43602 / BCM4366)
On-Chip CPU Core None โ€” only a 16-bit D11 Core (Rev 42) Programmable State Machine (PSM) Dedicated ARM Cortex-R4 / Cortex-M3 running HNDRTE RTOS + 16-bit D11 core
Where 802.11 MLME & PHY Init Run Host Router CPU (Cortex-A9 kernel driver over PCIe BAR0 MMIO) Inside the Wi-Fi Chip (~650 KiB brcmfmac43602-pcie.bin firmware)
Host-to-Chip PCIe Protocol 64-bit DMA TX/RX packet rings + 4 KiB Shared Memory (SHM) + direct PHY/Radio MMIO High-level msgbuf / CDC/BDC event ring (SCAN, JOIN, Ethernet frames)
Mainline Linux Driver Family drivers/net/wireless/broadcom/b43/ (mac80211 + bcma) drivers/net/wireless/broadcom/brcm80211/brcmfmac/ (cfg80211)

In a SoftMAC design like the Nighthawk R7000's dual BCM4360 radios, the 16-bit D11 PSM microcode only handles hard real-time microsecond tasks โ€” CSMA/CA backoff timers, SIFS/DIFS inter-frame spacing, RTS/CTS protection, and hardware ACK / BlockAck responses within 16 microseconds. Every channel switch, VHT80 synthesizer lock, IQ-imbalance calibration, PA gain table upload, and WPA3-SAE management frame is driven by the Linux host CPU. That is why an open-source driver for BCM4360 belongs in the mainline mac80211 + b43 (AC-PHY rev 1 + Radio 2069 rev 4) architecture.

2. Why Linux .ko Files Cannot Hide Their Skeleton (ET_REL)

When a developer strips a userland ELF binary (ET_EXEC or ET_DYN) with strip --strip-all, the linker has already resolved internal function calls and global data references to fixed virtual offsets; .symtab and compile-time relocation sections vanish completely.

A Linux Loadable Kernel Module (.ko) cannot do that! Run readelf -h on any ARMv7 kernel module and inspect Type:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Type:                              REL (Relocatable file)
  Machine:                           ARM (40)
  Flags:                             0x5000000, Version5 EABI

Because e_type == ET_REL (1), every section's virtual address (sh_addr) in the file is 0x00000000. When the router executes insmod wl.ko, the Linux kernel's module loader (kernel/module.c -> arch/arm/kernel/module.c) allocates separate vmalloc() pages for .text, .rodata, .data, and .bss, then walks every .rel.* relocation section calling apply_relocate():

  • R_ARM_CALL (28) & R_ARM_JUMP24 (29): Patches 24-bit relative branch instructions in .text so calls to external kernel exports (like dev_alloc_skb or printk) jump to the live kernel's symbol addresses.
  • R_ARM_MOVW_ABS_NC (43) & R_ARM_MOVT_ABS (44): Patches 16-bit lower/upper immediate pairs loading 32-bit pointers to .rodata strings or .bss state structures.
  • R_ARM_ABS32 (2): Patches 32-bit absolute pointers stored inside data and descriptor tables (such as .rel.data and .rel.rodata).

3. Mapping the Kernel ABI Surface via .modinfo and SHN_UNDEF

Even if a vendor strips local static function names from .symtab using strip --strip-debug or objcopy --keep-global-symbol, two goldmines remain completely intact in every loadable .ko:

A. The .modinfo NUL-Delimited Dictionary

The .modinfo section stores NUL-terminated ASCII key=value pairs checked by the kernel before linking. Extracting vermagic immediately reveals every kernel Kconfig ABI flag the binary expects:

vermagic=2.6.36.4brcmarm SMP preempt mod_unload ARMv7
license=Proprietary
depends=

Notice SMP and preempt: those flags alter the exact byte size and lock fields of spinlock_t, struct module, and thread_info! A module compiled for SMP preempt ARMv7 will crash immediately if force-loaded into a non-SMP or differently configured kernel.

B. Undefined Symbol Imports (st_shndx == SHN_UNDEF)

In 32-bit ELF, each entry in .symtab is a 16-byte Elf32_Sym struct (<IIIBBH: st_name, st_value, st_size, st_info, st_other, st_shndx). Every symbol whose section index st_shndx equals 0 (SHN_UNDEF) is an external kernel function or global variable imported from vmlinux. On Broadcom's Northstar wl module, the entire boundary between the giant 7 MB wireless blob and the Linux kernel boils down to roughly 25โ€“40 undefined imports โ€” PCI config helpers, ioremap_nocache, alloc_etherdev_mq, dev_alloc_skb, netif_rx, spinlocks, timers, and NVRAM getters. As we will see in Part 5, counting and categorizing this exact SHN_UNDEF list tells you immediately how hard an ABI shim or clean-room port will be.

4. Recovering Read-Only PHY Calibration Arrays via .rel.rodata

Here is one of the highest-leverage static analysis techniques in driver research. Modern Wi-Fi PHYs load dozens of lookup tables into hardware RAM during channel initialization: IQ local-oscillator loft tables, RSSI gain-code tables, TSSI power-control LUTs, and VHT PAPD (Power Amplifier Pre-Distortion) curves. Inside C source code, hardware teams almost universally represent a catalog of tables as an array of descriptor structs:

struct phy_table_desc {
    uint32_t table_id;     /* e.g. ACPHY_TBL_ID_IQLOCAL = 14 */
    uint32_t elem_count;   /* e.g. 128 entries */
    uint32_t elem_width;   /* 8, 16, or 32 bits */
    const void *data;      /* Pointer into .rodata! */
};

Think about what happens to that fourth field (const void *data) when GCC compiles this array into a relocatable .ko! Because the descriptor array itself lives in .rodata and data points to another offset inside .rodata, the compiler emits a cluster of regularly spaced R_ARM_ABS32 relocations inside .rel.rodata spaced every 16 bytes (r_offset = base + 12, base + 28, base + 44, ...)!

By writing a 25-line Python script that scans .rel.rodata for arithmetic progressions of r_offset stride 12, 16, or 20, you can locate entire catalogs of hardware initialization tables โ€” complete with their exact element counts, bit widths, and target buffer lengths โ€” before decompiling a single subroutine in .text.

5. How b43-fwcutter Separates Microcode from Driver Logic

In clean-room Linux driver engineering, we never copy proprietary C control code into a GPL-2.0 kernel module. However, the on-chip 16-bit D11 core requires Broadcom's PSM microcode binary (ucode42.fw for D11 rev 42 on BCM4360, release 784.2) loaded into D11 instruction RAM at interface bring-up, just as an Intel or AMD CPU loads microcode updates from /lib/firmware/.

The upstream b43-fwcutter utility maintains a curated table of SHA/MD5 hashes and exact ELF byte offsets for known reference objects (such as broadcom-wl-6.30.163.46.wl_apsta.o), extracting ucode42.fw, pcm5.fw, and initial-value streams cleanly into /lib/firmware/b43/ on the end user's own machine without redistributing vendor binaries inside OpenWrt's source repository.

6. Your Turn โ€” Hands-On Lab 02 Checkpoints (Zero Spoilers)

Open labs/02-elf-relocations-and-microcode.md and complete the three static triage routines in labs/starter/lab02_elf_triage_skeleton.py using only Python's built-in struct module:

  1. Implement parse_elf32_sections(blob): Unpack the 52-byte Elf32_Ehdr (<16sHHIIIIIHHHHHH), verify ELFCLASS32, little-endian data encoding, and e_type == ET_REL (1), then walk all e_shnum 40-byte section headers and resolve section names through e_shstrndx.
  2. Implement extract_modinfo_kv(blob, sections): Slice .modinfo and parse NUL-delimited key=value pairs into a clean Python dictionary.
  3. Implement list_undefined_imports(blob, sections): Unpack every 16-byte Elf32_Sym (<IIIBBH) in .symtab, resolve its name via the linked .strtab section, filter for non-empty symbols with st_shndx == SHN_UNDEF (0), and return them sorted.
  4. Verify with the Grader: Run python3 labs/verify_labs.py --lab 2 to test your parser against an in-memory synthetic ARMv7 .ko object and against any real .ko modules unpacked in Lab 01.

Continue to Part 3 of the Series

Static ELF triage maps the module's imports and static tables, yet complex radio calibration loops compute register values dynamically from per-board NVRAM keys. Continue to Part 3: Black-Box BAR0 Page-Fault MMIO Traps & Differential NVRAM Fuzzing on ARMv7 to capture exact hardware register sequences at runtime.

Robert Baindourov

Written & Architected by Robert Baindourov

Senior IoT Firmware & Edge-Cloud Solutions Architect with 17+ years total experience (15+ years professional architecture). Specializing in bare-metal C/C++, FreeRTOS, Zephyr OS, Embedded Rust, hardware secure elements (ATECC608, TPM 2.0), and high-throughput cloud telemetry pipelines (AWS IoT Core, EMQX, Node.js). Based in Los Angeles, CA.