* [RFC] UML/x86_64 module loader
@ 2011-08-22 21:38 Richard Weinberger
2011-08-23 3:52 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Richard Weinberger @ 2011-08-22 21:38 UTC (permalink / raw)
To: linux-kernel
Cc: x86, rostedt, jbaron, akpm, rusty, vapier, user-mode-linux-devel
Hi!
UserModeLinux is using the arch specific module functions from
arch/x86/kernel/module.c.
On i386 this works perfectly fine but on x86_64 it causes problems.
apply_relocate_add() assumes modules compiled with -mcmodel=kernel
because the kernel lives in the negative 2GiB of the address space.
This assumption is not true for UML.
On an UML instance with more than 512MiB of memory no modules can be
loaded because vmalloc() locates the module near the 2GiB limit and the
ELF relocations causes an overflow. (Detected by "if ((s64)val != *(s32
*)loc)" in apply_relocate_add()).
Now I'm not sure how to fix this.
Mostly because I'm not a module loader nor an ELF expert. 8-)
Is there an easy way to adjust the current x86_64 module loader to deal
with UML "positive" relocations?
Thanks,
//richard
P.s: Just removing the overflow-check does not fix the problem. ;-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] UML/x86_64 module loader
2011-08-22 21:38 [RFC] UML/x86_64 module loader Richard Weinberger
@ 2011-08-23 3:52 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2011-08-23 3:52 UTC (permalink / raw)
To: Richard Weinberger, linux-kernel
Cc: x86, rostedt, jbaron, akpm, vapier, user-mode-linux-devel
On Mon, 22 Aug 2011 23:38:43 +0200, Richard Weinberger <richard@nod.at> wrote:
> Hi!
>
> UserModeLinux is using the arch specific module functions from
> arch/x86/kernel/module.c.
> On i386 this works perfectly fine but on x86_64 it causes problems.
>
> apply_relocate_add() assumes modules compiled with -mcmodel=kernel
> because the kernel lives in the negative 2GiB of the address space.
> This assumption is not true for UML.
> On an UML instance with more than 512MiB of memory no modules can be
> loaded because vmalloc() locates the module near the 2GiB limit and the
> ELF relocations causes an overflow. (Detected by "if ((s64)val != *(s32
> *)loc)" in apply_relocate_add()).
>
> Now I'm not sure how to fix this.
> Mostly because I'm not a module loader nor an ELF expert. 8-)
I think you need to write your own routines. It shouldn't be that hard,
just keep implementing relocations until you're done :)
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-23 3:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-22 21:38 [RFC] UML/x86_64 module loader Richard Weinberger
2011-08-23 3:52 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox