microsoft / microsoft/WSL

Feature request: Support for loadable kernel modules

Open
#10,450 5 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.22621.2215]

### WSL Version

1.2.5.0

### Are you using WSL 1 or WSL 2?

- [X] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.90.1

### Distro Version

Ubuntu 22.04

### Other Software

_No response_

### Repro Steps

```shell
# clone the WSL2 kernel
$ git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
$ cd WSL2-Linux-Kernel
$ git checkout linux-msft-wsl-5.15.90.1

# Set kernel version
$ uname -r
5.15.90.1-microsoft-standard-WSL2

$ export KERNELRELEASE=$(uname -r)

# copy the WSL2 config
$ cp Microsoft/config-wsl .config

# enable driver module (CONFIG_USB_NET_AX88179_178A=m in my case)
$ make menuconfig

# build
$ make KERNELRELEASE=$KERNELRELEASE
$ make KERNELRELEASE=$KERNELRELEASE modules

# install
$ sudo make KERNELRELEASE=$KERNELRELEASE modules_install

# load module
$ modinfo ax88179_178a
filename: /lib/modules/5.15.90.1-microsoft-standard-WSL2/kernel/drivers/net/usb/ax88179_178a.ko
license: GPL
description: ASIX AX88179/178A based USB 3.0/2.0 Gigabit Ethernet Devices
srcversion: 6C1FCF063025567E7E0CF65
alias: usb:v0711p0179d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0930p0A13d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v050Dp0128d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v17EFp304Bd*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v04E8pA100d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0DF6p0072d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v2001p4A00d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v04B4p3610d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0B95p178Ad*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v0B95p1790d*dc*dsc*dp*ic*isc*ip*in*
depends:
retpoline: Y
intree: Y
name: ax88179_178a
vermagic: 5.15.90.1-microsoft-standard-WSL2 SMP mod_unload modversions

$ sudo modprobe ax88179_178a
modprobe: ERROR: could not insert 'ax88179_178a': Invalid argument

$ dmesg # relevant part
[ 1827.985623] BPF: type_id=1113 bits_offset=0
[ 1827.986241] BPF:
[ 1827.986489] BPF:Invalid name
[ 1827.986693] BPF:

[ 1827.986852] failed to validate module [ax88179_178a] BTF: -22
```

### Expected Behavior

I expect the module to be loaded and useable after `modprobe`.

### Actual Behavior

An error occurs:

```shell
$ sudo modprobe ax88179_178a
modprobe: ERROR: could not insert 'ax88179_178a': Invalid argument

$ dmesg # relevant part
[ 1827.985623] BPF: type_id=1113 bits_offset=0
[ 1827.986241] BPF:
[ 1827.986489] BPF:Invalid name
[ 1827.986693] BPF:

[ 1827.986852] failed to validate module [ax88179_178a] BTF: -22
```

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the WSL2-Linux-Kernel tree and Microsoft/config-wsl, then reproduce the reported build, modules_install, and modprobe sequence for CONFIG_USB_NET_AX88179_178A=m. Read the BTF validation messages from dmesg and the module-loading path; done means the built module loads successfully under WSL 2 without the reported Invalid argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.