RE: mod->init out of bounds?

From: Ralston, Steve (
Date: Wed Aug 02 2000 - 12:51:19 EST

Oh dear. Guess I'll have to solely respond to my own post.
The module in question for which I'm getting mod->init out of bounds
has only init_module() and module_cleanup() functions.

On intel platforms the out of bounds check in kernel/module.c:

#define bound(p, n, m)  ((unsigned long)(p) >= (unsigned long)(m+1) &&  \
                 (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size)
	if (mod->init && !bound(mod->init, 0, mod)) {
		printk(KERN_ERR "init_module: mod->init out of bounds.\n");
		goto err2;
fails because: (given sizeof(struct module) is 0x54 bytes)
    (m) mod == 0xc8828000
    (p) mod->init == 0xc8828050
therefore, mod->init >= (mod + 1) is FALSE (0xc8828050 >= 0xc8828054)

As for a proper fix; I'm not sure as I don't exactly understand the logic behind the "mod->init >= (mod + 1)" check.

BTW: Difference in sizeof(struct module) on sparc64 (plus other factors?) results in same module loading fine there.

Thanks, -SteveR

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Aug 07 2000 - 21:00:09 EST