Case study 02 Kali NetHunter · Linux 4.14 · ABI

The WPA3 crash that called a string

Phones running my Kali NetHunter kernel for the Realme C3 crashed the moment they joined a WPA3 network. WPA2 was fine. The cause turned out to be 8 bytes.

Device
Realme C3 / Narzo 10A (RMX2020, MT6768)
Kernel
Linux 4.14.323, Android 13
Wi-Fi driver
Vendor wlan_drv_gen4m.ko, prebuilt
Shipped
v1.2, 25 Nov 2026
Upstream
Kali NetHunter !470, merged 2 Dec 2026
Found with
pahole, no crash log

01The symptom

Joining any WPA3-only network took the phone down. WPA2 networks on the same router worked. I found the cause without a crash log, by reading the binaries.

02Why only WPA3

With WPA3 (SAE), wpa_supplicant runs the authentication in userspace and hands the result to the driver with NL80211_CMD_EXTERNAL_AUTH. The kernel then calls the driver's external_auth op. WPA2 never takes that path: the ops it uses, like connect and auth, sit lower in the table, where nothing had moved.

03The 8 bytes

On this phone the Wi-Fi driver isn't built with the kernel. It's the vendor's prebuilt module, compiled against their 4.14.141 kernel, and force-loaded into the custom one. The custom kernel had picked up a stable backport that adds a new op, end_cac, right after start_radar_detection. Every op after it moved down by 8 bytes.

cfg80211_ops: the vendor module's layout next to the kernel's The vendor module has external_auth at offset 816 and its table ends at 824. The kernel, with end_cac inserted at 664, looks for external_auth at 824, which in the module's memory is the first value after the table, a pointer to a string. VENDOR MODULE · 4.14.141 KERNEL · 4.14.323 + BACKPORT 656start_radar_detection 664update_ft_ies ··· 816external_auth 824end · next: string pointer 656start_radar_detection 664end_cac (new) 672update_ft_ies ··· 824external_auth
The kernel calls ops->external_auth at offset 824. The module's table is only 824 bytes long, so that slot is the first value after it: a pointer to a string, apucCorDumpN9FileName. The CPU jumps into text.

That's the whole bug. The kernel and the driver agreed on everything below offset 664, which is why WPA2 kept working, and disagreed on everything above it.

04The fix

I took end_cac back out of cfg80211 and mac80211, along with the code that used it, so the table matches what the driver was built against. Then I pinned the layout, so a future backport that moves anything fails the build instead of crashing a phone:

/* net/wireless/core.c, in wiphy_new_nm() */
BUILD_BUG_ON(offsetof(struct cfg80211_ops, start_radar_detection) != 656);
BUILD_BUG_ON(offsetof(struct cfg80211_ops, update_ft_ies) != 664);
BUILD_BUG_ON(offsetof(struct cfg80211_ops, external_auth) != 816);
BUILD_BUG_ON(sizeof(struct cfg80211_ops) != 824);

05Checking it

  • pahole on the new vmlinux shows external_auth at 816 and the table at 824 bytes, matching the module.
  • On the phone, it joined a WPA3-only network with SAE and PMF, the handshake completed, and dmesg stayed clean.
  • All the extra Wi-Fi modules were rebuilt against the new kernel, so nothing else drifted.

06Shipping it

The fix went out as v1.2 on GitHub. I updated my Kali NetHunter merge request, !470, with it, and Kali merged it on 2 December 2026. Later I checked the other RMX2020 ROMs. Only the Android 13-era builds load the prebuilt module, and newer ROMs build the Wi-Fi driver from source, so they were never exposed.

When a kernel loads a binary-only module, the struct layout is an ABI. A stable backport can break it silently. A few compile-time checks are cheap insurance.

The lesson I keep