[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] busybox insmod with uClibc is broken for pcmcia modules
From:       Larry Doolittle <ldoolitt () recycle ! lbl ! gov>
Date:       2001-04-26 19:17:11
[Download RAW message or body]

Regarding insmod, Michael volunteered:
> There were two problems, as I can remember: one that created some symbol
> in _ksymtab at index -1,

I haven't found that one yet.

> and another one is when adding symbols: there is a
> situation when symtab was with zero size, we scan all symbols
> whether we want to add them to symtab, and later ther was a
> call with xrealloc(size + new_syms). both were zero, so we end
> up with xrealloc(0).

That's easy to fix (I think), see appended patch.
I also added a sanity check before dereferencing a
couple of potential null pointers.

      - Larry

--- /home/ldoolitt/cvs/busybox/insmod.c	Wed Apr 25 14:21:42 2001
+++ insmod.c	Thu Apr 26 12:10:41 2001
@@ -1536,7 +1536,7 @@
 void *obj_extend_section(struct obj_section *sec, unsigned long more)
 {
 	unsigned long oldsize = sec->header.sh_size;
-	sec->contents = xrealloc(sec->contents, sec->header.sh_size += more);
+	if (more) sec->contents = xrealloc(sec->contents, sec->header.sh_size += more);
 	return sec->contents + oldsize;
 }
 
@@ -2474,6 +2474,7 @@
 	tgt_long m_addr;
 
 	sec = obj_find_section(f, ".this");
+	if (!sec || !sec->contents) perror_msg_and_die("corrupt module %s?",m_name);
 	module = (struct new_module *) sec->contents;
 	m_addr = sec->header.sh_addr;
 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic