Re: [PATCH] um: Fix overlapping ELF segments when statically linked

From: Richard Weinberger
Date: Sun Mar 29 2020 - 17:39:21 EST


On Tue, Mar 10, 2020 at 10:24 PM Brendan Higgins
<brendanhiggins@xxxxxxxxxx> wrote:
>
> On Thu, Mar 5, 2020 at 10:39 AM David Gow <davidgow@xxxxxxxxxx> wrote:
> >
> > When statically linked, the .text section in UML kernels is not page
> > aligned, causing it to share a page with the executable headers. As
> > .text and the executable headers have different permissions, this causes
> > the kernel to wish to map the same page twice (once as headers with r--
> > permissions, once as .text with r-x permissions), causing a segfault,
> > and a nasty message printed to the host kernel's dmesg:
> >
> > "Uhuuh, elf segment at 0000000060000000 requested but the memory is
> > mapped already"
> >
> > By aligning the .text to a page boundary (as in the dynamically linked
> > version in dyn.lds.S), there is no such overlap, and the kernel runs
> > correctly.
> >
> > Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
>
> I can confirm that I am seeing this problem as well. (I know we run
> the same Linux distro; nevertheless, this is a real problem for some
> population of users.)
>
> Reviewed-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>

Applied, thanks!

--
Thanks,
//richard