Commit Graph

102 Commits

Author SHA1 Message Date
pooka 0dc6decc72 document fdoff 2011-03-14 15:21:22 +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
wiz 97b3b86219 Add serial commas. 2011-03-10 08:53:04 +00:00
pooka bbc64bd6b0 document vfs and sysctl knobs to RUMPHIJACK 2011-03-09 23:40:44 +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
pooka 9d51298cb8 Make this compile/work on NetBSD 5 once again. 2011-03-09 20:48:57 +00:00
bouyer 48c24921f2 Add quotactl(2) 2011-03-09 18:45:30 +00:00
bouyer 90848eb9f1 Fix last entries, make it work again. 2011-03-09 18:06:22 +00:00
pooka 1af2e3a0a3 Add a bunch of process-wide hijack calls. Among other things, it's
now possible to use unmodified userspace binaries (rpcbind, mountd,
nfsd) to start a rump nfs service and mount file systems from it.

pain-rustique:42:~> mount
rumpfs on / type rumpfs (local)
10.1.1.1:/export on /mnt type nfs
2011-03-09 15:03:18 +00:00
pooka a30ace437f g/c unused global 2011-03-09 09:17:12 +00:00
wiz 3bc5f349f0 Remove trailing whitespace. 2011-03-08 23:51:23 +00:00
pooka 7a2f6e5362 Enforce that the path=/rump specifier specifies and actual path
prefix and doesn't accept e.g. /rumpdev (only /rump/dev).
2011-03-08 21:36:01 +00:00
pooka 94372010ba clarify blanket operation a bit more 2011-03-08 21:09:18 +00:00
pooka 964221c99c maybe typo 2011-03-08 21:02:22 +00:00
pooka f5d8571208 Add ``blanket''. It acts like path, except that the prefix does
_not_ get removed if the call goes to the rump namespace.

So, now it's possible to use e.g. tcpdump (and most other utilities
which hardcore a /dev pathname) on a rump kernel:

golem> setenv RUMPHIJACK blanket=/dev/bpf
golem> tcpdump -n -i virt0
tcpdump: WARNING: SIOCGIFADDR: virt0: Device not configured
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on virt0, link-type EN10MB (Ethernet), capture size 96 bytes
21:55:38.925596 IP 192.168.2.101 > 204.152.190.12: ICMP echo request, id 47811, seq 0, length 64
21:55:39.095596 IP 204.152.190.12 > 192.168.2.101: ICMP echo reply, id 47811, seq 0, length 64

(if you additionally set socket=all in RUMPHIJACK, tcpdump doesn't
whine about the "not configured" interface)
2011-03-08 20:59:01 +00:00
pooka c6cd7e8f80 another comment 2011-03-01 10:54:06 +00:00
pooka 691e852f03 comment 2011-03-01 10:47:29 +00:00
pooka 060e3527df make compiler sign-happy 2011-02-28 20:39:07 +00:00
pooka 9ec87a7764 A simple dup2-enforced affine transformation isn't enough when
dealing with dup2() from a rump kernel fd to a host kernel fd.
Consider:

s1 = socket();
s2 = socket();
dup2(s2, 0);

Instead, maintain a real mapping table (and get on my knees and
pray i don't have to touch this hair-splitting code ever again).

Apparently bourne shell scripts from a rump kernel fs work now
(sh script.sh; ./script.sh doesn't work for obvious "IT'S THE WRONG
FS NAMESPACE" reasons).  No test regressions either, so I'm a
happy camper.
2011-02-28 19:57:36 +00:00
pooka ee9b785d83 make error messages sensible. from uwe 2011-02-27 11:32:12 +00:00
pooka f70541ba1f whoops, didn't mean to delete futimes in previous. also from riz 2011-02-25 18:36:36 +00:00
pooka b183f0392f support mknod. from riz 2011-02-25 18:29:00 +00:00
pooka da73d5bcb9 Ok, for reasons I can't begin to understand, the binaries I tested
yesterday on powerpc broke overnight.  Apparently adding one more
function before the call to dlsym() fixes things again.  I hope
I don't have to add another one tomorrow ....
2011-02-25 16:01:41 +00:00
pooka b8eb9b59e8 Make the rumphijack dlsym trampoline call from rumpclient a "real"
function call instead of a call through a function pointer.
Apparently powerpc ld.elf_so gets __hackish_return_address() wrong
if the call is done through a function pointer (digging deeper into
that stuff is beyond my interest).

Thanks to riz for providing access to a macppc for debugging.
Unthanks to the broken toolchain in the default installation which
wasted approximately 4 hours of time last night.
2011-02-24 12:25:44 +00:00
pooka edac4b359f duh, remember to cvs add hijack.h too...
from pgoyette
2011-02-23 18:18:24 +00:00
pooka 7e61a6ce53 Return value audit: properly set errno and return -1.
Fixes at least cross-kernel mv(1).
2011-02-23 15:44:38 +00:00
pooka 2350034b27 +access(2) 2011-02-23 15:29:21 +00:00
pooka 247a92b203 Put the dlsym-from-this-object trampoline into a separate source
module which is compiled -fno-optimize-sibling-calls instead of
trying to fool the optimizer in various ways in the trampoline.

thanks to yamt for the tip
2011-02-23 15:23:15 +00:00
pooka a63f48d68d If minfd for F_DUPFD is >= hijackoff, assume it means a minimum
value in the rump kernel and adjust accordingly.
2011-02-21 20:11:56 +00:00
pooka b1f4a8807b disallow mmap(MAP_FILE) from a rump kernel fd 2011-02-21 13:19:35 +00:00
pooka dc0a4e21dd Actually, we need both lseek and _lseek so that out-of-libc references
go to the right place instead of directly to __lseek.  Seeking in
mplayer works now.
2011-02-21 12:55:21 +00:00
pooka 463ea53fc5 hijack:
1) {,f,l}chflags (used e.g. by cp(1))
  2) p{read,write}{,v} (used by many)
