Page MenuHomeFreeBSD

asmc: Prevent module unload to avoid kernel panic
Needs ReviewPublic

Authored by guest-seuros on Fri, Jan 9, 2:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 15, 10:08 AM
Unknown Object (File)
Thu, Jan 15, 3:40 AM
Unknown Object (File)
Thu, Jan 15, 1:38 AM
Unknown Object (File)
Mon, Jan 12, 6:46 PM
Unknown Object (File)
Mon, Jan 12, 6:46 PM
Unknown Object (File)
Sat, Jan 10, 8:23 AM
Unknown Object (File)
Sat, Jan 10, 3:10 AM
Unknown Object (File)
Fri, Jan 9, 10:25 PM
Subscribers

Details

Reviewers
adrian
ngie
markj
Summary

Prevent asmc driver from being detached/unloaded to avoid kernel
panics during device reprobing. When asmc.ko is unloaded and then
reloaded, acpi_driver_added() attempts to reprobe the detached
device but accesses freed driver structures in the devclass,
causing a page fault in kobj_init().

Return EBUSY from asmc_detach() to prevent unloading while the
device is attached, similar to acpi_hpet and other critical
ACPI drivers.

Crash backtrace from testing:

kobj_init+0xe
device_set_driver+0xa3
device_probe_child+0xe4
device_probe+0x8b
device_probe_and_attach+0x2e
acpi_driver_added+0x99

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69750
Build 66633: arc lint + arc unit

Event Timeline

Can you provide more details about the panic, e.g., the panic string and gdb backtrace? You might also try testing with a GENERIC-KASAN kernel. The stack trace you pasted is odd and it'd be nice to understand what's actually going on.

This module load only in apple hardware. Spparently the hardware is not build to have it driver hot reloaded.

System boot -> unload driver -> ok -> load it again -> panic (resources were not freed) (need a full reboot)

This module load only in apple hardware. Spparently the hardware is not build to have it driver hot reloaded.

System boot -> unload driver -> ok -> load it again -> panic (resources were not freed) (need a full reboot)

Ok, but what exactly is the panic string? This sounds like a driver bug and it'd be better to understand what's actually going on.