Commit Graph

131 Commits

Author SHA1 Message Date
christos c1167da0aa Add pathconf and lpathconf (fixes lib/librumphijack/nfs test which uses ls
which now uses lpathconf)
2020-05-27 18:55:36 +00:00
kamil 418e457ef1 Change types of DUP2ALIAS and DUP2FDMASK bit masks to unsigned
This is for consistency with the DUP2BIT change.
2020-02-10 23:21:42 +00:00
kamil a6c4eb28f3 Avoid unportable bit shift semantics
hijack.c:451:52, left shift of 1 by 31 places cannot be represented in type 'int
2020-02-10 09:10:58 +00:00
christos ed9ca5deea teach hijack about the new vfs syscalls 2019-09-25 20:19:59 +00:00
bad c0bd86dc55 Linux doesn't have paccept(). 2019-02-17 23:35:50 +00:00
hannken 650b07c895 Add an option "modctl" to capture modctl(). 2018-12-16 14:03:37 +00:00
ozaki-r 79209cd2af rumphijack: don't modify a cmsg on just validating it
Pointed out by k-goda@IIJ
2018-06-28 06:20:36 +00:00
ozaki-r a9b3bb4d56 Provide better debug messages for ioctl 2017-10-23 06:52:17 +00:00
christos a3ddac400c since ln(1) now uses linkat(2) provide a dumb wrapper. 2017-06-06 19:48:42 +00:00
ozaki-r 44d072be9e Support paccept for nc 2017-02-16 08:08:01 +00:00
christos d10d9a2322 fix test lib/librumphijack/t_sh/runscript
(handle F_DUPFD_CLOEXEC that the shell is now using)
2016-12-02 20:53:36 +00:00
kre 1ec349e914 Object to dup2() if target fd is in the range of fd's that
librumphijack reserves for rump to use.

This is not normally a problem, as most applications don't attempt
to use very high fds - but /bin/sh does.

This fix is something of a kludge - really the apparent fd resource limit
ought to be lowered as well, but this is sufficient to allow the shell
to work (when its dup2() gets rejected, it just tries again with a smaller
target fd until it eventually succeeds.)   This fixes the librumphijack
shell ATF tests.

