aboutsummaryrefslogtreecommitdiffstats
path: root/ports/linux/pseudo_wrappers.c
AgeCommit message (Collapse)Author
2021-05-18wrappers: Avoid -Wcast-function-type warningPhilip Lorenz
GCC emits this warning for mismatched function types unless the generic void (*) (void) signature is used ([1]) - e.g.: warning: cast between incompatible function types from ‘int (*)(const char *)’ to ‘int (*)(void)’ [-Wcast-function-type] [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type Signed-off-by: Philip Lorenz <philip@bithub.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-26Pseudo changes the syscall access patterns which makes it incompatible withRichard Purdie
seccomp. Therefore intercept the seccomp syscall and alter it, pretending that seccomp was setup when in fact we do nothing. If we error as unsupported, utilities like file will exit with errors so we can't just disable it. Also, it fails to compile pseudo-native on centos 7: | ports/linux/pseudo_wrappers.c: In function ‘prctl’: | ports/linux/pseudo_wrappers.c:129:14: error: ‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function) | if (cmd == SECCOMP_SET_MODE_FILTER) { | ^ Add macro guard for seccomp to avoid the failure. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-15Add SPDX-License-Identifier: LGPL-2.1-only to filesRichard Purdie
This adds SPDX license headers to all source files in pseudo so license identification models current best practise. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-31initialize wrappers in syscall wrapperSeebs
But what if syscall(2) was the *first* function with a wrapper that you called? Also reduced amount of argument-copying in syscall(2), on further study, anything with off_t arguments has less than 6 arguments by enough to keep the total argument count down. Signed-off-by: Seebs <seebs@seebs.net>
2018-03-29Experimental syscall(2) wrapper.Seebs
This wrapper should allow us to reject renameat2 attempts by coreutils, letting us regain functionality on FC27 and related systems. This is not safe/portable/etc even by pseudo's standards, and arguably it should be a separate and optional port. [Amended commit: Don't include the dodgy renameat2 wrapper which it turns out we'd never hit anyway.] Signed-off-by: Seebs <seebs@seebs.net>
2016-12-12The setcap utility supplied by libcap is used to set capabilities on aSeebs
file. Before setting a file's capabilities with cap_set_file() (which uses setxattr()) it calls cap_set_flag(mycaps, CAP_EFFECTIVE, 1, &capflag, CAP_SET). cap_set_flag() uses the capset syscall to raise the process' effective capability. In most cases if the process isn't running as root this will fail and setcap will exit with an error. Because setxattr is intercepted by pseudo it's unnecessary for setcap to call capset(). Override capset with a pseudo function that does nothing and always returns 0. Signed-off-by: George McCollister <george.mccollister at gmail.com> Signed-off-by: Seebs <seebs@seebs.net>
2016-05-18better handling of missing real_foo functionsPeter Seebach
So a recent change to ld.so behavior revealed that pseudo was not always correctly detecting that a function hadn't been found by the RTLD_NEXT search. This only happened for functions which genuinely didn't exist and wouldn't get called (like mknod on Linux, which is actually always done as an inline function that calls __xmknod), but when the diagnostics started showing up, it broke things. Fix it so the diagnostics would have shown up when things were originally broken, also fix the resulting diagnostics. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2012-08-09Fix up chroot damage caused by PSEUDO_STATBUF fixpseudo-1.4.1PSEUDO_1_4_1Peter Seebach
The PSEUDO_STATBUF change (allowing operations on files over 2GB even on 32-bit systems) introduced a subtle bug; by calling stat64() rather than real_stat(), pseudo stopped handling chrooted paths well. In most cases, this was fine, but in the specific case of a rename, where the stat buffers for the various parts were actually used, it wasn't. Of particular note, pseudo could end up creating links which had stack garbage for their stat buffs, because it assumed that if the rename operation succeeded, the stat operations must have succeeded. Of course, there is no real_stat64 in the Linux port, because there's no need for it; most code is calling __xstat64 or some relative thereof, and even if you did really call stat64, it'd end up routed there anyway. So we add that so that it can be used for calls and we don't have to encode Linux-specific magic about __xstat into the generic header.
2011-03-25Merge in ports workPeter Seebach
This is a spiffied-up rebase of a bunch of intermediate changes, presented as a whole because it is, surprisingly, less confusing that way. The basic idea is to separate the guts code into categories ranging from generic stuff that can be the same everywhere and specific variants. The big scary one is the Darwin support, which actually seems to run okay on 64-bit OS X 10.6. (No other variants were tested.) The other example given is support for the old clone() syscall on RHEL 4, which affects some wrlinux use cases. There's a few minor cleanup bits here, such as a function with inconsistent calling conventions, but nothing really exciting.