Linux-kernel mailing list archive 2000-06,: module strangeness with lsmod

# module strangeness with lsmod

Per Kristian Gjermshus (pergj@ifi.uio.no)
12 Feb 2000 19:50:53 +0100

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Richard Henderson: "Re: 2.3.43 alpha broken with >2g of ram"
- Previous message: Linus Torvalds: "Re: 2.3.43 alpha broken with >2g of ram"

If lsmod encounters a deleted module it will fail. lsmod calls
query_module with QM_MODULES to get a list of the modules, it then
uses query_module with QM_INFO for each of the modules found. The
input to QM_INFO is checked with find_module and find_module fails if
the module is deleted. Deleted modules are returned in the QM_MODULES
call.

It might be that the-snd-card-trident module in the example below
should not have been marked as deleted, but the logic for QM_MODULES
and QM_INFO must be flawed anyway.

I have only seen this behavior with 2.3.43, but the code is identical
in older kernels as well.

[root@chrome ~]# lsmod
Module Size Used by
snd-synth-trident 7000 0 (autoclean) (unused)
lsmod: QM_INFO: No such file or directory
[root@chrome ~]# cat /proc/modules
snd-synth-trident 7000 0 (autoclean) (unused)
snd-card-trident 2744 0 (deleted)
snd-trident 15604 0 (autoclean) [snd-synth-trident snd-card-trident]
snd-ac97-codec 22432 0 (autoclean) [snd-trident]
snd-mpu401-uart 1944 0 (autoclean) [snd-card-trident snd-trident]
snd-seq-oss 30232 0 (unused)
snd-ainstr-iw 4856 0 (unused)
snd-ainstr-gf1 2776 0 (unused)
snd-ainstr-simple 1564 0 [snd-synth-trident]
snd-seq-instr 4824 0 [snd-synth-trident]
snd-seq-midi-emul 4468 0 [snd-synth-trident]
snd-seq-midi 3772 0 (unused)
snd-seq-midi-event 2764 0 [snd-seq-oss snd-seq-midi]
snd-seq 45268 0 [snd-synth-trident snd-seq-oss snd-seq-instr snd-seq-midi snd-seq-midi-event]
snd-hwdep 3340 0 (unused)
snd-rawmidi 11480 0 [snd-mpu401-uart snd-seq-midi]
snd-seq-device 5112 0 [snd-synth-trident snd-trident snd-seq-oss snd-seq-midi snd-seq snd-rawmidi]
snd-pcm-oss 18192 0
snd-pcm-plugin 14952 0 [snd-pcm-oss]
snd-pcm 32184 0 [snd-trident snd-pcm-oss snd-pcm-plugin]
snd-timer 9824 0 [snd-seq snd-pcm]
snd-mixer-oss 4436 0 [snd-pcm-oss]
snd-mixer 25168 0 [snd-trident snd-ac97-codec snd-mixer-oss]
snd 41952 1 [snd-synth-trident snd-card-trident snd-trident snd-ac97-codec snd-mpu401-uart snd-seq-oss snd-ainstr-iw snd-ainstr-gf1 snd-seq-instr snd-seq-midi-emul snd-seq-midi snd-seq-midi-event snd-seq snd-hwdep snd-rawmidi snd-seq-device snd-pcm-oss snd-pcm-plugin snd-pcm snd-timer snd-mixer-oss snd-mixer]
[root@chrome ~]# strace lsmod
execve("/sbin/lsmod", ["lsmod"], [/* 26 vars */]) = 0
brk(0) = 0x804a0d8
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=33537, ...}) = 0
mmap(0, 33537, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40013000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=4118299, ...}) = 0
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\250\202"..., 4096) = 4096
mmap(0, 993500, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001c000
mprotect(0x40107000, 30940, PROT_NONE) = 0
mmap(0x40107000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xea000) = 0x40107000
mmap(0x4010b000, 14556, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4010b000
close(3) = 0
mprotect(0x4001c000, 962560, PROT_READ|PROT_WRITE) = 0
mprotect(0x4001c000, 962560, PROT_READ|PROT_EXEC) = 0
munmap(0x40013000, 33537) = 0
personality(0 /* PER_??? */) = 0
getpid() = 22637
brk(0) = 0x804a0d8
brk(0x804a278) = 0x804a278
brk(0x804b000) = 0x804b000
query_module(NULL, 0, NULL, 0) = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 3), ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40013000
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "Module Size Us"..., 38Module Size Used by
) = 38
query_module(NULL, QM_MODULES, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 0xbffffb2c) = 0
query_module("snd-synth-trident", QM_INFO, "\314\213\4\10\0\0\0\0\0\0\0\0\0\0\0\0", 0xbffffb2c) = 0
query_module("snd-synth-trident", QM_REFS, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 0xbffffb2c) = 0
write(1, "snd-synth-trident 7000 0"..., 55snd-synth-trident 7000 0 (autoclean) (unused)
) = 55
query_module("snd-card-trident", QM_INFO, "\0\300\210\310X\33\0\0\5\0\0\0\0\0\0\0", 0xbffffb2c) = -1 ENOENT (No such file or directory)
write(2, "lsmod: ", 7lsmod: ) = 7
write(2, "QM_INFO: No such file or directo"..., 34QM_INFO: No such file or directory) = 34
write(2, "\n", 1
) = 1
munmap(0x40013000, 4096) = 0
_exit(1)

Per Kristian

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Richard Henderson: "Re: 2.3.43 alpha broken with >2g of ram"
- Previous message: Linus Torvalds: "Re: 2.3.43 alpha broken with >2g of ram"