Home | History | Annotate | Download | only in librumpuser
History log of /src/lib/librumpuser/sp_common.c
RevisionDateAuthorComments
 1.45  02-Apr-2025  martin Revert accidental local test change from previous - the DEBUG define
is passed on the command line already.
 1.44  02-Apr-2025  riastradh librumpuser: New RUMPUSER_DEBUG env var enables debug output.

Use it in t_sp:sigsafe to see if we can get more diagnostics out.
 1.43  07-Dec-2021  gson branches: 1.43.4;
In unix_parse(), always allocate memory for the entire struct sockaddr_un
and not just the part used by the present pathname, because the entire
struct will be passed to bind() and an EFAULT can result if not all of
it is a valid allocation. Fixes PR kern/56533.
 1.42  13-Jun-2020  kamil Fix incompatible function pointer casts
 1.41  06-May-2020  christos Allocate one more byte so that we are always NUL-terminated, and remove
the extra commented out NUL-terminations. As suggested in:

http://mail-index.netbsd.org/source-changes-d/2020/04/01/msg012470.html
 1.40  24-Mar-2020  kamil Fix off-by-one

Before accessing array member, check whether it is not out of valid range.

Detected with ASan + RUMPKERNEL.
 1.39  05-Sep-2016  dholland branches: 1.39.14;
printf functions should be tagged as printf functions. Noticed by
martin, whose build broke for some reason yet to be determined.
 1.38  08-Jan-2014  pooka OpenBSD support

from Justin Cormack via github
 1.37  31-Dec-2013  pooka Do not export symbols which don't need to be exported.

via Justin Cormack
 1.36  14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.35  26-Nov-2012  pooka Since SA_SETLEN() is used only for sockaddr_in, convert it to SIN_SETLEN()
to avoid compiler whining on breaking strict aliasing rules.
 1.34  18-Nov-2012  pooka Fixes for Solarisa.
 1.33  21-Sep-2012  pooka 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).
 1.32  27-Jul-2012  pooka branches: 1.32.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.31  08-Mar-2011  pooka branches: 1.31.4;
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).
 1.30  08-Mar-2011  pooka 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).
 1.29  08-Mar-2011  pooka return correct value when reading a short frame
 1.28  15-Feb-2011  pooka support HANDSHAKE_EXEC
 1.27  14-Feb-2011  pooka 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()
 1.26  24-Jan-2011  pooka 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.
 1.25  22-Jan-2011  pooka 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.
 1.24  14-Jan-2011  pooka branches: 1.24.2;
Add RUMPSP_RAISE: the kernel sends a signal to the client.
 1.23  10-Jan-2011  pooka 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())
 1.22  10-Jan-2011  pooka g/c code which is unused in the server
 1.21  09-Jan-2011  pooka 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.
 1.20  07-Jan-2011  pooka 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.
 1.19  06-Jan-2011  pooka Make rumpclient syscalls safe to call from signal handlers.
 1.18  05-Jan-2011  pooka Support fork() for rumpclient users.
 1.17  16-Dec-2010  pooka 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.
 1.16  16-Dec-2010  pooka Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
 1.15  12-Dec-2010  pooka 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?)
 1.14  30-Nov-2010  pooka Hands off of stuff we need to keep hands off of.
 1.13  29-Nov-2010  pooka 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.
 1.12  26-Nov-2010  pooka Fix a few locking problems with multithreaded clients.

TODO: make server deal graciously with out-of-resources conditions
 1.11  26-Nov-2010  pooka Improve reliability in cases where client disconnects mid-operation.
 1.10  25-Nov-2010  pooka *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.
 1.9  24-Nov-2010  pooka unsnafu previous
 1.8  24-Nov-2010  pooka Unschedule from CPU for out-of-kernel blocking ops. Otherwise we
might even deadlock if the thread that wakes us up wants a CPU.
 1.7  24-Nov-2010  pooka missed part of earlier commit
 1.6  19-Nov-2010  pooka Support multithreaded clients and fix a few bugs.
 1.5  19-Nov-2010  pooka delint
 1.4  19-Nov-2010  pooka 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.
 1.3  10-Nov-2010  pooka 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.
 1.2  05-Nov-2010  pooka Implement support for unix domain sockets (important especially
for testing since we don't want to depend on global resources such
as tcp ports).
 1.1  04-Nov-2010  pooka Refactor the sysproxy code so that rumpuser contains only the server side.
 1.24.2.2  17-Feb-2011  bouyer Sync with HEAD
 1.24.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.31.4.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.4.3  23-Jan-2013  yamt sync with head
 1.31.4.2  16-Jan-2013  yamt sync with (a bit old) head
 1.31.4.1  30-Oct-2012  yamt sync with head
 1.32.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.2.2  25-Feb-2013  tls resync with head
 1.32.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.39.14.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.43.4.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed