Commit Graph

310 Commits

Author SHA1 Message Date
pooka 86c3d1928f Make rumpuser_dl_bootstrap() optional for platforms which don't
provide dynamic linking.
2013-04-29 18:00:19 +00:00
pooka 810cff61f8 Replace the various "get info from hypervisor" interfaces with one
unified rumpuser_getparam(), and make it return a plist.  The
contents can come e.g. from the env or a config file.  Make
identifiers starting with an underscore denote system identifiers
which must be implemented by hypervisor. (yea, j/k about the plist bit)
2013-04-29 17:31:05 +00:00
pooka 25df76591e The fsync hypercall is now used only with close, so get rid of it.
rumpuser_bio() should do the necessary syncing.
2013-04-29 15:40:38 +00:00
pooka 9dda4d8626 Give private hypercalls the ability to meddle with kthread contexts too. 2013-04-29 15:20:05 +00:00
pooka a15e077982 Create a kernel thread context for the bio upcalls. 2013-04-29 14:54:03 +00:00
pooka 5af3856aee Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
2013-04-29 14:51:39 +00:00
pooka f134f09680 set default bio mode to threaded 2013-04-29 13:57:46 +00:00
pooka 17b3a6d03d unschedule around blocking i/o 2013-04-29 13:53:46 +00:00
pooka 831d6eeb05 RUMPUSER_OPEN_DIRECT is no longer necessary 2013-04-29 13:21:03 +00:00
pooka 696d8241ab changes to bio hypercalls, part 3/n:
retire the filemmap/memsync hypercalls, they're no longer used
2013-04-29 13:19:11 +00:00
pooka 262a3aaf9f Rework how the bio hypercalls work, part 1/n:
Reduce the set of hypercalls to one: "do block i/o".  This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
2013-04-29 12:56:03 +00:00
pooka 5e41922b25 don't need event.h here anymore 2013-04-28 13:39:13 +00:00
pooka 49bb662cc0 Change rumpuser_cv_timedwait() from absolute time to relative time.
It's then the hypervisor's problem to translate it accordingly.
Now we no longer have to worry about the kernel having to know the
hypervisor's time and vice versa.
2013-04-28 13:37:51 +00:00
pooka a53a2a5357 Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
2013-04-28 13:17:24 +00:00
pooka ad45a6e694 make the file monitoring hypercalls private to shmif 2013-04-28 10:43:45 +00:00
pooka b985b935c6 The ioctl hypercall is used only by the usb host controller driver,
so make it exclusive to that component.  I'm happy to see it gone.
2013-04-28 09:58:11 +00:00
pooka b0711f2cf4 nuke unused var 2013-04-27 17:35:10 +00:00
pooka 9dd496792d make the random hypercall more generic 2013-04-27 16:56:29 +00:00
pooka b8f5ee1a3f roll mutex init hypercalls into one (one of them already took a flag anyway) 2013-04-27 16:32:56 +00:00
pooka bd14d4eb65 wrap unportable register_t with a long. should do it in the front
of the house too, but at least this is a start.
2013-04-27 16:02:55 +00:00
pooka 439ef2016c * treat kern_malloc.c as an unreal allocator (it's so lightweight)
* get rid of the rumpuser_realloc() hypercall
* pass size to rumpuser_free()
2013-04-27 15:34:53 +00:00
pooka c05fab5d36 rumpuser_poll() is used only by sockin, so make the hypercall
private to that component.
2013-04-27 15:01:21 +00:00
pooka 93b95ff6a0 * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
2013-04-27 14:59:08 +00:00
pooka bc3aabc030 Try to make sure that the appropriate calls to mutex_enter() takes
a spin mutex (i.e. does not relinquish cpu context while trying to
take the mutex).

Bump the hypercall interface version number.  I'll be doing a bunch
of other cleanups to simplify the interface for the benefit of
alternative hypervisor implementations.  I'll be riding this bump
and doing a second one only after I'm finished with all of the
changes.
2013-04-27 13:59:46 +00:00
pooka 7415696ea8 Attempt two for the previous: _ILP32 comes from headers, so don't use
it to decide if we want to muddle with _FILE_OFFSET_BITS.
2013-03-20 12:59:10 +00:00
pooka 5ccc76a66f Use _FILE_OFFSET_BITS=64 on Solaris too (necessary for 32bit builds). 2013-03-20 12:30:13 +00:00
pooka ac8531a7b9 Terminate result of readlink(). Makes writefilewatch_setup() work in
cases when the buffer doesn't accidentally contain suitable zeroes.

Thanks to Juan RP who debugged this with me!
2013-03-18 21:00:52 +00:00
pooka e3425032cb Move the rumpuser_net set of hypercalls to be a private to the sockin
component.  This cleans up the generic hypercall interfaces from ones
specific to only one component.  They should always have been private,
but the infrastructure to "make it so" didn't exist earlier.

no functional change
2013-03-18 13:14:10 +00:00
pooka dae2a8e72e Refine previous: sys/sysmacros.h is where MIN/MAX comes from on Solaris,
so it needs to be included unconditionally.
2013-03-14 21:31:35 +00:00
pooka fe337c7fc3 StunOS >= 5.11 has posix_memalign(), so add an additional constraint for
when we need to emulate it with memalign() and when not.
2013-03-14 20:42:57 +00:00
pooka a3255409b1 DragonFly is in the Solaris camp in the "how to access ELF DYN at runtime"
valley of joy and love.
2013-03-12 14:03:32 +00:00
pooka f9ef17b1a6 Tiny fix for Solaris. 2013-03-09 13:25:17 +00:00
pooka 4b0fe89206 Ensure that rump kernel component constructors from the main object
get processed.  This applies to ones which were linked statically.
Unfortunately, that's where it got a bit tricky, since the dlsym()
interface searches the handle and all its dependencies.  For the main
object the list of dependencies includes all the dynamic rump kernel
components that were included when the binary is linked.  So, a long
story short, make only one pass through the objects to harvest all the
component entries, weed out the dupes, and initialize components from
an in-memory dupe-free list when so requested.
2013-03-08 19:04:27 +00:00
pooka 7b7946c688 Add interfaces that out-of-librumpuser hypercalls can use to unschedule
and reschedule themselves if they plan to block.
2013-03-01 18:15:36 +00:00
pooka 573b65f8df limit use of rumpuser.h to where it is meant to be used from 2013-03-01 13:52:31 +00:00
pooka a3f7afe3bd As reported by several people, the signature of pthread_setname_np() varies
from one Linux distro to another (didn't suspect it to be *that* _np).
Comment out the call on Linux pending autoconf support.
2013-02-11 16:02:31 +00:00
pooka 16280deed5 Include sys/sysmacros.h on solaris for MIN/MAX. 2013-01-17 21:42:22 +00:00
pooka 4adce8f663 Use the /proc way for counting host cores on Cygwin. 2013-01-14 21:04:15 +00:00
pooka e0f5e00388 Support Cygwin as a hypervisor. 2013-01-14 21:00:16 +00:00
pooka 44ba88ce59 .. and make it compile on said platforms. 2013-01-10 19:14:12 +00:00
pooka a8f9daedd7 Provide an implementation of writewatchfile for platforms without kqueue
or inotify (it's a rather simple implementation ;)
2013-01-10 19:13:04 +00:00
pooka 1f06a056c7 FreeBSD and DragonFly also provide hosts cpus via sysctl hw.ncpu. 2012-12-14 10:48:48 +00:00
pooka 9a4570ee22 Apparently MAP_ANON mmap() on Linux requires MAP_PRIVATE to be specified
for the addr parameter to have a sane effect.  Make it so.
2012-12-13 15:35:09 +00:00
pooka 4c7d25c0e6 Support binaries which use DT_GNU_HASH instead of DT_HASH. 2012-12-11 21:16:22 +00:00
pooka 4fd1e9198b fix previous 2012-11-26 20:03:40 +00:00
pooka 48528ba2e9 One more thing required by DragonFly 2012-11-26 19:57:24 +00:00
pooka 149f3bccf4 Support DragonFly BSD. 2012-11-26 17:55:11 +00:00
pooka 0d8e694036 PTHREAD_PROCESS_SHARED private doesn't seem to work on DragonFly, so
init the spin lock _PRIVATE (we don't really care which it is).
2012-11-26 17:54:51 +00:00
pooka 303e3a3aa0 FreeBSD fixes.
from philip@freebsd.org
2012-11-26 17:03:15 +00:00
pooka 23a1592d75 const poison is the cure 2012-11-26 17:00:54 +00:00
pooka 2f56710909 Since SA_SETLEN() is used only for sockaddr_in, convert it to SIN_SETLEN()
to avoid compiler whining on breaking strict aliasing rules.
2012-11-26 16:30:14 +00:00
pooka 0163bf03f8 satisfy the slightly more picky clang 2012-11-22 21:23:08 +00:00
pooka b65f40a8c1 export register_t to rump kernel users on solaris 2012-11-21 17:41:27 +00:00
pooka 6530621714 Fixes for Solarisa. 2012-11-18 19:29:40 +00:00
pooka 2b783d7193 Check return value of ftruncate(). Some versions of gcc give
warnings if I don't.
2012-11-14 09:22:58 +00:00
pooka 88593a2335 Actually define the klock/unlock pointers. Not having the storage
allocated for them created "interesting" effects with one compiler setup.
2012-11-06 18:33:00 +00:00
pooka 57b62be432 one more routine 2012-11-06 18:31:14 +00:00
pooka 2c32a204a7 implement mutex_owner() 2012-11-02 16:55:02 +00:00
pooka cc24ac78d4 need rumpuser_mutex_init_kmutex() these days 2012-11-02 13:31:26 +00:00
pooka 8083a2e226 Start restoring the ability to run rump kernels on non-threading
hypervisors.

Step 1: make this compile again (it's not complete, but
at least it compiles).
2012-11-02 11:11:27 +00:00
pooka edf42f21f8 Implement the writewatchfile routines for a Linux hypervisor. As a
result, the shmif network driver now works when hosted on Linux.
2012-10-10 11:15:57 +00:00
pooka 6bc4679626 call pthread_setname_np() on Linux too. 2012-10-08 18:02:04 +00:00
pooka bf01f875b4 For the rumpsp protocol, don't assume that the bit representation of
errnos match on the client and server platforms (the syscall subprotocol
errnos are handled by the server compat code).
2012-09-21 14:33:03 +00:00
pooka 8b5f6f3669 Do not assume that O_FOO flags have matching values in the rump kernel
and hypervisor.
2012-09-14 16:29:21 +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
pooka 3b3ffd7039 Once again, make the rump kernel hypercall layer work on Linux. 2012-07-27 09:09:05 +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
matt fa835e8c8b These directories default to WARNS?=5 2012-03-21 05:37:42 +00:00
joerg a65b1aeb01 Disable reduced stack for now. It creates fallout I'm not willing to
deal with.
2012-03-09 21:03:09 +00:00
tls f27d6532f5 Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not).  This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
2011-11-28 08:05:05 +00:00
joerg 70b0796a0d Ensure that rumpuser_thread_exit doesn't return. 2011-05-23 20:49:08 +00:00
pooka f347b4496a make work on nb5 again 2011-03-22 22:27:33 +00:00
njoly 603f3daee7 Convert hashtab to Elf_Symindx type, and use it directly to get symbol
count. Remove now unused GETVECWORDn macro.

This is needed to make it work on alpha which use non-standard 64bit
values for the symbol hash table section, unlike all other archs.
2011-03-16 11:44:01 +00:00
pooka 00e34b229c Use sendmsg() instead multiple calls to sendto(). It behaves
slightly better in the multithreaded exec case in terms of partial
frames sent.  Plus, it's theoretically a little cheaper.

There's still a gray area with partial transfer from sendmsg(),
but I'm not sure I care enough about some academic scenario to
start fixing it (it basically needs an OOB exec signaller).
2011-03-08 15:34:37 +00:00
pooka 91240244df Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
2011-03-08 12:39:28 +00:00
pooka 20446f99b9 return correct value when reading a short frame 2011-03-08 10:02:01 +00:00
pooka fc3b823359 use nwork-adjusted amount of idle workers to decide is they are truly idle. 2011-03-07 21:57:15 +00:00
pooka 3129d3ab75 Cleanup server socket before sending back "ok" for halt. Fixes
some occasionally-seen race conditions in tests which do server
restarts (e.g. the raidframe tests).
2011-02-15 16:10:41 +00:00
pooka 5e301bc45b support HANDSHAKE_EXEC 2011-02-15 10:37:07 +00:00
pooka 2ba7fe5525 A bunch of changes which essentially make sshd work with a hijacked
rump tcp/ip stack:

* sshd likes to fork and then re-exec itself
  ==> trap execve() and augment the env with the current parameters
      essential to a rump kernel (kernel communication fd, information
      about dup2'd file descriptors)

* sshd likes to play lots of games with pipes, socketpairs and dup{,2}()
  ==> make sure we do not close essential rump client descriptors:
      dup() them to a safe place, except for F_CLOSEM where we
      simply leave them alone.  also, partially solved by the above,
      make sure the process's set of rump kernel descriptors persists
      over exec()

* sshd likes to chdir() before exec
  ==> for unix-style rump_sp(7) sockets save the full path on the
      initial exec and use it afterwards.  thread the path through
      the environment in execve()
2011-02-14 14:56:23 +00:00
pooka 8e6ede8c05 Turn the "idle workers available" from a flag into a counter so
that we can finally avoid all races (*knock knock*).
2011-02-08 11:21:22 +00:00
pooka 15fa3c8c84 Support query of the partition size in case underlying device is
a wedge.  This still lacks the proplibistic query of the sector
size and just assumes 512.  It's good that we make asking a file's
size as simple as requiring one stat(), one open() and three (3)
different ioctls plus some proplist mumbojumbo.  I'm surprised it's
available at all by means other than #wish.

code mostly from Taylor R Campbell, rant from me.
2011-02-06 21:05:53 +00:00
pooka 627ff529aa Fix a race condition in the worker thread caching logic: if we got
two or more syscall requests before any worker thread ran, we might
not have enough threads to handle the requests.  In some scenarios
this could lead to a deadlock.
2011-02-06 18:25:48 +00:00
yamt 7597b0c1e6 fix indent. no functional changes. 2011-02-05 13:51:56 +00:00
pooka dac4423feb Pass the value of getprogname() from the client to the server and
record it in p_comm.  This is nice for things like sockstat, since
they now display the client command name:

pain-rustique:43:~> rump.sockstat
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     xulrunner- 16     0 tcp    192.168.2.114.65507   204.152.190.12.80
root     xulrunner- 16     1 tcp    192.168.2.114.65501   204.152.190.12.80
root     xulrunner- 16     2 tcp    192.168.2.114.65500   204.152.190.12.80
root     xulrunner- 16     3 tcp    192.168.2.114.65499   204.152.190.12.80
root     xulrunner- 16     5 tcp    192.168.2.114.65498   204.152.190.12.80
root     xulrunner- 16     6 tcp    192.168.2.114.65497   204.152.190.12.80
root     socket     62     0 tcp6   *.http                *.*
root     socket     62     1 tcp    *.http                *.*
root     socket     63     0 tcp6   *.81                  *.*
root     socket     63     1 tcp    *.81                  *.*
2011-01-28 19:21:28 +00:00
pooka 19a57922d0 Add reconnect code to librumpclient. In case the connection to
the kernel server is lost, the client will now automatically attempt
to reconnect.

Among other things, this makes it possible to "reboot" and restart
the TCP/IP stack from under firefox without any perceivable less
of service.  If pages were loading at the time the TCP/IP server
was killed, there may be some broken links, but nothing a ctrl-r
cannot fix.
2011-01-24 17:47:51 +00:00
pooka 112941441d happiness is a quiet lint 2011-01-22 14:22:10 +00:00
pooka 3b79c0eb90 shush lint 2011-01-22 14:18:55 +00:00
pooka 1d9f8678bd In case sys_reboot() was called by a remote client, put the response
in the socket before we shut down.  This way the response to the
syscall travels to the caller and they know things worked correctly
instead of having to just assume.
2011-01-22 13:41:22 +00:00
pooka 3cc5cc6884 include pid of rump server in hostname 2011-01-20 15:00:12 +00:00
pooka 9fba158b8b Add RUMPSP_RAISE: the kernel sends a signal to the client. 2011-01-14 13:12:14 +00:00
pooka 3626eb4b01 call procexit when a connection closes 2011-01-12 12:52:16 +00:00
pooka 5064fa59e6 A bunch of improvements:
* don't hold spc mutex while sending data
* use send() for the banner to avoid SIGPIPE in case a client
  connects and immediately goes away
* fix error path locking
* use kevent() instead of pollts() in the client.  Apparently that
  is the only sensible way for a library to support both multithreading
  and signal-reentrancy in a race-free manner.
  (can I catch all signals with one kevent instead of installing
  NSIG different ones??)
* mark client comm descriptor non-blocking so that clients have
  better signal-interruptibility (we now sleep in signal-accepting
  kevent() instead of signal-masked recvfrom())
2011-01-10 19:49:43 +00:00
pooka 52fffe2163 g/c code which is unused in the server 2011-01-10 11:57:53 +00:00
pooka 55d21df89f Separate rw_data and rw_done. Otherwise we don't get wakeups for
requests which have a 0-length response (such as copyin 0/0).

This change makes links(1) work against a rump kernel which contains
rumpnet_local.  The presence of unix domain sockets caused links
to select() with 0 fds and a timeout, and because copyin never woke
up in the kernel the application blocked indefinitely.
2011-01-09 14:10:03 +00:00
pooka 91aad9bd60 Make rumpclient impervious to LD_PRELOAD syscall hijacking by using
dlsym(RTLD_NEXT) to lookup a host_syscall() function pointer which
is used instead of syscall() to communicate with the kernel server.

WARNING: popular opinion classifies this as "ugly code".  if you
have a weak heart/mind/soul/sole meuniere, read max. 1 line of the
diff per day, preferably with food.
2011-01-07 19:37:51 +00:00
pooka c45d9404c0 Make rumpclient syscalls safe to call from signal handlers. 2011-01-06 06:57:14 +00:00
pooka f4b63a89c1 Release sender lock before zeroing out "wanted" status during
violent disconnect.  Fixes some race conditions (maybe the one
occasionally showing up on tests/rump/rumpkern/t_stress).

thanks to schmonz for some discussion
2011-01-05 22:57:01 +00:00
pooka fd993ea3d0 Support fork() for rumpclient users. 2011-01-05 17:14:50 +00:00
pooka de27b28026 Fix fd leak also in non-NetBSD code path. 2011-01-05 09:43:00 +00:00
wiz aff1729a2c Fix fdleak in error case. Found by cppcheck. 2011-01-05 00:09:43 +00:00
pooka 3daddc031c rump_lwproc_newproc -> rump_lwproc_rfork 2011-01-02 13:01:45 +00:00
pooka 2aa9fbc0b2 Allow rump kernel to call dlsym(RTLD_DEFAULT). 2010-12-30 15:47:30 +00:00
pooka 393eecc12a Have the client and server perform some sort of handshake first.
It's pretty much a placeholder for now.  One plan for the future
is to require some sort of authentication for superuser clients.
The code will need a little massage then, though, to prevent DoS
attacks.
2010-12-16 17:05:44 +00:00
pooka 3c4a27f7cd Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
2010-12-16 12:38:20 +00:00
pooka 34c8240044 Unlink unix socket as part of server exit.
(whatever happened to the code that was supposed to do it automatically
when the binding process exits?)
2010-12-12 17:58:28 +00:00
pooka c59435eea2 add rumpuser_sp_fini, which surpringly is the opposite of rumpuser_sp_init 2010-12-12 17:10:36 +00:00
pooka 939300d48c outdated comment 2010-12-12 13:48:55 +00:00
pooka 48ac8b3849 implement mutex_owner() 2010-12-01 17:22:51 +00:00
pooka 0f9fe55ba4 Umm, delete recursive mutex interface instead of renaming it. 2010-12-01 15:01:52 +00:00
pooka 5e1b7bf36d Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space).  As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()).  The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock.  So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
2010-12-01 14:59:37 +00:00
pooka 03f765ec9e lint care 2010-11-30 22:32:01 +00:00
pooka ff46270ebc Hands off of stuff we need to keep hands off of. 2010-11-30 20:33:43 +00:00
pooka 7332ad1515 Require server to be explicitly initialized with rump_init_server(url).
Also, add rump_daemonize_begin() / rump_daemonize_end() to help
with the "can't daemon() after pthread_create()" problem.  Applications
could accomplish the same, but since it's such a common operation,
provide a little help.
2010-11-30 14:23:24 +00:00
pooka 1e3b8bd985 add commented-out -D_DIAGNOSTIC 2010-11-30 14:08:39 +00:00
pooka d402686fe2 Remove remaining panic()s from server-side code. Also, allow to
send an out-of-band error.  Make the client retry syscall requests
if this error is EAGAIN, fail them otherwise.
2010-11-29 16:08:03 +00:00
pooka ea8aecd4f3 Cache syscall worker threads and include some stetson-harrison
limits.  This improves syscall throughput about 2x for non-userio
syscalls (no copyin/out, e.g. getpid()) and almost 1.5x even for
things like __sysctl().
(measured for cases where the remote process is on the local machine)

XXX: if the pthread deadqueue sucks for anything which cares about
performance, why does it exist?  Nuking it would make supporting
variable stack size easier.
2010-11-29 11:40:54 +00:00
pooka bd26e667a8 Since we are going to handle syscalls in our threads, limit stacksize.
(unfortunately though, pthread_attr_setstacksize() has no effect on NetBSD)
2010-11-27 18:30:51 +00:00
pooka f0d58f7830 Fix a few locking problems with multithreaded clients.
TODO: make server deal graciously with out-of-resources conditions
2010-11-26 18:51:03 +00:00
pooka 6e0e64ab1b Improve reliability in cases where client disconnects mid-operation. 2010-11-26 14:37:08 +00:00
pooka 7ca02bea53 Plug recently introduced memory leak: release lwp after use instead of
just switching away.

Also, make freeing syscall arguments a little more symmetric.
2010-11-26 10:59:14 +00:00
pooka 6b71288c49 *facepalm*, adjust remote copyinstr to work in cases where the end
of the max copyin extends to an unmapped page.

Noticed, as usual, by tests.
2010-11-25 17:59:02 +00:00
pooka 6d4b60f246 create pthread attribute only once 2010-11-24 20:29:13 +00:00
pooka d693e691bf unsnafu previous 2010-11-24 17:20:24 +00:00
pooka 0f9bd961a2 Unschedule from CPU for out-of-kernel blocking ops. Otherwise we
might even deadlock if the thread that wakes us up wants a CPU.
2010-11-24 17:00:10 +00:00
pooka b99a42f8f3 improve threadsafety 2010-11-24 15:17:46 +00:00
pooka adabf68496 missed part of earlier commit 2010-11-24 14:32:42 +00:00
pooka c21ac41b0b Sneeze some locking into connect/disconnect. 2010-11-24 11:40:24 +00:00
pooka 9be034428c Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
  ==> add proper support for copyin/out_vmspace
    ==> add support for remote vmspace uvm_io
      ==> add support for non-curproc rumpuser_sp_copyin/out
        ==> store remote context in vm_map->pmap instead of
            pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
2010-11-22 20:42:19 +00:00
pooka ad5cf5ab43 squelch the compiler whine 2010-11-19 17:47:44 +00:00
pooka a2b42bab81 Support multithreaded clients and fix a few bugs. 2010-11-19 17:09:44 +00:00
pooka b82590c0a3 delint 2010-11-19 15:40:55 +00:00
pooka 52f22b2c6a Start working on making the syscall proxy code threadsafe. The
basics are there, but a few more tweaks are needed.  The reason
I'm committing it now is that the code was mindnumbingly boring to
write (no wonder it took me almost 3 years to get it done), and I
might burn it if it's not in a safe place.
2010-11-19 15:25:49 +00:00
pooka 48257b3e61 free syscall data after use 2010-11-17 17:36:14 +00:00
pooka e9e1ac535f Make int *error and optional parameter (i.e. it can be NULL).
Sometimes the caller just doesn't care which errno close() might
throw.
2010-11-15 15:23:32 +00:00
pooka ac0efea1ab Don't puff sigpipe if the connection has been severed. May happen
e.g. when a client executes a blocking call such a poll() and
decides to exit before the result is ready.
2010-11-10 16:12:15 +00:00
pooka 01eecd68eb Implement support for unix domain sockets (important especially
for testing since we don't want to depend on global resources such
as tcp ports).
2010-11-05 14:23:45 +00:00
pooka 13e503f148 Refactor the sysproxy code so that rumpuser contains only the server side. 2010-11-04 20:54:07 +00:00
pooka 5629968a95 Missed a few symbols in previous ...
Also, reorganize rumpuser header inclusion to make sure problem is
caught already by the compiler.
2010-11-01 13:55:19 +00:00
pooka 8fc7f9077e Make librumpuser linkage once again free of librump.
problem pointed out by <he>
2010-11-01 13:49:10 +00:00
pooka f128c061ef Run different clients (different sockets) in different processes
inside the rump kernel.  Now different host processes can no longer
step on each other inside the rump kernel.
2010-10-28 14:37:29 +00:00
pooka b1842c2201 Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace.  Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
2010-10-27 20:44:49 +00:00
pooka a5e213b348 * if kevent() fails with EINTR, try again instead of returning an error
* stuff rumpuser_dprintf to stderr instead of stdout
2010-08-11 10:25:59 +00:00
pooka 451e6b4882 Version rumpuser ABI with a lightweight mechanism. 2010-06-09 14:08:17 +00:00
pooka 3f4944e6bb Add the ability to specify a preferred address the "map anon memory"
hypercall.
2010-06-09 11:35:36 +00:00
pooka 46ea1019d6 Allow loading the symbols from objects which are not directly mapped
into memory, namely the main object (i.e. map->l_addr is NULL).
2010-06-08 15:32:55 +00:00
pooka ae456b5717 Check return value of posix_memalign ... always helpful to not return
garbage memory in case of failure.
2010-06-02 18:15:35 +00:00
pooka e3c273abc1 Don't pass "canfail" down to rumpuser_malloc -- there's quite little
we can do with that info way down there.  Instead, pass alignment.
Implement rumpuser_malloc() with posix_memalign().
2010-06-01 20:11:33 +00:00
pooka 9970bb9e64 Support KTHREAD_JOINABLE/kthread_join(). Also fixes earlier bug
where all pthreads were created non-detached.
2010-05-31 23:09:29 +00:00
pooka b1b7862792 Make it possible to use the scheduler lock as the rumpuser condvar
interlock.  This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on.  Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex.  This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
2010-05-18 14:58:41 +00:00
pooka db171f695e Add rumpuser interface to fetch number of host cpus. 2010-04-28 00:33:45 +00:00
pooka a08942d291 Actually, support rumpuser_kill() only on NetBSD, since signal
numbers may not match on non-NetBSD hosts.
2010-04-21 11:16:41 +00:00
pooka 3cc6a65772 Add rumpuser_kill, which sends a signal to a host process. 2010-04-21 11:13:29 +00:00
pooka 1019474331 Wrap DOCALL and DOCALL_KLOCK in a new block (for easy adding of
debug prints before them.

XXX: can't use the standard do-while0 because lint doesn't like it.
2010-03-22 09:39:02 +00:00
pooka c2efc59235 During bootstrap, process all modinfos in a DSO in one go. Get
rid of dependency tricks, since they are no longer necessary.
2010-03-05 18:47:49 +00:00
pooka 15a168ac89 Join today's manpage mania by updating this to reflect the current
situation a "little" better.
2010-03-01 17:20:44 +00:00
pooka 510a73e003 Introduce RUMP_COMPONENT. It behaves mostly like a simplified
module which is linked into the kernel and cannot be unloaded.
The main purpose is to get the proper constructors run and create
any /dev nodes necessary for said component.  Once more of the
kernel (e.g. networking stack and device drivers) are converted to
MODULE and devfs pops up from somewhere, rump components can be
retired.
2010-03-01 13:12:19 +00:00
pooka 6e4a9f9133 librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built).  Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
2010-02-26 18:54:20 +00:00
pooka bdf6e0b034 Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
  * install relevant headers into /usr/include/rump
  * build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
    from src/lib and install as librumpuser and librump, respectively
    + this retains the ability to test a librump build with just the
      kernel sources at hand
  * move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
    for general consumption, they are not kernel-space dwellers anyway
  * build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
  * add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
  * build and install userspace kernel file system daemons if MKPUFFS=yes
    is spexified
  * retire fsconsole for now, it will make a comeback with an actually
    implemented version shortly
2008-07-29 13:17:40 +00:00