2011-02-21 12:51:06 +00:00
pooka 3c9255c1a2 fix tests/lib/librumphijack/t_asyncio:invafd -- dual poll on invalid fd 2011-02-20 23:47:04 +00:00
pooka d9a5e73fe5 minor clarification 2011-02-20 14:21:04 +00:00
pooka 6d9d147305 fix symlink pathname examination (rationale-to-joerg: so that it works) 2011-02-19 19:17:33 +00:00
pooka 9c67a5d8a0 hijack __getcwd() 2011-02-19 13:10:35 +00:00
pooka bfd70564a0 and now with less crazy whitespace 2011-02-19 13:09:40 +00:00
pooka 9cb130af6b support PF_OROUTE and PF_MPLS where available 2011-02-19 13:07:53 +00:00
pooka 5191458a1c hijack libc-internal name for lseek so that libc-internal callers
go to the right kernel too.
2011-02-18 19:27:06 +00:00
pooka c0f2e1965c block cross-kernel rename in the other direction also 2011-02-18 14:44:46 +00:00
pooka ff90450826 fix rename 2011-02-18 14:33:11 +00:00
pooka b8883bd5ec uhm, put PF_LOCAL on the socketlist 2011-02-18 14:25:04 +00:00
pooka 0e29006e71 give the signmonkey a banana 2011-02-18 13:04:52 +00:00
pooka c89b586dc4 Document .Ev RUMPHIJACK 2011-02-18 12:22:46 +00:00
pooka 45c58b6c6a Use the env variable RUMPHIJACK to specify what facilities should
be hijacked.  If it's not specified, the default is
"path=/rump,socket=all:nolocal".

So, if you're moof and want to relive your domain/os days (??),
you can do this:

pain-rustique:51:~> setenv RUMPHIJACK 'path=//'
pain-rustique:52:~> df //dev
Filesystem   1K-blocks       Used      Avail %Cap Mounted on
rumpfs                1          1          0 100% /
pain-rustique:53:~> df /dev
Filesystem   1K-blocks       Used      Avail %Cap Mounted on
/dev/wd0a       1019864     280640     688232  28% /
2011-02-18 11:41:32 +00:00
pooka 7379975cf9 Support mount/unmount too. So, things are now generally at a stage
where you can mount a file system with a userspace server *without*
it having to go through puffs.

Say, you first start a server with ffs capability and map a host
ffs image into it:

	rump_server -lrumpvfs -lrumpfs_ffs \
	    -d key=/ffsimg,hostpath=ffs2.img,size=e unix:///tmp/ffsserv

Then, configure your shell to talk to the rump server:

	setenv RUMP_SERVER unix:///tmp/ffsserv
	setenv LD_PRELOAD /usr/lib/librumphijack.so

Create a mountpoint and mount the file system:

	pain-rustique:60:~> sh
	$ cd /rump
	$ ls
	dev
	$ ls -l
	total 1
	drwxr-xr-x  2 root  wheel  512 Feb 17 18:00 dev
	$ mkdir mnt
	$ mount_ffs /ffsimg /rump/mnt
	mount_ffs: Warning: realpath /ffsimg: No such file or directory
	$ df -h mnt
	Filesystem        Size       Used      Avail %Cap Mounted on
	/ffsimg           496M       380M        91M  80% /mnt
	$ du -sckh *
	192K    dev
	380M    mnt
	381M    total
	$ umount -R mnt
	$ df -h mnt
	Filesystem        Size       Used      Avail %Cap Mounted on
	rumpfs            1.0K       1.0K         0B 100% /
	$

(note, you need -R to umount due to various degrees of unsuccesful
magic it attempts to perform without it)
2011-02-17 17:18:08 +00:00
pooka b4ff8b5f63 In case dup2(n, n+FDOFF) is done, the caller thinks there are two
distinct file descriptors, but the rump kernel thinks they are both
the same.  Now, if either one is closed by the application, "both"
will be closed in the rump kernel.  To fix this, maintain an
alias-mask.  It's not a perfect solution, though (consider e.g.
F_SETFL).  Maybe we should actually dup the fd and maintain a
mapping table?

Also, prevent the host from opening file descriptors onto the places
in the fd namespace that have been dupped.

These together fix "cat < /rump/foo" in a hijacked /bin/sh.
(the first one makes sure stdin is open in cat and the second one
makes sure it doesn't try to cat something from /usr/share/locale
instead of stdin)
2011-02-17 15:20:10 +00:00