Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Seebs <seebs@seebs.net>
To: Andre McCurdy <armccurdy@gmail.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: pseudo: host user contamination
Date: Tue, 27 Mar 2018 15:20:26 -0500	[thread overview]
Message-ID: <20180327152026.335b4c2d@seebsdell> (raw)
In-Reply-To: <CAJ86T=V=b2jsSuVEicQbbgrax+8iV7HV0B=cKWDaejLq-Dh2eQ@mail.gmail.com>

On Tue, 27 Mar 2018 13:12:19 -0700
Andre McCurdy <armccurdy@gmail.com> wrote:

> If you mean forwarding arguments through a wrapper without
> interpreting them then I don't know what your concern is. Forwarding
> arguments can be handled completely generically - for any architecture
> and any syscall. See the musl implementation.

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. Possibly none of the ones musl is
targeting.

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". Because
assumptions like those periodically break when, for some inexplicable
reason, someone ports to an architecture that isn't a VAX 11/780.

We're already stuck with "duplicating library functions" as a risk.
But so far, I don't think I have any code which is manipulating
arguments in a way that violates the spec. Adding such code creates
an additional risk, however small that risk may be in practice right
now.

> However the good news is that code in a syscall() wrapper doesn't need
> to be any *more* aware of argument ordering than the C code calling
> syscall(). In this particular case, if the code in gnulib calling
> syscall(SYS_renameat2, ...) doesn't do anything architecture specific
> then either it's not needed (and therefore also not needed in a
> syscall() wrapper which wants interpret renameat2 syscalls) or there's
> a portability bug in gnulib. ie there is no case where architecture
> specific awareness is required in a syscall() wrapper but not in the
> original C code which calls syscall().

Yes.

Right now, I think my inclination is to make a renameat2() wrapper
which fails. We did that for renameat() originally, and it was years
before it actually came up, and I think it's premature to attempt the
wrapper at a time when I *can't* write test code which compares it to
the behavior of libc.

-s


  reply	other threads:[~2018-03-27 20:20 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 15:33 pseudo: host user contamination Enrico Scholz
2018-03-23 15:43 ` Enrico Scholz
2018-03-23 16:05   ` Burton, Ross
2018-03-23 16:10     ` Enrico Scholz
2018-03-23 16:17       ` Burton, Ross
2018-03-23 16:28       ` Seebs
2018-03-23 16:30         ` Burton, Ross
2018-03-23 16:49           ` Seebs
2018-03-23 16:56             ` Burton, Ross
2018-03-23 17:23               ` Seebs
2018-03-23 23:47             ` Richard Purdie
2018-03-23 23:56               ` Seebs
2018-03-24  0:22                 ` Enrico Scholz
2018-03-24  0:33                 ` Andre McCurdy
2018-03-24  0:36                   ` Seebs
2018-03-24  1:10                     ` Andre McCurdy
2018-03-24  1:17                       ` Seebs
2018-03-24  1:43                         ` Andre McCurdy
2018-03-24  2:44                           ` Seebs
2018-03-24 12:36                 ` Richard Purdie
2018-03-24 15:12                   ` Seebs
2018-03-24 17:10                   ` Burton, Ross
2018-03-24 17:23                     ` Seebs
2018-03-24 18:12                       ` Andre McCurdy
2018-03-24 18:22                         ` Seebs
2018-03-24 18:59                           ` Andre McCurdy
2018-03-24 19:24                             ` Seebs
2018-03-24 19:42                               ` Andre McCurdy
2018-03-24 19:50                                 ` Seebs
2018-03-24 20:12                                   ` Victor Kamensky
2018-03-24 23:04                                     ` Burton, Ross
2018-03-25  0:09                                       ` Victor Kamensky
2018-03-25  2:43                                         ` Andre McCurdy
2018-03-25  5:37                                           ` Victor Kamensky
2018-03-25  7:05                                             ` Andre McCurdy
2018-03-26 18:49                                               ` Andreas Müller
2018-03-26 19:31                                                 ` Seebs
2018-03-26 20:12                                                   ` Andre McCurdy
2018-03-26 21:07                                                     ` Seebs
2018-03-27  1:10                                                       ` Andre McCurdy
2018-03-27  1:32                                                         ` Seebs
2018-03-27  1:34                                                           ` Andre McCurdy
2018-03-27  2:07                                                             ` Seebs
2018-03-27  2:59                                                               ` Andre McCurdy
2018-03-27  4:41                                                                 ` Seebs
2018-03-27 19:11                                                                   ` Andre McCurdy
2018-03-27 19:22                                                                     ` Seebs
2018-03-27 20:12                                                                       ` Andre McCurdy
2018-03-27 20:20                                                                         ` Seebs [this message]
2018-03-27 20:52                                                                           ` Andre McCurdy
2018-03-27 21:10                                                                             ` Seebs
2018-03-29 12:04                                                                               ` Enrico Scholz
2018-03-29 14:06                                                                                 ` Seebs
2018-03-27 13:06                                                     ` Enrico Scholz
2018-03-27 15:50                                                       ` Seebs
2018-03-27 16:26                                                         ` Enrico Scholz
2018-03-27 16:46                                                           ` Seebs
2018-03-24 20:22                                   ` Joshua Watt
2018-03-24 21:01                                     ` Seebs
2018-03-24 20:27                                   ` Andre McCurdy
2018-03-27 14:42         ` Enrico Scholz
2018-03-27 15:55           ` Seebs
2018-03-27 16:35             ` Enrico Scholz
2018-03-27 16:40               ` Seebs
2018-03-27 19:20                 ` Enrico Scholz
2018-03-27 19:24                   ` Seebs
2018-03-27 20:06                     ` Enrico Scholz
2018-03-23 16:06 ` Burton, Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180327152026.335b4c2d@seebsdell \
    --to=seebs@seebs.net \
    --cc=armccurdy@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox