[OE-core] pseudo: host user contamination

Seebs seebs at seebs.net
Tue Mar 27 16:40:14 UTC 2018


On Tue, 27 Mar 2018 18:35:32 +0200
Enrico Scholz <enrico.scholz at sigma-chemnitz.de> wrote:

> Does this really matter here?  Because the caller has to set them
> accordingly the ABI, you can extract the arguments by
> 
> 	int olddirfd        = va_arg(ap, int);
> 	char const *oldpath = va_arg(ap, char consr *);
> 	int newdirfd        = va_arg(ap, int);
> 	char const *newpath = va_arg(ap, char consr *);
>         unsigned int flags  = va_arg(ap, unsigned int);
> 
> There are no 64 bit arguments (on 32 bit platforms) which might
> require a special treatment as described in [1]
> "Architecture-specific requirements".

Okay, ignore the pointer case, and pretend it's the 64-bit value case,
since we have specific-ish documentation for that.

Look at the example for SYS_readahead, stating that the caller must
pass an extra value.

At that point, if you have a series of va_arg calls corresponding to
the values that would have been arguments had they not passed the extra
value, I don't think you get the expected arguments. So far as I can
tell, if the caller actually wrote
	varargsfunc(SYS_readahead, 0, uint64_t_value, ...)
and the function did
	va_arg(ap, uint64_t);
they would not get the value passed as the third argument, because the
calls to va_arg don't match the arguments passed.

If you could just ignore this, the SYS_readahead example wouldn't have
to exist; you could just follow the ABI and provide a 64-bit value.

-s



More information about the Openembedded-core mailing list