LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Will smp alternative try to patch init text also?
@ 2007-02-14 10:43 Vivek Goyal
  2007-02-14 10:51 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Goyal @ 2007-02-14 10:43 UTC (permalink / raw)
  To: linux kernel mailing list; +Cc: kraxel, Andi Kleen

Hi,

I just built a 2.6.20 kernel with CONFIG_RELOCATABLE=y. While going
through relocation entries for .smp_locks section, I see some relocation
entries present w.r.t to init section also. Below I am pasting just
few of them.

Relocation section '.rel.smp_locks' at offset 0x6079c8 contains 4662 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
c058e000  00001201 R_386_32          c0593000   .init.text
c058e004  00001201 R_386_32          c0593000   .init.text
c058e008  00001201 R_386_32          c0593000   .init.text

So what happens if somebody builds a SMP kernel and runs on a UP machine.
Later it hotplus one CPU. Then kernel will switch to SMP mode. Looking
at the code it looks like it will also try to patch init text which is
no more there and will corrupt something else? 

Am I missing something?

MODPOST whitelists the references from .smp_locks section to .init.text,
hence these warnings are not displayed during compilation.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Will smp alternative try to patch init text also?
  2007-02-14 10:43 Will smp alternative try to patch init text also? Vivek Goyal
@ 2007-02-14 10:51 ` Gerd Hoffmann
  2007-02-14 11:12   ` Vivek Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2007-02-14 10:51 UTC (permalink / raw)
  To: vgoyal; +Cc: linux kernel mailing list, Andi Kleen

Vivek Goyal wrote:
> So what happens if somebody builds a SMP kernel and runs on a UP machine.
> Later it hotplus one CPU. Then kernel will switch to SMP mode. Looking
> at the code it looks like it will also try to patch init text which is
> no more there and will corrupt something else? 

There are range checks for both kernel (_text -> _etext) and modules
(.text section).  Anything outside isn't patched.

cheers,
  Gerd

-- 
Gerd Hoffmann <kraxel@suse.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Will smp alternative try to patch init text also?
  2007-02-14 10:51 ` Gerd Hoffmann
@ 2007-02-14 11:12   ` Vivek Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Vivek Goyal @ 2007-02-14 11:12 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: linux kernel mailing list, Andi Kleen

On Wed, Feb 14, 2007 at 11:51:31AM +0100, Gerd Hoffmann wrote:
> Vivek Goyal wrote:
> > So what happens if somebody builds a SMP kernel and runs on a UP machine.
> > Later it hotplus one CPU. Then kernel will switch to SMP mode. Looking
> > at the code it looks like it will also try to patch init text which is
> > no more there and will corrupt something else? 
> 
> There are range checks for both kernel (_text -> _etext) and modules
> (.text section).  Anything outside isn't patched.
> 

Oh... I missed that. Thanks.

Vivek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-14 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 10:43 Will smp alternative try to patch init text also? Vivek Goyal
2007-02-14 10:51 ` Gerd Hoffmann
2007-02-14 11:12   ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).