Commit Graph

14637 Commits

Author SHA1 Message Date
jakllsch
cfb57741fb Imlementations of fmax, fmaxf, fmin and fminf libm functions for VAX. 2011-01-09 02:32:13 +00:00
pooka
8ee1967622 Support dual kernel select() by emulating it with pollts(). It
would have been much easier if up to and including 5.0 we wouldn't
silently cap the nfds argument to poll(!!!).

Makes things like socket(1) work out-of-the-box, and pretty much
every other decidedly prehistoric select() user.
(netcat is a slight exception since it sets FD_SETSIZE, a.k.a.
interface-of-the-year, to 16)
2011-01-08 21:30:24 +00:00
pooka
270275f700 support pollts and rewrite poll in terms of pollts 2011-01-08 18:11:46 +00:00
pooka
1cc3ec9f1f Support fork() and dup2().
This is sufficient to make an unmodified httpd(8) be able to serve
pages via a rump networking stack.
2011-01-08 14:19:27 +00:00
pooka
e9d1107acf Begin work on a syscall hijacking library which can be LD_PRELOADed
to convince non-rumped applications to communicate with a rump
kernel instead of the host kernel.  The precision of what goes
where is not exactly surgical, but for example when wanting to
debug a web server's TCP/IP stack interaction, it might be enough.
When all you have is a hand grenade, all problems look like a ....
hmm?

There's still plenty to figure out.  For example, I'm not sure what
the user interface will be like.  Now it just attempts to hijack
network communication.  It also needs to sync with symbol renaming
in libc, and maybe autogenerate the non-schizophrenic wrappers
where the communication is heading to exactly one destination, lest
I'll be a mummmy by the time I finish writing them all.  As a fun
example of a non-non-schizophrenic one, consider poll().

Work in progress, but I managed to get two non-rumped netcats
talking to each other or fetching the index from a non-rumped
thttpd.  telnet works in one direction (i can read the data from
netcat, but anything i send back is not printed).  bozohttpd uses
dup2() which i haven't bothered to address yet, etcetc.

(not hooking this up the build for now)
2011-01-07 19:52:43 +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
357983cc1c Make P2K_WIZARDUID require a valid integer instead of defaulting to root. 2011-01-07 16:02:32 +00:00
pooka
0d0a5842f8 Document how to get debug info for the mount. 2011-01-07 15:50:40 +00:00
pooka
27daa694a2 In case of a P2K_DEBUG mount, dump mount point contents when the
process receives SIGINFO.  Additionally, dump vnode status if the
process gets SIGUSR1 (can be quite quite verbose, therefore not
displayed with SIGINFO).
2011-01-07 15:47:14 +00:00
pooka
d32ef440df in case unmount fails (it never should), do a full mountpoint dump 2011-01-07 15:30:09 +00:00
pooka
cc30c34a93 Remove the componentname-saving code since it was addressing
SAVENAME/HASBUF/SAVESTART and they don't exist anymore (and the
removed code didn't compile on nb5).
2011-01-07 11:15:30 +00:00
pooka
4063bc515b Fix file handles. Problem reported & fix tested by kefren. 2011-01-07 10:18:06 +00:00
njoly
416b82e2e3 Fix macro (DV -> Dv). 2011-01-06 15:22:20 +00:00
blymn
0a965fa7ed Back out change for assume_default_colors as it was not correct. 2011-01-06 11:29:40 +00:00
pooka
c45d9404c0 Make rumpclient syscalls safe to call from signal handlers. 2011-01-06 06:57:14 +00:00
christos
221dcf2e47 Since localsub and gmtsub are called recursively to search for the local
time, setting EOVERFLOW at the inmost level will unfortunately persist,
even if later calls to those functions succeed. Move the EOVERFLOW setting
to the top level calls.
2011-01-06 02:41:34 +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
wiz
e97508602c Fix fdleak in #ifdef DEBUG. Found by cppcheck. 2011-01-05 00:03:52 +00:00
martin
27868e15e9 Special-case the (unlikely in practice) call with len = 2 - previously
the code would not have swapped anything. Problem pointed out by
sparc64 automatic test run.
2011-01-04 17:14:07 +00:00
pooka
d67d4f135c document rump_pub_lwproc_rfork() 2011-01-02 13:03:29 +00:00
pooka
3daddc031c rump_lwproc_newproc -> rump_lwproc_rfork 2011-01-02 13:01:45 +00:00
dholland
b845056678 Add an INRELOOKUP namei flag. Sigh. (We don't need more namei flags.)
However, because of a protocol deficiency puffs relies on being able
to keep track of VOP_LOOKUP calls by inspecting their contents, and
this at least allows it to use something vaguely principled instead of
making wild guesses based on whether SAVESTART is set.

Update libp2k to use INRELOOKUP instead of SAVESTART.
2011-01-02 05:04:58 +00:00
pooka
2aa9fbc0b2 Allow rump kernel to call dlsym(RTLD_DEFAULT). 2010-12-30 15:47:30 +00:00
christos
61a5737280 off by one 2010-12-28 16:19:25 +00:00
jnemeth
fd52cff654 vsnprintf_ss does NOT handle floating point formats 2010-12-26 12:39:54 +00:00
blymn
bcc3426f98 Little bit more debug information. 2010-12-25 10:08:20 +00:00
blymn
58f5b3b32b Ignore request to change the values of colour pair 0
Explicitly set foreground and/or background colours when -1 is passed
to assume_default_colors()
2010-12-25 10:05:08 +00:00
blymn
0ddf818977 Allow attributes to be applied to the default line drawing characters
by just passing attributes as arguments to the wborder call.
2010-12-25 09:59:52 +00:00
christos
6ef213c85c restore lost overlow check fix. 2010-12-24 15:47:39 +00:00
skrll
f1d73a2c94 Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.
2010-12-24 12:41:42 +00:00
christos
5448347830 make this thread-safe. We could use localtime_tz and make it even better,
but not now.
2010-12-24 03:37:37 +00:00
christos
736ce759b3 use pthread__stacksize since size has not been initialized yet. 2010-12-22 22:41:45 +00:00
christos
5cea6e6df8 only mprotect base if we moved it. 2010-12-22 22:19:46 +00:00
wiz
207ab8d006 Add punctuation. 2010-12-22 17:06:03 +00:00
christos
92a95e7ba4 document vsnprintf_ss 2010-12-22 16:59:10 +00:00
wiz
c03e55e8e9 Remove trailing whitespace. 2010-12-22 09:12:28 +00:00
christos
a504543f04 fix incorrect overflow check from Nicholas Joly 2010-12-21 18:13:02 +00:00
christos
537ea48995 - document limitations
- add extra number name parsing
2010-12-21 00:15:10 +00:00
christos
2e63e08217 - fix off by one in comparison with 69 (it should be 70)
- add aliases for 1 (one), 2 (two), etc.
- allow parsing of HH:MM:SS.sss as the man page mentions, and ignore sss
2010-12-21 00:14:10 +00:00
wiz
817bb39979 Remove trailing whitespace; sort errors; spell "variadic" like
Wikipedia or GNU libc.
2010-12-19 22:19:27 +00:00
christos
4d653f4318 Make the ioctl prototype reflect reality and explain why. Also mention that
the generic file descriptor manipulation ioctls are superceded by the
equivalent fcntl one.
2010-12-19 16:54:10 +00:00
jruoho
5c9efd7bb1 Xref __builtin_return_address(3). 2010-12-19 09:33:52 +00:00
jruoho
a20c806d96 Small modifications to wording, tidy up SEE ALSO. 2010-12-19 08:28:40 +00:00
jruoho
6f013d76df Fix SYNOPSIS, add CAVEATS. 2010-12-19 08:21:36 +00:00
christos
66f16a1fa6 I've had this patch in my tree for a while and since it only improves
the situation, I decided to commit it. There is an inherent problem
with ASLR and the way the pthread library is using the thread stack.

Our pthread library chooses that stack for each thread strategically
so that it can locate the location of the pthread struct for each
thread by masking the stack pointer and looking just below the red
zone it creates. Unfortunately with ASLR you get many random values
for the initial stack, and there are situations where the masked
stack base ends up below the base of the stack. (this happens on
x86 when the stack base happens to be 0x???02000 for example and
your mask is stackmask is 0xffe00000). To fix this, we detect the
pathological cases (this happens only in the main thread), allocate
more stack, and mprotect it appropriately. Then we stash the main
base and the main struct, so that when we look for the pthread
struct in pthread__id, we can special case the main thread.

Another way to work around the problem is unlimiting stacksize,
but the proper way is to use TLS to find the thread structure and
not to play games with the thread stacks.
2010-12-18 15:54:27 +00:00
njoly
53ac8d2f21 Fix typo in cross-refernce. 2010-12-17 23:57:07 +00:00
christos
3a693ad8ca PR/44248: Antti Kantee: Fix multi-threaded localtime hang. 2010-12-17 23:11:57 +00:00
njoly
9f266c104e Fix cross-reference, dir(5) -> dirent(3). 2010-12-17 19:20:42 +00:00
wiz
db9d3e0efd Sort ERRORS. Fix a typo. Readd macro usage lost in previous.
Remove trailing whitespace.
2010-12-17 01:30:50 +00:00
wiz
a5f2300ef5 Sort SEE ALSO, add a serial comma. 2010-12-17 01:30:14 +00:00
wiz
72b0a97144 Use more markup. 2010-12-17 01:29:45 +00:00
joerg
c4120e324e Replace use of errlist with a single concatenated version and an offset
array. This requires less storage and avoids one runtime relocation per
errno value.
2010-12-16 22:52:32 +00:00
christos
d6bc393ba9 it is getname not time. 2010-12-16 22:18:37 +00:00
christos
84df4ad5ec add the 3 missing man pages. 2010-12-16 21:53:56 +00:00
christos
5a87b22ec6 Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
2010-12-16 18:36:47 +00:00
jruoho
595da22eed Reference __builtin_object_size(3) and attribute(3) with each other. 2010-12-16 17:50:39 +00:00
wiz
3d3c5d42cb Observe the following spelling:
- wide character (noun)
- wide-character (adjective)

Inspired by jmc@OpenBSD.
2010-12-16 17:42:25 +00:00
wiz
9d8035939e Add missing word. 2010-12-16 17:17:07 +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
02d25938f6 Describe the rump_sp facility a bit. 2010-12-16 15:29:28 +00:00
pooka
f55f15b84d xfer rump_etfs 2010-12-16 12:39:39 +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
jruoho
9f95187844 .Fn, offset indent, complete reference. 2010-12-16 12:08:16 +00:00
jruoho
fe6e1d361b Fix the references and -offset indent. 2010-12-16 11:57:20 +00:00
jruoho
c1a91d0bee Use .Fn. 2010-12-16 11:49:35 +00:00
wiz
d714991586 Use full month name in dates. 2010-12-16 10:08:27 +00:00
plunky
aaac48679d bump date for previous 2010-12-16 08:45:32 +00:00
plunky
a1c148fc46 remove unnecessary step in example code
(sdp_service_attribute() did that already)
while here, start new paragraph for next example
2010-12-16 08:44:23 +00:00
jruoho
91e230c6b8 Fix xref; module(4) -> module(7). 2010-12-14 16:23:59 +00:00
jruoho
5c1bce6b00 Reference strsuftoll(3) and orders(7) with each other. 2010-12-14 13:00:34 +00:00
joerg
674a655551 Prefix ctype bitmask macros with _CTYPE 2010-12-14 02:28:57 +00:00
pooka
0c0346ae48 Don't __weak_alias non-existent symbols. Apparently the alpha
compiler doesn't like it.
2010-12-13 23:10:12 +00:00
pooka
5f35396ed8 last of the RUMP_ACTION syscall swappers 2010-12-13 21:07:54 +00:00
pooka
2f36209c20 Mirror sysctlgetmibinfo RUMP_ACTION change. 2010-12-13 14:17:11 +00:00
jruoho
05a9f55544 Xref module(4). 2010-12-13 10:07:46 +00:00
pooka
33c6814d7a document abortop. part of PR kern/44208 2010-12-13 09:06:51 +00:00
joerg
230ccda64c Don't bother with SCCS or the other RCSID conditionals. 2010-12-12 22:34:44 +00:00
christos
b3ddcb3ea2 errlist.c is automatically generated now. 2010-12-12 20:22:48 +00:00
christos
5eeef29dbe remove comment 2010-12-12 20:16:09 +00:00
christos
91083d6e86 Automatically generate the error list. 2010-12-12 20:08:27 +00:00
christos
245a0c0325 remove old libpcap. 2010-12-12 18:52:41 +00:00
christos
49f71b9cd5 PR/42549: Izumi Tsutsui: parsedate does not work after 2038.
Fix multiple issues:
- Remove bogus 2038 check and add overflow checks in the appropriate places.
- Correct incomplete leap year calculation that broke things after 2100.
- Check localtime return values
- Change int calculations to time_t to avoid oveflow.
- Consistently check/return -1 and remove bogus comment about not being
  able to return -1.

Now:
$ date -d 20991201
Tue Dec  1 00:00:00 EST 2099
$ date -d 40991201
Tue Dec  1 00:00:00 EST 4099
$ date -d 10000000991201
Tue Dec  1 00:00:00 EST 1000000099
TIME=0:04.48 CPU=117.8% (5.288u 0.000s) SWAPS=0 (0+95)pf (0i+0o) (0Kc+0Kd)
$ date -d 100000000991201
date: Cannot parse `100000000991201'
TIME=0:53.48 CPU=99.2% (53.086u 0.000s) SWAPS=0 (0+96)pf (0i+0o) (0Kc+0Kd)
Exit 1
2010-12-12 18:39:57 +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
plunky
90c70dd232 rearrange libraries to reduce the number of .WAITs (14 -> 6)
during that, fix some outdated comments & list dependents
2010-12-12 12:09:51 +00:00
tsutsui
be1c859466 We can't assume syscall retains t0, unless it's documented as ABI. 2010-12-12 09:03:06 +00:00
tsutsui
f3f411dad2 brk(2) should update __curbrk, not __minbrk or garbage. 2010-12-12 09:00:37 +00:00
joerg
6ccee47911 Revert last as gcc(1) checks for -r to disable passing down --relax e.g.
on Sparc.
2010-12-10 20:06:17 +00:00
abs
eb439bf1a7 Add noieee versions for lround(), lroundf(), lrint(), lrintf(),
llrint() and llrintf().  Code copied from round(), roundf() and
rint() and modified for return values.  Its possible this may not
do the right things in edge cases, but if so its likely to have
the same issues as the existing round(), roundf() and rint().

All this used by vax (only), and should allow xnest to complete
build.
2010-12-09 22:52:59 +00:00
joerg
cb6cc2679c Wrap sys_errlist constants in a macro to make it easier to extract
the strings reliably with sed/awk.
2010-12-09 21:27:31 +00:00
njoly
a2a0aef6cd s/curses_fileo/curses_fileio/ in xrefs. 2010-12-09 13:26:27 +00:00
njoly
b0b35bdc77 Add missing space in fread xref. 2010-12-09 11:21:49 +00:00
njoly
5db815a78e Convert a few macros to Vt (variable type). 2010-12-09 09:22:31 +00:00
christos
75a9445418 use %option noinput 2010-12-08 03:19:19 +00:00
joerg
72183148bb Explicitly pass down -r as linker option. 2010-12-08 02:07:25 +00:00
joerg
3b7d8067b3 Don't redeclare __isthreaded. 2010-12-08 02:07:03 +00:00
joerg
6ab2cfd0b3 Use __isthreaded from reentrant.h and don't redeclare it. 2010-12-08 02:06:38 +00:00
joerg
7a8f98483f input() is not used, so don't provide it. 2010-12-08 02:05:39 +00:00
joerg
bd9a53cf30 Since limit and l are both unsigned, comparing to 0 doesn't work, so compare
the values directly.
2010-12-07 22:02:52 +00:00
joerg
e325eedcc1 Remove tautology. 2010-12-07 22:01:45 +00:00
joerg
aaf356760f Mark function as static and give it an explicit return type. 2010-12-07 22:01:22 +00:00
joerg
cb63bb73c3 Don't use argument as direct format string. 2010-12-07 20:10:53 +00:00
joerg
c37869d883 Build assembler sources with assembler compile rules. 2010-12-07 19:51:02 +00:00
pooka
248168affc Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols. 2010-12-06 14:50:34 +00:00
dholland
eb1ab8ee50 Improve previous to avoid changing the interface of an externally
exposed function. (But note that this function is neither documented
nor declared in any installed header file, and it probably should not
be externally exposed.) Related to PR 44183, closes PR 44186.
2010-12-06 00:05:38 +00:00
pooka
fee25d6c52 rumpcrypto should never have been its own faction, so finally make
it a component under kern, i.e. rumpcrypto -> rumpkern_crypto.
2010-12-05 20:11:21 +00:00
christos
3542a25b9b hook new libpcap 2010-12-05 05:58:12 +00:00
plunky
f33b316b63 Remove the do-external-lib and do-gnu-lib targets, along with
external/lib/Makefile and crypto/external/lib/Makefile, replacing
them all with SUBDIRs directly from lib/Makefile.

compat/compatsubdirs.mk becomes simpler now, as everything is built
from lib/Makefile, meaning all the libraries will now be built under
compat so update the set lists to account for that.
2010-12-03 21:38:46 +00:00
dholland
574c2fc5a2 add const, from PR 44183. 2010-12-02 04:42:46 +00:00
dholland
92417c82c1 Fix up bodgy code for printing completion matches; it used to sometimes
skip entries, print (null), run off the end of the array, or occasionally
receive SIGSEGV, and now will, hopefully at least, do none of that.

Based in part on the patch in PR 44183 from Sergio Acereda; I also
did some tidyup and fixed it to print top-to-bottom first like ls(1).
2010-12-02 04:35:17 +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
cc95cda0d4 lintsquelch 2010-11-30 22:30:43 +00:00
wiz
5657c17871 Add some consistency dots though they make not much typographic sense; however,
just as much as in the other places in the enumeration.
Use Pa for a path.
2010-11-30 22:00:01 +00:00
jruoho
b4ba5c1508 Xref glob(7). 2010-11-30 21:03:07 +00:00
pooka
ff46270ebc Hands off of stuff we need to keep hands off of. 2010-11-30 20:33:43 +00:00
pooka
82747810db Add missing .El
Maybe next we can have typoed comments break builds?
2010-11-30 19:50:25 +00:00
joerg
cb0b8d7cc6 Fix stack alignment for non-constructor/destructor calls.
AMD64 stack is 16 Byte aligned at the start of the function,
so always push rbx.
2010-11-30 18:37:59 +00:00
pooka
0161ae951b ahem, use public interface names in the doc 2010-11-30 18:08:46 +00:00
pooka
fe96301432 document rump_etfs 2010-11-30 17:32:28 +00:00
pooka
9670fcaf80 Remove dead code from previous revision. 2010-11-30 15:42:11 +00:00
tnozaki
96bcb898d4 variable must to be nul terminated before "CODESET=foo".
ISO2022 module doesn't understand this and may fail setlocale(3).
2010-11-30 15:25:05 +00:00
pooka
fbdc3da9ae Change RUMP_SP_CLIENT to RUMP_SERVER. The former was, in addition
to being annoying to write, slightly misguiding, since it contains
the server url.
2010-11-30 14:24:40 +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
dholland
297e393f26 SAVENAME and HASBUF namei flags have been removed; update accordingly.
(pooka@ says not to worry about compat.)
2010-11-30 10:49:22 +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
drochner
240e9917d0 fix accuracy problems in argument ranges where j0(x) is small, closes
PR lib/44170 by Henning Petersen
(originally from Steven G. Kargl per FreeBSD PR bin/144306)
2010-11-29 15:10:06 +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
skrll
15fa0783d7 Centralise USE_COMPILERCRTSTUFF.
PCC might need help.
2010-11-28 18:40:54 +00:00
wiz
80b39d395e Fix typo in comment. 2010-11-28 01:31:26 +00:00
wiz
cb676ec98b Remove superfluous comma. 2010-11-28 01:28:21 +00:00
christos
fabd9ea05b explain better what's going on here. 2010-11-28 00:50:16 +00:00
jnemeth
22405528a4 Rename the autoloaded property list from <module>.prop to <module>.plist
as discussed on tech-kern.
2010-11-28 00:26:38 +00:00
christos
5fe11453fa fix lint warning. 2010-11-27 21:22:11 +00:00
christos
d5ea004dc7 Implement VIS_NOESCAPE and VIS_HTTP1866. 2010-11-27 19:44:21 +00:00
christos
b77d89c7da ansify 2010-11-27 18:33: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
dholland
01cef2d63e Return error on failure instead of hiding it and always returning zero.
From Henning Petersen in PR 44152.
2010-11-26 22:01:53 +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
404fa78c67 update comment 2010-11-26 11:12:06 +00:00
pooka
22b33166de rumpuser should not be included outside of the rump kernel (and
rumpuser itself)
2010-11-26 11:10:53 +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
dholland
6e4e77d46e No file system I know of reports directory sizes that are multiples of
sizeof(struct dirent) except by accident. So, sync with reality. Brought
to my attention by Taylor R Campbell in chat.
2010-11-25 20:53:23 +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
5e5fac56c7 update locking proto, use unputwait 2010-11-24 17:03:39 +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
christos
05f534f3c7 PR/44132: Wolfgang Stukenbrock: libc/rpc may overwrite not-allocated memory
Return XPRT_DIED when realloc fails for lack of a better error.
2010-11-23 14:02:01 +00:00
pooka
85503d7b13 Install rumpclient to /lib to allow non-/usr users.
pointed out by tron (thanks!)
2010-11-23 12:41:47 +00:00
tnozaki
115137ad39 to initialize mbstate_t, use memset instead mbrtowc. 2010-11-23 05:38:35 +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
plunky
33166e16fa use cached values directly rather than querying device for
features and buffer_size
2010-11-22 19:59:04 +00:00
adam
d26d65ff82 Use ssh_add_identity_constrained() instead of ssh_add_identity() 2010-11-21 20:41:36 +00:00
christos
cd56d093b1 build the ldap libraries; am-utils needs them. 2010-11-21 03:43:39 +00:00
plunky
231f6b581d use atomic ops wisely 2010-11-20 12:12:21 +00:00
pooka
ad5cf5ab43 squelch the compiler whine 2010-11-19 17:47:44 +00:00
pooka
120195d187 document RUMP_NVNODES 2010-11-19 17:35:04 +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
christos
b0f3f04a67 PR/44113: Nicolas Joly: printf(3) should ignore zero padding for nan/inf 2010-11-19 00:44:18 +00:00
pooka
48257b3e61 free syscall data after use 2010-11-17 17:36:14 +00:00
tron
4a3a313897 Include "namespace.h" to get namespace protection. 2010-11-17 13:25:53 +00:00
tron
aacd5349be Provide proper namespace protection for rbtree(3) because it is now
used by "libc" internally.
2010-11-17 13:19:32 +00:00
tron
d0e6f50de3 Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment array which
    is no longer used because the application overwrote "environ".
2.) We find a non-NULL pointer in the allocated environment array after
    the end of the environment. This happens if the applications attempts
    to clear the environment with something like "environ[0] = NULL;".
2010-11-16 17:23:10 +00:00
enami
4f54ea7667 Fix typos in comment. 2010-11-16 03:02:20 +00:00
christos
a85c37d8d9 don't increment i twice in the loop. From Michael Byrnes 2010-11-15 21:24:31 +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
tron
103af04b49 Don't use internal libc function __findenv(). 2010-11-14 22:25:23 +00:00
tron
2f85740ecc 1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
    *internal* interface. It turns out that ld.elf_so(1) and pthread(3)
    both use it.

Stripping e.g. "LD_LIBRARY_PATH" from the environment while running
setuid binaries works again now.
2010-11-14 22:04:36 +00:00
tron
268c79e4cc Set errno to ENOENT if we reject the environment variable name in
getenv_r() instead of leaving it unchanged.
2010-11-14 20:37:02 +00:00
tron
fbf4aa1699 Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
  suggested by Enami Tsugutomo in private e-mail.
  This simplifies the code a lot as we no longer need to keep the size
  of "environ" in sync with an array of allocated environment variables.
  It also makes it possible to free environment variables in unsetenv(3)
  if something has changed the order of the "environ" array.
- Fix a bug in getenv(3) and getenv_r(3) which would return bogus
  results e.g. for " getenv("A=B") " if an environment variable "A"
  with value "B=C" exists.
- Clean up the internal functions:
  - Don't expose the read/write lock for the environment to other parts
    of "libc". Provide locking functions instead.
  - Use "bool" to report success or failure.
  - Use "ssize_t" or "size_t" instead of "int" for indexes.
  - Provide internal functions with simpler interfaces e.g. don't
    combine return values and reference arguments.
  - Don't copy "environ" into an allocated block unless we really need
    to grow it.

Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by
Joerg Sonnenberger and me. These changes also fix problems in
zsh 4.3.* and pam_ssh according to Joerg.
2010-11-14 18:11:42 +00:00
plunky
9dc6fb5c3d quell some lint warnings 2010-11-13 19:43:56 +00:00
christos
f214ecbad3 forgot to commit this one for two months!
add vdprintf.
2010-11-13 19:41:32 +00:00
uebayasi
9a0d0defa9 Fix build. 2010-11-12 04:52:08 +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
enami
5260b632e4 Clear all entries past the NULL while scrubing environ vector. 2010-11-10 02:40:08 +00:00
enami
ef075363bd Indent using tab rather than four spaces. 2010-11-10 02:33:49 +00:00
pooka
2ddc760fc7 Need getifaddrs() for the rump client since it executes sysctl(2) 2010-11-05 16:23:56 +00:00
pooka
08fc937c06 make sysctl(8) work as a rump client 2010-11-05 15:55:23 +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
83463bddd0 use -1/errno for failure: it's much more convenient for the users 2010-11-05 13:50:48 +00:00
blymn
eb6f26d7ad Don't echo key symbols. 2010-11-05 11:38:54 +00:00
christos
ee29967bad scrub the whole array, not just the first n malloced entries. 2010-11-04 21:49:45 +00:00
pooka
6b1f3dc0a5 Add library for rump syscall client stubs. 2010-11-04 21:01:28 +00:00
pooka
13e503f148 Refactor the sysproxy code so that rumpuser contains only the server side. 2010-11-04 20:54:07 +00:00
christos
9bc86f7706 PR/43998, PR/44021: In narrow history emulation, don't treat UTF-8 character
sets specially as far as history goes since we always need to do the conversion
from narrow [history] to wide [editline].
2010-11-04 13:53:12 +00:00
plunky
5cf5f72e75 this page title is CDBW 2010-11-03 16:17:48 +00:00
christos
3954ad831d Handle the case where a program attempted to cleanup the environment by
setting *environ = NULL;
2010-11-03 15:01:07 +00:00
skrll
162991256a Spell immediately correctly. 2010-11-02 20:49:47 +00:00
enami
b447d18264 - Simplify the code
- Reword the comment.
2010-11-02 03:44:05 +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
enami
ee9d44a7c1 Double the array only when really necessary. Otherwise memory will be
exhausted if user modifies the variable envrion itself repeatedly..
2010-11-01 02:41:27 +00:00
mbalmer
aa94cc597c Link Lua to the build and add the resulting files to the distribution sets.
Document the addition of Lua and the change we made to the default settings.
2010-10-31 11:52:50 +00:00
pooka
4b75e68c49 update with reality 2010-10-29 15:38:15 +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
wiz
51a05c8628 Fix a typo and remove trailing whitespace. 2010-10-27 19:18:00 +00:00
christos
de19ef9132 markup improvements, document ctype_r, time_t is not a "long integer" 2010-10-27 19:16:04 +00:00
wiz
83306973da Improve wording after consultation with njoly. 2010-10-26 22:34:33 +00:00
njoly
5d63576039 Make putenv(3) fails with EINVAL for a null pointer, or for a string
that either miss or start with a `=' character.

Adjust man page and testcase accordingly.
2010-10-25 20:35:36 +00:00
wiz
ecad7beb9c Bump date. 2010-10-25 07:37:11 +00:00
dholland
6d14a316d9 Mention err/warn. Note that they're generally preferred to perror().
Might want to strengthen the wording.
2010-10-24 23:10:51 +00:00
tron
1dc4fb4ea1 Double the size of the allocate environment vector when we resize it.
This should speed up extending the environment via setenv(3).
2010-10-24 17:53:27 +00:00
tron
410614d6b3 Replace _FPOS_OVERFLOW() macro with a static inline function called
__fpos_overflow() that doesn't cause any lint warnings.
2010-10-24 17:44:32 +00:00
christos
f70a466a92 fix fd leak found by Igor Zinovik 2010-10-23 23:27:40 +00:00
stacktic
7bede9ad38 Do not return -1 on _kvm_read when all the requested data could be read (fix bin/38648) 2010-10-23 14:34:12 +00:00
christos
3dbfe3dd7e tell lint to shut up. 2010-10-23 14:12:50 +00:00
christos
13fa4dc134 not that it can happen, but make the test more robust. 2010-10-22 22:00:32 +00:00
christos
ec053f73a0 implement EOVERFLOW 2010-10-22 21:29:45 +00:00
christos
603e33ef32 Fix return value documentation. Add EOVERFLOW for ftell, but not for fseek. 2010-10-22 21:29:31 +00:00
njoly
4c968434a3 Make setenv(3) follow the standard, by rejecting invalid strings. It
now fails with EINVAL errno when variable is NULL, empty or contains
an `=' character; or value is NULL.

Adjust the man page accordingly, and exercize them in the existing
environment testcase.
2010-10-16 11:23:41 +00:00
skrll
e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
christos
f207e61c08 replace `` with $(). Hopefully with enough examples around people will
forget about ``.
2010-10-12 12:57:51 +00:00
christos
e6dabc3c76 PR/43961: YAMAMOTO Takashi: uninitialized variable in termcap.c
Remove dead code.
2010-10-12 12:49:27 +00:00
manu
f4f951a0c1 Remove code supporting SOCK_STREAM, as SOCK_DGRAM works fine 2010-10-11 05:37:58 +00:00
manu
f782f0a9e3 FUSE filesystems' readlink returns a resolved link with a NUL trailing
character, and PUFFS do not want it. This fixes this bug, that returned
stat the informations for x instead of reporting ENOENT:
mkdir x && ln x z && stat -x z/whatever/you/want
2010-10-11 01:52:05 +00:00
manu
5b646d774b - fix access control: pcn->pcn_cred is not user credentials
- Keep track of file generation
- remove size tracking in pnd_size, we have it in pn_va.va_size
2010-10-11 01:08:26 +00:00
enami
3cef3e6eba The was is not an argument but simply a part of sentense. 2010-10-07 00:14:14 +00:00
jym
f15c6971d1 Import PAE support for kvm(3):
- add kvm_i386pae.c (used for PAE memory translations), and update Makefile
  for libkvm build.
- in pdppaddr: pass a flag to indicate PAE mode. Use a bit ignored
  by the MMU. Mask address with PG_FRAME to avoid side effects.

Tested with vmstat(1)/netstat(1) to debug core files of PAE and !PAE
kernels. Older kernel dumps will default to native i386 (!PAE) mode.

XXX Currently, savecore(8) will fail to dump a PAE kernel in a !PAE
    environment (and reciprocally). So you need to sync and reboot
    with a kernel of the same mode as the one that crashed. Once the dump
    is successful, this does not matter anymore.
2010-10-05 23:48:16 +00:00
enami
4a94dc0b8f Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".
2010-10-05 02:23:38 +00:00
manu
3a9497b97a - delete an obsoelte comment about inactive
- remove a test for getattr return field that was never filled
- correctly send filehandle and filehandle flags for getaattr
2010-10-04 03:56:24 +00:00
manu
2ff0ea03a7 - Correctly handle rename whith overwritten destination
- Keep track of file name to avoid lookups when we can. This makes sure we
  do not have two cookies for the same inode, a situation that cause wreak
  havoc when we come to remove or rename a node.
- Do not use PUFFS_FLAG_BUILDPATH at all, since we now track file names
- In open, queue requests after checking for access, as there is no merit
  to queue a will-be-denied request while we can deny it immediatly
- request reclaim of removed nodes at inactive stage
2010-10-03 05:46:47 +00:00
tron
ae557324e5 Restore binary compatibility with applications which use putenv(3)
on constant strings (e.g. postdrop(1)):
- Don't write to the environment string passed to putenv(3).
- Don't overwrite the value of an existing environment string
  unless the memory was actually allocated by setenv(3).
2010-10-02 16:56:03 +00:00
tron
c3bcf19cf7 Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.
2010-10-02 10:51:07 +00:00
tron
12c10b36d2 Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
2010-10-02 10:05:55 +00:00
wiz
732dd678dd Fix a typo, remove trailing whitespace. 2010-10-01 20:57:50 +00:00
christos
7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
tron
2445ce72d2 Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.
2010-09-30 12:41:33 +00:00
manu
f7174423c5 = Open files =
- Restore open on our own in fsycn and readdir, as the node may not already
be open, and FUSE really wants it to be. No need to close immediatly, it
can be done at inactive time.

= Write operations =
- fix a nasty bug that corrupted files on write (written added twice)
- Keep track of file size in order to honour PUFFS_IO_APPEND

= many fixes in rename =
- handler overwritten nodes correctly
- wait for all operations on the node to drain before doing rename, as
filesystems may not cope with operations on a moving file.
- setback PUFFS_SETBACK_INACT_N1 cannot be used from rename, we therefore
miss the inactive time for an overwritten node. This bounds us to give up
PUFFS_KFLAG_IAONDEMAND.

= Removed files =
- forbid most operations on a removed node, return ENOENT
- setback PUFFS_SETBACK_NOREF_N1 at inactive stage to cause removed
file reclaim

= Misc =
- Update outdated ARGSUSED for lint
- Fix a memory leak (puffs_pn_remove instead of puffs_pn_put)
- Do not use PUFFS_FLAG_BUILDPATH except for debug output. It makes the
lookup code much simplier.
2010-09-29 08:01:10 +00:00
enami
be59ef257e If new length is exactly equals to the current length,
there is nothing to do.
2010-09-29 00:44:04 +00:00
enami
248290ef3a Don't put space before close paren. 2010-09-29 00:40:17 +00:00
enami
abfd061908 Add missing period at the end of sentense. 2010-09-28 00:39:56 +00:00
tnozaki
9ef74dfbcf validate flags/oflags from __sflag() befere call __sfp().
reviewed by enami-san, thanks.
2010-09-27 17:08:29 +00:00
tnozaki
6d102a3218 fix off-by-one, pointed out by enami-san, thanks! 2010-09-27 16:50:13 +00:00
jym
8bb0c87c7e Define KREAD() inside kvm_private.h, for reusability. 2010-09-26 22:28:05 +00:00
yamt
ab5972b02c fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.) 2010-09-26 02:26:59 +00:00