lkml.org 
[lkml]   [1996]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectSolution: Modules under 2.1.0
After 3 hours of lookin around what is wrong with insmod ... here is my 
small solution. Insmod is backward-compatible. I changed the
parameterlist for sys_create_module because an unsigned long > MAX_INT is
treated as en error for libc or whoever. SO it's a bad idea to take the
return value. Besides that everything is ok for my config.
See at bottom. The only thing is
*** Unresolved symbols in module /lib/modules/2.1.0/scsi/scsi_mod.o
And here are the really small patches (binfmt.aout is working, too).

So long,
keep on hacking,

Harald

P.S.: But I think Linus will take his own solution for messin around with
it... :-( (I would be so lucky to see a piece of code from mine in the
kernel :)

------------------------------------------SNIP----------------------------
--- modules-2.0.0/insmod/insmod.c.old Mon Jun 10 10:42:25 1996
+++ modules-2.0.0/insmod/insmod.c Thu Sep 26 07:53:48 1996
@@ -125,9 +125,12 @@
return p;
}

-static int create_module(const char *name, unsigned long size)
+static unsigned long create_module(const char *name, unsigned long size)
{
- return syscall( __NR_create_module, name, size);
+ unsigned long addr, old;
+ old = syscall( __NR_create_module, name, size, &addr);
+ if(old) return old;
+ else return addr;
}
--------------------------------------------SNIP--------------------------
--- linux/kernel/module.c.old Thu Sep 26 08:11:52 1996
+++ linux/kernel/module.c Thu Sep 26 08:12:22 1996
@@ -78,7 +78,7 @@
* Allocate space for a module.
*/
asmlinkage unsigned long
-sys_create_module(char *module_name, unsigned long size)
+sys_create_module(char *module_name, unsigned long size, unsigned long *uaddr)
{
struct module *mp;
void* addr;
@@ -96,6 +96,9 @@
if (find_module(name) != NULL) {
return -EEXIST;
}
+
+ if(error = verify_area(VERIFY_WRITE, uaddr, sizeof(unsigned long)))
+ return error;

if ((mp = (struct module*) kmalloc(sspace, GFP_KERNEL)) == NULL) {
return -ENOMEM;
@@ -122,7 +125,9 @@

pr_debug("module `%s' (%lu pages @ 0x%08lx) created\n",
mp->name, (unsigned long) mp->size, (unsigned long) mp->addr);
- return (unsigned long) addr;
+
+ put_user((unsigned long)addr, uaddr);
+ return 0;
}

/*
-------------------------------------------SNIP----------------------
Pentium 90 powered up to 100MHz with 32MB Ram, ne2000 and sbawe32.
CONFIG_EXPERIMENTAL=y
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KERNELD=y
CONFIG_NET=y
CONFIG_PCI=y
CONFIG_SYSVIPC=y
CONFIG_BINFMT_AOUT=m
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_JAVA=m
CONFIG_KERNEL_ELF=y
CONFIG_M586=y
CONFIG_M586_COPY=y
CONFIG_BLK_DEV_FD=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_BLK_DEV_TRITON=y
CONFIG_BLK_DEV_RAM=y
CONFIG_FIREWALL=y
CONFIG_INET=y
CONFIG_IP_FORWARD=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_FIREWALL=y
CONFIG_IP_MASQUERADE=y
CONFIG_IP_ALWAYS_DEFRAG=y
CONFIG_IP_NOSR=y
CONFIG_SKB_LARGE=y
CONFIG_SCSI=m
CONFIG_BLK_DEV_SD=m
CONFIG_CHR_DEV_SG=m
CONFIG_SCSI_PPA=m
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
CONFIG_PPP=m
CONFIG_SLIP=m
CONFIG_SLIP_COMPRESSED=y
CONFIG_NET_ETHERNET=y
CONFIG_NET_ISA=y
CONFIG_NE2000=y
CONFIG_MINIX_FS=y
CONFIG_EXT2_FS=y
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_PROC_FS=y
CONFIG_NFS_FS=y
CONFIG_ISO9660_FS=m
CONFIG_SERIAL=y
CONFIG_PRINTER=m
CONFIG_SOUND=m
CONFIG_SB=y
CONFIG_ADLIB=y
CONFIG_AUDIO=y
CONFIG_MIDI=y
CONFIG_YM3812=y
SBC_BASE=220
SBC_IRQ=5
SBC_DMA=1
SB_DMA2=5
SB_MPU_BASE=330
SB_MPU_IRQ=-1
DSP_BUFFSIZE=65536
--------------------------------------------------------
Harald Hoyer Software Beratung, Erstellung und Vertrieb
EMAIL: saturn@studbox.uni-stuttgart.de
WWW : http://wwwcip.rus.uni-stuttgart.de/~etk10226/


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.034 / U:1.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site