Re: building af_packet as a kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 03 Jul 2017 16:36:01 +0200, Kamil Konieczny said:
> https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module

> and short answer is to use 'lsof' command (ls open files),
> if lsmod fails to give ref info

That's the short - and incorrect - answer.  The long and *much* more
correct answer is on that link, and talks about the kernel tracing facility.

lsof only helps if the module is in use due to a direct reference on a
filesystem object (something you can /bin/ls).

So for instance, if you're trying to figure out why a serial driver
won't unload, finding that somebody has /dev/ttyUSB0 open may help.

But it *won't* help if it's a an indirect reference (a filesystem object is
open, but it's a filesystem on a USB memory device, and  the mount of /dev/sdb1
ends up taking a reference on the SCSI driver which ends up taking its own
reference on the USB driver(s) involved), or a reference via a non-filesystem
opbject.  And on Linux, network interfaces aren't filesystem objects - there
isn't a /dev/eth0 for your ethernet.  That's why you have to use netlink to
enumerate your interfaces.

The *correct* short answer is, of course, "use trace-cmd or kernelshark to
trace calls to module_get for the problem module". :)

Attachment: pgph2QVdTid15.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux