Commit Graph

14593 Commits

Author SHA1 Message Date
christos c464e0ebc5 Fix non-fortify build. 2011-02-15 16:29:09 +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 172a314918 dup() is now implemented using fcntl() 2011-02-15 14:01:52 +00:00
pooka 8b62780ace Properly implement fcntl commands: F_DUPFD, F_CLOSEM, F_MAXFD 2011-02-15 13:59:28 +00:00
pooka 5e301bc45b support HANDSHAKE_EXEC 2011-02-15 10:37:07 +00:00
matt 9fbae4ec6b Add -D_KMEMUSER to CPPFLAGS 2011-02-14 18:27:24 +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
christos 26104203c2 Don't forget to set errno. Pointed out by yamt. 2011-02-13 23:58:40 +00:00
matt 12923fd008 Need to build libsaslc 2011-02-12 22:24:40 +00:00
pooka b981a177b2 Fix select() if no fds are set.
patch from Alexander Nasonov, PR lib/44552
2011-02-12 10:25:46 +00:00
pooka 84d55c436c play the important typecast game 2011-02-11 14:02:12 +00:00
pooka 7f4c3562b7 ssh mostly ignores the return value of select(), so if the timeout
expired it would assume that all input set descriptors had activity.

In case we get rv == 0 from the poll backend, zero out the fd sets
to signal that in fact no descriptors have activity.

Before this commit ssh was "jittery" when run through a rump tcp/ip
stack (interactive sessions kept blocking on stdin and you had to
"peddle" the connection).  Now it works smoothly ... or at least
smoothly enough so that this commit could be done through a rump
tcp/ip stack:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     ssh        125    0 tcp    localhost.65517       cvs.netbsd.org.22
2011-02-11 12:46:41 +00:00
matt 5f8868401d Make liblzf and the lvm2 libraries during the library stage. This also makes
them get built for MKCOMPAT.
2011-02-10 20:57:22 +00:00
blymn 01cc4b6151 Fix typo. 2011-02-10 08:54:12 +00:00
pooka 82aa883702 The following happens when sending mail with mutt via a rump
TCP/IP stack:

* mutt prepares to exec the smtp client: it forks and closes all
  file descriptors
* when the next networking syscall is done, rumpclient detects that
  the communication fd returned EBADF and does a reconnect,
  gets descriptor 0 for the socket and descriptor 1 for kqueue
* mutt opens the mail file and implicitly assumes it'll get 0-2,
  but in fact gets 2-4
* mutt execs the smtp agent which tries to read the mail from
  stdin (rumpclient communication socket) and fails

Even if mutt correctly did dup2() things would go south when trying
to communicate with the kernel server the next time, since rumpclient
would actually be talking with some mail body instead (well, it
could work, but in that case you'd need to write *really* weird
mails ;).

Hence, prevent rumpclient from using the special fd's 0-2 for its
purposes.

Should fix mutt problem reported by Alexander Nasonov.
2011-02-09 14:29:58 +00:00
pooka 79b560da8c Don't do highestFD check with USE_POLL. It provides no benefit
but causes a dependency between RLIMIT_NOFILE and rumphijack FDOFF.

christos ok
2011-02-09 09:46:59 +00:00
pooka 8ffa45b220 Fix pasto, use GETSYSCALLS() where possible 2011-02-08 19:12:54 +00:00
pooka 8331b66064 Make sure we can do host kevent since the -current (and recent nb5)
libc resolver uses it.  Error out in case of rump fd kevent (TODO).
Fixes one more problem pointed out by Alexander Nasonov.

Also, implement dup().
(TODO: implement it along the fcntl path too)
2011-02-08 14:45:35 +00:00
pooka 0d0ce98254 add std dprint to fdcall 2011-02-08 12:20:11 +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
wiz 49efa429e3 Improve a bit. 2011-02-08 09:49:07 +00:00
haad 83425a0f36 Initial import of libdm and dmctl to tree. libdm library can be used
to access, manage and manipulate device-mapper driver. Which opens us bunch
of new possibilities like

	dm-multipath device target
	dm-crypt     device target
	dm-ccd 	     compatibility layer

With this import I'm bringing in dmctl tool for working with dm driver ,too.
I plan to replace gpl2 licensed dmsetup command with our dmctl tool in near
feature. It can also by placed to /rescue where we was not able to put
dmsetup because of licensing problems.

With libdm in tree we can now write RUMP atf test suite for dm driver to
ensure LVM subsystem stability as time goes.

Reviewed by: blymn@ and rmind@
Oked: by no objections on tech-userlevel@
2011-02-08 03:20:13 +00:00
matt af25d173e6 Distinguish between a corrupt obj pointer and a null obj pointer. 2011-02-08 02:03:13 +00:00
matt 8f55cdd3bd First pass at new crtstuff for powerpc. Doesn't quite work yet
(obj parameter to ___start seems to get corrupted sometimes)
2011-02-08 02:02:25 +00:00
pooka 4adc7d0ea6 add some notes on access control 2011-02-07 22:04:36 +00:00
joerg 2c39cf5f91 Don't define weak aliases in the SMALL case. They conflict with the real
function name since SMALL doesn't use the normal rename logic.
2011-02-07 21:39:47 +00:00
pooka 6aea514dcb Force gcc to generate a stack frame for the call to dlsym(RTLD_NEXT).
Without this hack at least amd64 -O2 just used jmp and The Wrong
Thing happened.
2011-02-07 19:34:39 +00:00
pooka 8235557106 malloc/free aren't async-signal-safe, so avoid calling them when
signals aren't blocked.

this bug made tests/rump/rumpkern/t_sp:sigsafe rarely deadlock
2011-02-07 15:25:41 +00:00
pooka 58bfec3ee0 make sure we don't use "fullset" before we init it 2011-02-07 14:49:53 +00:00
pooka be04c94c6d types.h for time_t 2011-02-07 14:49:32 +00:00
pooka ac3cf3ec89 duh, _sys_read, not read. STAY FIXED, DAMNIT! 2011-02-07 12:23:05 +00:00
pooka 46b90f129d Unbreak the ssp lossage from the default -current build by removing
it.  I still don't have any idea what the ssp stuff is supposed to
do and how it's supposed to even begin to work.  If someone wants
to change this now, run tests/lib/librumphijack before commit so
that I can avoid another multihour debugging session!
2011-02-07 11:51:02 +00:00
pooka 847a170bc4 call the non-compat pollts() from inside the library 2011-02-07 10:28:18 +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
pooka b5dd289bbd make it possible to specify client connection retry model in
RUMPHIJACK_RETRY
2011-02-06 15:48:20 +00:00
pooka 065ac12ba8 Add another connection retry model which simply does exit(1) if
the connection is severed.
(mostly for tests so that everything can be hooked to rump_server's exit)
2011-02-06 15:43:20 +00:00
pooka 9f3861f636 Make sure to close parent's server communication socket after fork. 2011-02-06 15:41:37 +00:00
pooka c4359a17f8 be kinder about kqueue()
(but paradoxically omit the surprise)
2011-02-06 13:05:19 +00:00
christos 6f4121938f Add the actual function files. From FreeBSD via Stathis Kamperis 2011-02-06 01:53:38 +00:00
christos e60f59b973 remquo{,f} from FreeBSD via Stathis Kamperis 2011-02-06 00:44:08 +00:00
pooka 54828d050f uncommit part of previous which wasn't supposed to change 2011-02-05 16:59:24 +00:00
pooka 23134bfed1 Wrap daemon() since it forks. Otherwise we lose the rumpclient kq
descriptor and have multiple processes using the commfd.
2011-02-05 16:57:39 +00:00
yamt 7597b0c1e6 fix indent. no functional changes. 2011-02-05 13:51:56 +00:00
pooka fe247b6f0a Fix some snafus to allow rumphijack to work on -current.
reported by Alexander Nasonov
2011-02-05 12:38:19 +00:00
wiz 6ef76bc469 Remove trailing whitespace. 2011-02-05 00:24:08 +00:00
christos 6f31775ce6 bump for arc4random_{buf,uniform} 2011-02-04 22:07:41 +00:00
christos a52c04784a add arc4random_{buf,uniform}, from OpenBSD. 2011-02-04 22:07:07 +00:00
christos 41ed061fdf PR/44514: Andrey Simonenko: Buffer underflow in RPC library for non-blocking
TCP sockets
2011-02-04 17:38:15 +00:00
christos 4a4722163b knf - no functional changes 2011-02-04 17:36:54 +00:00