aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libsbutil: add sb_exists functionMike Gilbert2023-06-211-1/+1
| | | | | | | | | This provides a central place to work around a bug on musl where faccessat sets errno to EINVAL when the kernel does not support faccessat2. Bug: https://bugs.gentoo.org/908765 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* libsandbox/libsbutil: use faccessat for file-existence testsMike Frysinger2021-11-051-12/+3
| | | | | | | | This is faster than using stat since it doesn't have to gather all the metadata, and should avoid LFS issues as a result. Bug: https://bugs.gentoo.org/583282 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* libsandbox: hoist the *at pre-check functions up a levelMike Frysinger2021-10-281-0/+39
The reason we put these in wrapper-funcs/ is because we normally dynamically include them when the corresponding symbol is available. For example, if the C library supports symbol foo, and there is a wrapper-funcs/foo_pre_check.c, we'll automatically include it based on the assumption that wrapper-funcs/foo.c needs it. But if the C library doesn't have a symbol foo, we won't include foo.c or the foo_pre_check.c file at all. Sounds fine. The *at family of functions is a bit different because we end up using them both in the wrapper-funcs/ files, and in the trace code, the latter of which we use unconditionally. This lead to a build issue early on (see commit b27df46f349e850067ae388fe067b043abf3aecb ("libsandbox: fix missing *at pre_checks")) whereby we hacked in these *at pre-check symbols all the time. At which point, having them be in wrapper-funcs/ was more out of convention with how we manage all our other APIs. We want to support running ptrace from the sandbox binary directly which requires linking (most of) libsandbox into it, and to that end, hoist these pre-check functions out of wrapper-funcs. This makes it a bit clearer that we always want to compile these. Signed-off-by: Mike Frysinger <vapier@gentoo.org>