[Top] [All Lists]

Re: modutils bug? 'if' clause executes incorrectly

To: Cort Dougan <>, Keith Owens <>
Subject: Re: modutils bug? 'if' clause executes incorrectly
From: Ralf Baechle <>
Date: Fri, 13 Oct 2000 13:57:31 +0200
In-reply-to: <10267.971398664@ocs3.ocs-net>; from on Fri, Oct 13, 2000 at 11:57:44AM +1100
References: <> <10267.971398664@ocs3.ocs-net>

I think in your module the following jump gets misstreated:

  90:   0800002d        j       b4 <init_module+ac>
                        90: R_MIPS_26   .text

This one is is supposed to skip over the ``printk("A");'' code after
``printk("B");'', so it's the prime suspect.

And this is how current modutils correctly compute such a R_MIPS_26
relocation in obj/obj_mips.c:

      *loc = (*loc & ~0x03ffffff) | ((*loc + (v >> 2)) & 0x03ffffff);

But older modutils - including the modutils-2.1.121-12lm.src.rpm package
from oss - do this:

      *loc = (*loc & ~0x03ffffff) | ((*loc & 0x03ffffff) + (v >> 2));

which is different - and wrong.  This latter expression will for an
assumed load address of 0xc0000000 place 0x3800042d into *loc which
is ``xori $zero, $zero, 0x42d'', in other words a glorified nop resulting
in the printk("A") statement also getting executed.

So the fix should be either upgrading modutils or replacing above
expression in obj/obj_mips.c in your old version of modutils with the
correct one.


<Prev in Thread] Current Thread [Next in Thread>