Re: vdso feature requests from the Go people

From: H. Peter Anvin
Date: Fri Jun 13 2014 - 12:03:21 EST


On 06/13/2014 08:34 AM, Andy Lutomirski wrote:
>
> I'm only aware of two implementations that work like that: glibc and
> musl. AFAIK neither one even tries to use the vdso when statically
> linked. IIRC, Bionic doesn't support the vdso at all, and Go has the
> present issue.
>

I would expect uClibc to behave similarly. Bionic does, indeed, not
support the vdso, but that is not for the lack of a linker but is really
a shortcoming in Bionic.

> And ELF parsing is a giant mess. Currently the vdso doesn't use
> DT_GNU_HASH (easy to fix) but no one can safely rely on DT_GNU_HASH
> being there, and DT_GNU_HASH isn't actually easier to parse.

Right... and the vdso is small enough that the performance doesn't
matter. However, we probably *ought* to publish DT_GNU_HASH data.

>>> 2. Go uses a segmented stack, and the vdso is quite unfriendly for
>>> segmented stack. If we can get compiler support, is there a
>>> reasonable way that we could advertise the maximum stack usage of each
>>> vdso entry point?
>>
>> I suspect an easier way to do that would just be to define a maximum
>> stack usage for *any* vdso entry point, and then enable the gcc stack
>> depth warning (perhaps even with Werror)... we can do this now.
>
> I can imagine this causing lots of pain when gcc 4.11 comes out with
> some issue that blows up the stack usage. Or when akpm compiles on
> Fedora Core 6 using some ancient toolchain that spills every local
> variable three or four times and assigns every possible inline
> function its own non-overlapping stack range.
>
> My copy of gcc supports -fstack-usage, which seems like an easyish way
> to obtain the information. I'm not entirely sure whether
> -fstack-usage refers to the whole call tree or just to the specific
> function.

There are issues either way. However, most vdso code doesn't use much
stack at all, and it seems reasonable to put a (conservative) cap on it
as a matter of policy.

-hpa


--
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/