11. Insmod Patch

This section was written when there was a problem. I belive that this problem has been fixed and shall delete this soon. If you don't have a problem, don't do this!

This section is only for people with older CDROM's which were snapshot at an unfortunate time, and passed to you from a friend.

You should fetch the latest stable kernel and modutils, but if you don't have FTP access, and wish to use the CDROM's that you do have, here's how. NB libc is also involved so get it.

Remember even numbers are supposed to be stable (2.0) odd numbers are development (2.1). (( So 1.2.13 is the latest release-1 version - but it does need the SYN patch and the patch for the ping-of-death ))

11.1 Linux-2.1
11.2 create_module: unknown error 1048453120
11.3 insmod patch-1
11.4 insmod patch-2

11.1

Linux-2.1

WARNING: Modules works fine with Linux-2.0 but not with 2.1. Apparently, the problem is in user space, not with the kernel, so you need a patch to insmod (ie kerneld or modules), -or- you need the patched libc-5.4.8++

I didn't have any problems with modules-2.1.13, so maybe soon I'll delete this section.

modules-1.3.69 works for some 2.0 kernels and may be on your CD, but need this patch.

11.2

create_module: unknown error 1048453120

Without the patch you get this error message. because the address is being used as the errno

create_module: unknown error 1048453120

or the module loads, but lsmod reports (uninitialised). That means that ne.o can't run on top of 8390.o so doesn't get loaded.

Note that Linux-2.1 is an odd numbered version, and is a development kernel. So you are supposed to expect experimental drivers, and new ideas breaking old ground.

I think that the problem is related to the 3 address types (Physical, Virtual, and PCI-ISA) described in /usr/src/linux/Documentation/IO-mapping.txt, and the new macros used to handle them.

I've tried two patches, and thanks to the patience of others, both worked! I did have a problem with me having the wrong /usr/src/linux link (picking up unistd.h from 2.0.16 not 2.1.1). That caused the new insmod to be compiled with the old syscall declarations.

NOTE: you only need ONE of the TWO patches. It is either or, not both! Also by the time you read this, things will have moved on, and this will all be history.

11.3

insmod patch-1

	addr = create_module(modname, progsize) + sizeof (int);

/* MANUALLY PATCHED (provided by Jeff Voskamp) */

       /* the preceding may fail since the address in the kernel space
          * may be greater than 2G. Then addr = -1 and errno = -(realaddr).
          * We'll check for that and correct.  Boy I hope errno and addr
          * are the same size.
          * Note: this means we can't use the last page in virtual memory.
          */
       if( errno > 4095 ) {
           addr = sizeof(int)-errno; /* reverse the math from create_module */
           errno = 0;
       }

/* END MANUALLY PATCHED */

	switch (errno) {
	case EEXIST:

11.4

insmod patch-2

I applied this patch manually by removing the create_module function declaration, and adding two function prototypes.

I really don't understand where the function is implemented, or how it links to the actual syscall, but the compiler seems to be happy.

This second patch looks better to me, as it works, rather than "fixing-up" a previous flaw. However, both work, and appeared just-in-time to save my sanity, over the Net.


/* Patch from Robin Becker, delete function (comment out) add two prototypes

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);

Don't forget to check the links on /usr/src/linux. Basically /usr/include has those symb-links that go through /usr/src/linux. If that is wrong, the wrong syscall definitions will be used.

I haven't (yet) tested whether the patched insmod runs with the older kernels, however it is reasonable for kernel specific things, like insmod to be kernel specific.

I applied the patch to pristine modules-2.0.0.tgz, with

make clean install