[OE-core] pseudo: host user contamination

Andre McCurdy armccurdy at gmail.com
Tue Mar 27 20:52:28 UTC 2018


On Tue, Mar 27, 2018 at 1:20 PM, Seebs <seebs at seebs.net> wrote:
>
> My concern is that, strictly speaking, this is nearly all undefined
> behavior, and that reading more arguments than you were passed *does*
> explode on some C implementations.

Can you give some examples?

For every architecture I'm aware of that supports Linux, reading more
arguments is going to mean reading more data out of the stack. It's
not going "explode" until you read far enough to reach beyond the
start of the stack. What other failure modes are there?

> I'm trying to minimize assumptions that *could in principle* affect
> portability, such as "it's safe to grab an arbitrary pool of arguments
> with va_arg", or "it's safe to grab arguments with va_arg using
> different parameter types than were used to store them".

ALL of the implementations of libc syscall() I've looked at in both
glibc and musl do BOTH of these things - either explicitly in C code
or effectively the same thing in assembler.

By trying to avoid them in a wrapper, you are holding yourself to a
higher standard than any of the underlying syscall() implementations.



More information about the Openembedded-core mailing list