A better, more comprehensive, fix would be good...
2016-08-11 09:48:57 +00:00
pooka 1dfc153377 Remember that dlsym() tends to fail on PowerPC during init (or at least
tended), so call rumphijack_dlsym() instead to be safe.
2015-08-25 13:50:19 +00:00
pooka 4e9c298177 allow mmap() to be called before init runs 2015-08-25 13:45:00 +00:00
riastradh ee14e9e637 Define the expansion of the VFORK macro, not the symbol `VFORK'.
Fixes hijacking processes that vfork and exec.  Symptom was the child
would spin with read/EAGAIN <-> kevent/EBADF because the inheritance
mechanism relied on setting the holyfd to -1 on fork...which didn't
happen if we didn't hijack vfork.

ok pooka@
2015-04-11 12:54:41 +00:00
pooka 367e4a103c Wrap utimensat() only if present on host
fixes buildrump.sh on NetBSD 6.1.5
2015-03-05 00:26:17 +00:00
pooka 8ce52db1d0 Make ATCALL() behave for absolute paths too. 2015-03-04 23:42:26 +00:00
pooka 8651603956 Define a generic ATCALL() and use it to implement utimensat() 2015-03-04 23:31:49 +00:00
enami 02c2c060ff Also hijack futimens(2) so that t_sh test passes. 2015-03-03 01:24:39 +00:00
enami a4c990f5c2 Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are
changed to use the system call.  Linux also has this system call, but
not tested this on linux.
2015-03-03 00:19:07 +00:00
pooka 23dfcd7408 Use autoconf for rump kernel posix hypercall layer.
This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
2014-11-04 19:05:17 +00:00
pooka df2711f4e7 In case of no dup2'd fd's, make sure that F_CLOSEM for the
rump kernel starts from 0.

Fixes rumphijack fdoff test (notably, this bug had nothing to do with
fdoff, and was exposed >3 years after writing the test when rump kernels
started providing fd's 0/1/2)
2014-08-12 23:47:09 +00:00
gson 1c06c49918 Ignore the contents of revents when poll() returns failure.
This is one more part to the fix for PR kern/46464.  Patch
from pooka.
2014-07-21 14:23:43 +00:00
gson 6aaac7c3e2 Do not assert that the two threads do not simultanously notify each
other, because sometimes they do.  Should fix PR kern/46464.  OK pooka.
2014-07-19 14:14:21 +00:00
justin 95e41b89b5 Add Android support for rump kernel.
Reviewed by pooka@
2014-04-02 17:09:23 +00:00
pooka 0f188198a5 use <rump/rumpuser_port.h> 2013-09-10 16:53:06 +00:00
pooka 3fc5dcaa4f remove unnecessary <sys/poll.h> -- musl whines when it's included 2013-07-31 12:23:25 +00:00
pooka 2eebe6e2de Extend #undef _FORTIFY_SOURCE to both files to avoid compiler
warning for -O0 and fortify combination.

from Alessio Sergi via github
2013-07-27 17:37:29 +00:00
pooka 1b3ff08420 Support Linuxen where libc ioctl has cmd as int unstead of unsigned long. 2013-07-22 12:11:03 +00:00
pooka 40fd6d6fa3 Fixes when compiling against musl libc.
from Justin Cormack via private email
2013-07-20 18:46:15 +00:00
pooka a940e06527 sys/cdefs.h should come from rumpuser_port.h
Noticed by Justin Cormack while building against musl libc.
2013-07-18 22:58:35 +00:00
pooka f78e8a8efa * avoid problems if the platform calls readlink() from dlsym()
* alias __read_chk() to read() on Linux (technically, though,
  it should call host __read_chk() instead of read())
2012-10-16 12:56:10 +00:00
martin 550571fe00 When emulating poll/select better tell the events of the host kernel
apart from those received from the rump kernel. Also handle timeout.
Patch from pooka.
2012-09-12 10:35:10 +00:00
pooka bcc69e9323 one more patch for supporting linux-based networking clients 2012-09-03 12:07:42 +00:00
pooka 82e980c205 More fixes for Linux (or glibc, really). 2012-09-03 11:33:35 +00:00
pooka c62329f7d3 Make librumphijack compile and work on Linux. Do not try to hijack
calls which are not supported on Linux and therefore cannot be
handled by the rump kernel side syscall emulation (not that they'd
be present in the calling binaries anyway).
2012-08-25 18:00:06 +00:00
riastradh 16b71d29d9 Implement link(2) in rumphijack. Add a couple trivial test cases. 2012-08-04 03:56:47 +00:00
yamt b4228b70f2 implement descriptor passing. 2012-06-29 13:20:25 +00:00
abs 9e66e6d75e Update old-style definitions to ANSI, remove a couple of register
definitions along the way. Fixed gcc 4.1 build (thank you vax)
2012-06-25 22:32:43 +00:00
martin 91d93016c8 poll(), pollts() and select() all return int values, but in the hijack
emulation of them these get passed as exit values from a pthread as
a void* (c.f. pthread_join(), pthread_exit()).
Do not use the address of an int variable for these, but provide the address
of a void* and assign the value afterwards.
Fixes hijacking of pollts/select on 64bit big endian hosts.
Spotted by and fix from pooka.
2012-04-18 10:37:37 +00:00
dholland 59b296daa7 Change the syscall API for quotas over to the new non-proplib one.
- struct vfs_quotactl_args -> struct quotactl_args
   - add sys/stdint.h to sys/quotactl.h for clean userland build
   - install sys/quotactl.h in /usr/include
   - update set lists for same
   - add new marshalling code in libquota
   - add new unmarshalling code in vfs_syscalls.c
   - discard proplib interpreter code in vfs_quotactl.c
   - add dispatching code for the 14 quotactl ops in vfs_quotactl.c
   - mark the proplib quotactl syscall obsolete
   - add a new syscall number for the new quotactl syscall
   - change the name of the syscall to __quotactl()
   - remove the decl of the old quotactl from quota/quotaprop.h
   - add a decl of the new quotactl to sys/quotactl.h
   - update the libc build
   - update ktruss
   - remove proplib marshalling code from libquota
   - update copy of syscall table in gdb ppc sources
   - hack rumphijack to accomodate new quotactl name (as I recall,
     pooka wanted such a name change to simplify something, but I
     don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
2012-02-01 05:34:38 +00:00
joerg 77abb554dc Disable Fortification for pthread and rump stubs. 2011-04-21 13:38:14 +00:00
martin 211a501951 Backout previous, it breaks lots of tests (tests/lib/librumphijack for
example).
2011-04-21 08:21:13 +00:00
he b974c45b30 Move the forward declaration of _sys_readlink() outside of the #if,
so that the build succeeds even if _FORTIFY_SOURCE isn't > 0.
2011-04-13 12:40:54 +00:00
christos e6eca274ad Fix SSP builds (Vladimir Kirillov) 2011-04-12 19:49:48 +00:00
pooka e5eecf0660 fdoff is descriptive enough 2011-03-14 15:15:47 +00:00
pooka c9038b2d6c Make fdoffset configurable. Also, enforce that host descriptors
are smaller than the offset.
2011-03-14 15:13:26 +00:00
pooka 563593515e Use rumphijack_dlsym() to figure out where __sysctl() is during
init.  Otherwise powerpc dlsym() DTWT and returns NULL.
(now i have no idea why dlsym() it works from rcinit(), but i'll
opt to not care)

Hah, only took 15min to debug that crap this time around.  I'm
quickly approaching zero-time with it.
2011-03-10 23:02:56 +00:00
pooka 3406bd8660 Revert 1.81 and do it in a saner way with an ifdef. Later, when
the naming crisis is resolved, we can probably support rump kernel
quotas from nb5 also.
2011-03-10 09:47:32 +00:00
pooka 61f25f646e Make getfh() a pathcall instead of a fhcall. while it does pertain
to file handles, it still gets passed a path and we can DTRT based
on that.
2011-03-09 23:26:19 +00:00