Re: [tip:x86/urgent] x86/vdso: Discard the __bug_table section

From: Andy Lutomirski
Date: Sun Jun 22 2014 - 13:00:16 EST


On Sun, Jun 22, 2014 at 1:47 AM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> * tip-bot for Andy Lutomirski <tipbot@xxxxxxxxx> wrote:
>
>> Commit-ID: 5f56e7167e6d438324fcba87018255d81e201383
>> Gitweb: http://git.kernel.org/tip/5f56e7167e6d438324fcba87018255d81e201383
>> Author: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
>> AuthorDate: Wed, 18 Jun 2014 15:59:46 -0700
>> Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
>> CommitDate: Thu, 19 Jun 2014 15:44:51 -0700
>>
>> x86/vdso: Discard the __bug_table section
>>
>> It serves no purpose in user code.
>>
>> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
>> Link: http://lkml.kernel.org/r/2a5bebff42defd8a5e81d96f7dc00f21143c80e8.1403129369.git.luto@xxxxxxxxxxxxxx
>> Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
>> ---
>> arch/x86/vdso/vdso-layout.lds.S | 1 +
>> 1 file changed, 1 insertion(+)
>
> One of the recent x86/urgent vdso commits causes this build failure:
>
> Error: too many copied sections (max = 13)

I can't reproduce this with your config, which suggestes a binutils
issue, which is annoying. Can you tell me what version of ld you're
using and send me the output of:

for i in arch/x86/vdso/*.so.dbg; do echo $i; eu-readelf -S $i; done

To summarize, the issue is that, in 3.16, the vvar area is accessed in
a PC-relative manner from the vdso code. So we have:

vdso page 1 | vdso page 2 | vvar page 1 | vvar page 2 (where the
number of vdso pages can vary)

The difficulty comes from the fact that a decent amount of userspace
code wants the vdso to have some section headers, and linkers don't
stick section headers into allocatable sections, since section headers
were never intended to be memory mapped. So there's a risk that the
section headers dangle off the last loadable page in the vdso, at
which point they overlap the vvar area. I've seen this happen.

The "solution" in tip is to move the section headers into a real
allocatable area reserved for that purpose. The error you're seeing
is that I didn't allocate enough space for all the allocatable section
headers.

This crap almost makes me want to go back to something closer to
Stefani's implementation of sticking vvar before the vdso so we can
safely leave non-allocatable crap dangling off the end of the vdso. I
don't really want to play section header whack-a-mole. We could also
just give up on space efficiency and allocate space for several extra
section headers (and their associated names!).

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/