For me looks like, segfault is happening after create_module() as it is returning proper value. -Madhu On Tue, 18 Feb 2003, David Wuertele wrote: > I'm trying to write a module that uses devfs, but when I "insmod" that > module, I get a Segmentation Fault in create_module(). When I run a > program that just does a create_module() by itself, it does not > segfault. > > I've appended a strace for insmod as well as attached the source for > the module. The "query_module() = -1 ENOSPC (No space left on > device)" seems like it might be a clue... > > Dave > > # strace insmod ./loopie.o > execve("/sbin/insmod", ["insmod", "./loopie.o"], [/* 18 vars */]) = 0 > uname({sys="Linux", node="ati-stw", ...}) = 0 > brk(0) = 0x1000dea0 > open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) > open("/etc/ld.so.cache", O_RDONLY) = 3 > fstat64(3, {st_mode=S_IFREG|0644, st_size=4400, ...}) = 0 > mmap(NULL, 4400, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2aac2000 > close(3) = 0 > open("/lib/libc.so.6", O_RDONLY) = 3 > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\334\223"..., 1024) = 1024 > fstat64(3, {st_mode=S_IFREG|0755, st_size=5560392, ...}) = 0 > mmap(NULL, 1703952, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x2ab03000 > mprotect(0x2ac58000, 307216, PROT_NONE) = 0 > mmap(0x2ac97000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x154000) = 0x2ac97000 > mmap(0x2ac9f000, 16400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2ac9f000 > close(3) = 0 > munmap(0x2aac2000, 4400) = 0 > stat("./loopie.o", {st_mode=S_IFREG|0664, st_size=104516, ...}) = 0 > brk(0) = 0x1000dea0 > brk(0x1000e030) = 0x1000e030 > brk(0x1000f000) = 0x1000f000 > open("./loopie.o", O_RDONLY) = 3 > fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0 > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aac2000 > write(1, "Using ./loopie.o\n", 17Using ./loopie.o > ) = 17 > fstat64(3, {st_mode=S_IFREG|0664, st_size=104516, ...}) = 0 > mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aac3000 > _llseek(3, 0, [0], SEEK_SET) = 0 > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\10\0\1\0\0\0\0\0\0"..., 4096) = 4096 > _llseek(3, 98304, [98304], SEEK_SET) = 0 > read(3, "e private_data in the filp?\n\0\0\0\0"..., 4096) = 4096 > _llseek(3, 0, [0], SEEK_SET) = 0 > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\10\0\1\0\0\0\0\0\0"..., 4096) = 4096 > brk(0x10010000) = 0x10010000 > _llseek(3, 98304, [98304], SEEK_SET) = 0 > read(3, "e private_data in the filp?\n\0\0\0\0"..., 4096) = 4096 > read(3, "\5\4\0\0x\1\0\0\6\4\0\0|\1\0\0\5*\0\0\200\1\0\0\6*\0\0"..., 4096) = 2116 > _llseek(3, 0, [0], SEEK_SET) = 0 > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\10\0\1\0\0\0\0\0\0"..., 4096) = 4096 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > read(3, "\5\4\0\0x\1\0\0\6\4\0\0|\1\0\0\5*\0\0\200\1\0\0\6*\0\0"..., 4096) = 2116 > _llseek(3, 0, [0], SEEK_SET) = 0 > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\10\0\1\0\0\0\0\0\0"..., 4096) = 4096 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > read(3, "\5\4\0\0x\1\0\0\6\4\0\0|\1\0\0\5*\0\0\200\1\0\0\6*\0\0"..., 4096) = 2116 > _llseek(3, 104516, [104516], SEEK_SET) = 0 > _llseek(3, 104516, [104516], SEEK_SET) = 0 > _llseek(3, 94208, [94208], SEEK_SET) = 0 > read(3, "\0\0\0*input_fops\0\0016\316\33\0\0\5\3\4\0\0\0*outp"..., 4096) = 4096 > brk(0x10011000) = 0x10011000 > _llseek(3, 98304, [98304], SEEK_SET) = 0 > read(3, "e private_data in the filp?\n\0\0\0\0"..., 4096) = 4096 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > read(3, "\5\4\0\0x\1\0\0\6\4\0\0|\1\0\0\5*\0\0\200\1\0\0\6*\0\0"..., 4096) = 2116 > _llseek(3, 98304, [98304], SEEK_SET) = 0 > read(3, "e private_data in the filp?\n\0\0\0\0"..., 4096) = 4096 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > read(3, "\5\4\0\0x\1\0\0\6\4\0\0|\1\0\0\5*\0\0\200\1\0\0\6*\0\0"..., 4096) = 2116 > _llseek(3, 104516, [104516], SEEK_SET) = 0 > _llseek(3, 104516, [104516], SEEK_SET) = 0 > _llseek(3, 104516, [104516], SEEK_SET) = 0 > _llseek(3, 98304, [98304], SEEK_SET) = 0 > read(3, "e private_data in the filp?\n\0\0\0\0"..., 4096) = 4096 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > _llseek(3, 102400, [102400], SEEK_SET) = 0 > brk(0x10012000) = 0x10012000 > uname({sys="Linux", node="ati-stw", ...}) = 0 > query_module(NULL, 0, NULL, 0) = 0 > query_module(NULL, QM_MODULES, { /* 1 entries */ }, 1) = 0 > query_module("dummy", QM_INFO, {address=0xc0004000, size=3000, flags=MOD_UNINITIALIZED, usecount=0}, 16) = 0 > query_module("dummy", QM_SYMBOLS, { /* 0 entries */ }, 0) = 0 > brk(0x10017000) = 0x10017000 > query_module(NULL, QM_SYMBOLS, 0x10011b28, 16384, 29695) = -1 ENOSPC (No space left on device) > brk(0x1001f000) = 0x1001f000 > query_module(NULL, QM_SYMBOLS, { /* 1255 entries */ }, 1255) = 0 > create_module("loopie", 2768) = 0xc0002000 > --- SIGSEGV (Segmentation fault) --- > +++ killed by SIGSEGV +++ > [root@ati-stw /]# > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/