Messages in this thread Patches in this message |  | | Date | Tue, 24 Sep 1996 13:27:42 +0300 (IST) | From | Gadi Oxman <> | Subject | Re: test version of 2.1.0 available |
| |
Hi,
> > > On Tue, 24 Sep 1996, Richard Gooch wrote: > > > > I've just tried this, and get the following behaviour when I try to > > load a module (this happens for a variety of modules, not just one): > > > > # cd /lib/modules/2.1.0/net > > # insmod 3c509.o > > create_module: Unknown error 997978112 > > Ok, this is due to the silly library stub seemingly thinking that a large > positive value is in fact a error condition due to sign problems. > > That doesn't mean that the kernel is broken: there are other system calls > that return large numbers that might be thought of as negative even though > they aren't errors (just an example: mmap() can return addresses with the > high bit set, and always could). > > Instead of testing the sign bit, the low-level system call should > probably do something like this: > > ... do system call, return in %eax ... > movl %eax,%edx > addl $4095,%edx > jc error error if return was -1 .. -4095 > > Is somebody willing to fix up the module loader? > > Linus
Everything seems to work well after the above change and using _syscall2 directly in insmod.c (and the new kernel managed to catch a few NULL dereferencing in my 2.1.xx ide-tape driver which were previously hidden on a pentium.. :-)
Gadi
--- insmod.c.old Tue Sep 24 13:17:23 1996 +++ insmod.c Tue Sep 24 13:08:18 1996 @@ -125,10 +125,8 @@ return p; } -static int create_module(const char *name, unsigned long size) -{ - return syscall( __NR_create_module, name, size); -} +static int create_module(const char *name, unsigned long size); +static _syscall2( int, create_module, const char *, name, unsigned long, size); static int init_module(const char *name, void *code, unsigned codesize, struct mod_routines *routines,
----------------------------------------------------------------------------
--- v2.1.0/linux/include/asm-i386/unistd.h Fri Mar 22 09:34:02 1996 +++ linux/include/asm-i386/unistd.h Tue Sep 24 13:13:29 1996 @@ -178,7 +178,7 @@ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name)); \ -if (__res >= 0) \ +if (__res >= 0 || __res <= -4096) \ return (type) __res; \ errno = -__res; \ return -1; \ @@ -191,7 +191,7 @@ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1))); \ -if (__res >= 0) \ +if (__res >= 0 || __res <= -4096) \ return (type) __res; \ errno = -__res; \ return -1; \ @@ -204,7 +204,7 @@ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ -if (__res >= 0) \ +if (__res >= 0 || __res <= -4096) \ return (type) __res; \ errno = -__res; \ return -1; \ @@ -218,7 +218,7 @@ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3))); \ -if (__res>=0) \ +if (__res>=0 || __res <= -4096) \ return (type) __res; \ errno=-__res; \ return -1; \ @@ -232,7 +232,7 @@ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4))); \ -if (__res>=0) \ +if (__res>=0 || __res <= -4096) \ return (type) __res; \ errno=-__res; \ return -1; \ @@ -247,7 +247,7 @@ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ -if (__res>=0) \ +if (__res>=0 || __res <= -4096) \ return (type) __res; \ errno=-__res; \ return -1; \
|  |