Commit Graph

14932 Commits

Author SHA1 Message Date
jruoho cb0f983e60 Improve -width. 2011-03-29 18:54:54 +00:00
jmmv 255271589f Extend pidfile(3) to support creating pid files in arbitrary locations.
If the argument provided to pidfile(3) contains a '/', then the value is
considered to be an absolute/relative path and the pid file is created
in the given location.

Otherwise, pidfile(3) behaves as before and treats the provided value as
a basename to construct a pid file in /var/run/<basename>.pid.  This means
that to create a pid file named "foo.pid" in the current directory, one
must specify "./foo.pid".
2011-03-29 13:55:37 +00:00
martin ecf8c9b0f0 ABI police: avoid cluttering global registers %g2 and %g7. Not quite there
yet for %g2, but the target is not very well defined. %g7 should be clean
now.
2011-03-28 11:19:12 +00:00
wiz 7091eebfa9 Whitespace and punctuation. 2011-03-27 22:55:07 +00:00
wiz 971b386cde Oh no -- a space! get rid of it, quick. 2011-03-27 22:51:35 +00:00
njoly 119aff4da3 Fix sigprocmask section (3 -> 2). 2011-03-27 12:53:16 +00:00
njoly 63adbe29fb Fix xref, arm32_sync_icache -> arm_sync_icache. 2011-03-27 12:48:41 +00:00
he 08a8bf5254 Fix this so that it builds for vax; where the compiler balks at the
mixture of a union and a double in an expression (imagine that!)
I see other similar uses, and how they pass through for other ports
is beyond me, but I have not touched them in this round.

OK'ed by christos@
2011-03-27 11:21:54 +00:00
christos 2587e6e437 add fpgetprec/fpsetprec 2011-03-26 19:51:41 +00:00
njoly 82815469fb Add quotes for multi-words width string. 2011-03-25 17:15:26 +00:00
pooka 9fdb8e5eff mention rumphijack 2011-03-25 16:13:05 +00:00
pooka 0446c4bc83 add paragraph about kernel clients 2011-03-25 16:07:43 +00:00
joerg 6c7179c5fb Remove support for the old BSDCTYPE format. 2011-03-25 00:45:24 +00:00
bouyer d9210c2405 Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
2011-03-24 17:05:39 +00:00
dholland 8ba9dddb47 Eliminate dead store. From Henning Petersen in PR 42776. Doesn't change
the output .o file.
2011-03-24 02:29:33 +00:00
martin d2c615416b Avoid using %g7 2011-03-23 20:54:35 +00:00
pooka f347b4496a make work on nb5 again 2011-03-22 22:27:33 +00:00
martin 0c3a269fd8 Remove the sparc-v7 compatibility wrapper functions (.div, .mul, ... .urem),
the compiler never generates (or did generate in the past) 64bit code to call
them, and they are still present in our 32bit compat library.
2011-03-22 12:24:53 +00:00
jruoho a8287d0554 * As is customary, append the parameter names from
SYNOPSIS to the description of the functions.

* Use .Ss for non-standard subtitles.

* Fix two identical subtitles.

* Add missing .It's, fix few .Ft's.

* Use a little more markup.

* Improve offsets.
2011-03-22 07:28:41 +00:00
enami df36fea7b7 Don't use #endif where #else is expected. 2011-03-21 23:37:42 +00:00
christos 2b13247b7f pacify lint. 2011-03-21 22:33:46 +00:00
christos a9f77bad7a Add Emin for the vax. Need to check 2011-03-21 22:33:29 +00:00
christos ab9f1e36c8 fix vax typo. 2011-03-21 19:46:41 +00:00
pooka dc8b381a32 update copyright 2011-03-21 16:41:27 +00:00
christos 374ecd4b4c more de-linting. 2011-03-21 12:53:50 +00:00
christos a23ced05b4 fix some lint on i386 2011-03-21 04:52:09 +00:00
jruoho e1897fd6ba Fix xref; security(8) -> security(7). 2011-03-21 04:42:50 +00:00
christos a46656e6ee Add ld formats for the unit-tests. 2011-03-20 23:16:07 +00:00
christos 61e56760bc Merge the new gdtoa: Note that the built-in tests fail the same way as with
the old gdtoa.
2011-03-20 23:15:35 +00:00
bouyer 6d537d7313 Fix use-after-free. Discovered by running tests with MALLOC_OPTIONS=J
(should this be the default for tests ?), pointed out by njoly@
2011-03-20 12:36:14 +00:00
christos 3e812ebec1 don't need these and they break the build 2011-03-19 21:26:02 +00:00
christos 185969dd49 from www.netlib.org 2011-03-19 16:26:36 +00:00
he 83a6b62058 It would be nice if lint knew that abort() will never return.
For now just insert a /* NOTREACHED */ comment to fix the build failure.
2011-03-18 14:56:01 +00:00
roy f42fd8d0f1 Simplify some conversion by usig pre formatted strings and a function
to print a parameter.
2011-03-18 10:42:54 +00:00
martin 30b9b129ac Test the proper array index. Discovered by sparc64 automatic test runs. 2011-03-18 09:07:20 +00:00
joerg 5349df0309 Add missing MLINKS. From Stathis Kamperis. 2011-03-18 00:57:19 +00:00
skrll a59f1998c0 Appease the hppa linker. 2011-03-17 22:13:58 +00:00
wiz b8e9a97310 Fix SYNOPSIS. Error found by martin. 2011-03-17 14:06:29 +00:00
matt 353ac4a525 Since this is use pthread_int.h, it needs __LIBPTHREAD_SOURCE__ to be defined. 2011-03-17 01:01:15 +00:00
matt def13dad30 Add __HAVE___LWP_GETTCB_FAST support (for mips and powerpc). 2011-03-17 00:43:48 +00:00
joerg 01eef02a1b If TLS support is present, use it for pthread__self(). The
initialisation order is correct in this case as _lwp_setprivate has been
called already by ld.elf_so for dynamic programs or _libc_init for
statically linked ones.
2011-03-16 12:39:44 +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
mbalmer 7d564f115e Crosslink wcstombs(3) and mbstowcs(3). 2011-03-16 09:32:12 +00:00
erh dba1735a6e Remove one last reference to commaize_number.3 2011-03-16 01:30:24 +00:00
christos ab077958c3 goodbye short-live commaize_number(3), if you liked it:
#define commaize_number(s, l, n) snprintf(s, l, "%'llu", (unsigned long long)n)
2011-03-16 00:50:28 +00:00
pooka 754d118ee3 don't spam connection errors to stderr by default 2011-03-15 09:35:05 +00:00
wiz f675b9e58c Shorten Nd by putting the comment there in a paragraph in the body.
Use more markup. Sort SEE ALSO. Fix typo. Capitalize NetBSD like
we all love it.
2011-03-15 08:33:35 +00:00
matt c5d79d45e3 Properly support the MIPS TLS ABI. 2011-03-15 07:40:18 +00:00
erh 9a5590a540 PR#7540, add a commaize_number function, which inserts comma into a string
of digits to make it more readable.  This is soon to be used in /bin/ls.
2011-03-15 03:47:04 +00:00
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
njoly a8fd935b9b Add krb5_{mk,rd}_priv(3) links. 2011-03-14 13:53:55 +00:00
christos 50f9c0a390 OOPS has been reverted. 2011-03-14 11:44:20 +00:00
wiz b84d433045 Add serial comma, quote minus, fix NetBSD version in HISTORY. 2011-03-13 09:12:35 +00:00
wiz afb4355ad9 Add serial comma, quote minus, add HISTORY for strnunvis and strnunvisx. 2011-03-13 09:11:54 +00:00
mrg 8254d24b84 cast "~0" to (size_t) when passing to a size_t taking function.
fixes lint build errors.
2011-03-13 07:40:44 +00:00
joerg fecb31745a Avoid a dependency issue between pthread TLS by using simple atomic
initialisation, possibly running the initialisation loop more than once.
2011-03-12 21:55:09 +00:00
christos 2d8f83e77b Fix various vis/unvis issues:
- no need for all the weak symbols
- define a new _VIS_END flag for UNVIS_END so that there are no collisions
  between and vis and unvis flags.
- add bound versions of the vis and unvis functions that take the length of
  the destination buffer. Unlike the OpenBSD ones they return -1 or NULL if
  the buffer is not large enough, instead of silently truncating.
2011-03-12 19:52:45 +00:00
matt 01061e574e Don't initialize %r2 for SDA2_BASE anymore. It's needed for TLS. 2011-03-12 07:56:36 +00:00
matt 69358e3723 Add PPC TLS support. Add -D_LIBC_SOURCE for tls.c and _lwp.c (powerpc)
so that __lwp_gettcb_fast and __lwp_settcb inlines are define.
2011-03-12 07:55:09 +00:00
matt d972b61c0e Use __lwp_settcb if available. 2011-03-12 07:52:37 +00:00
matt 71fdb89287 Use __lwp_gettcb_fast if present. 2011-03-12 07:46:29 +00:00
christos 2dec048cbe avoid c99 2011-03-12 05:23:41 +00:00
christos 5dc359e2dd Prepare for strnvis functionality by providing a length to the encoding
functions.
2011-03-12 03:24:08 +00:00
christos 29ba757a34 revert OOPS change now that most of the reasons for tgoto to return NULL
have been eliminated.
2011-03-11 13:28:52 +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
roy df504c6413 Do our best to process invalid terminfo strings instead of just
returning NULL.
2011-03-10 13:39:26 +00:00
roy 9d7b5f143f Fix two other off-by-one errors when processing %P and %g commands. 2011-03-10 10:46:33 +00:00
roy 40109496d4 Add support for translating the following termcap commands into terminfo:
%B %D %r %2 %3 %d %+ %> %.
Fixes PR bin/44692.
2011-03-10 10:17:19 +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
roy 74cdc55234 Fix an off-by-one error when processing embedded values. 2011-03-10 09:45:32 +00:00
wiz 97b3b86219 Add serial commas. 2011-03-10 08:53:04 +00:00
joerg 3b9c90a96e Define namespace remap macros before including sys/tls.h. 2011-03-09 23:50:40 +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
joerg aad599979d Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.

Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.
2011-03-09 23:10:05 +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
tsutsui 7e1a38b9b3 Reorder insns to fix more load delay hazard botches on R3000.
Fixes floating point exceptions in _longjmp() during /etc/rc and
now NWS-3470D boots up to multi user with -current userland binaries.

Also fill BDslots in error path properly.
2011-03-09 16:10:29 +00:00
pooka a7f297977b * use _exit() instead of exit() in retryconn=die: atexit() handlers
may hang if the server is dead
* consistent use of data
2011-03-09 15:09:21 +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 57a486416f need -I${.OBJDIR} now 2011-03-08 19:11:27 +00:00
pooka c057875f13 create srcsys symlink 2011-03-08 18:30:24 +00:00
pooka d06a7e799a and for my next trick, i'm going to spell ARGSUSED correctly 2011-03-08 18:28:01 +00:00
pooka e48cccc4df lint love 2011-03-08 18:25:16 +00:00
pooka 7905447e1d Since we ~never have a frame waiting on the initial call to waitresp,
call kevent before readframe.  Doesn't really affect performance,
but makes ktraces shorter ;)
2011-03-08 15:55:12 +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
mlelstv c619be51ca Don't try to clean/build or install a library here, there are only
subdirectories.

Also, bsd.lib.mk requires a defined LIB, otherwise it will generate
unwanted commands during clean. It even failed on netbsd-4 where
'rm -f' needs at least one parameter which is missing due to recent
corrections in make/vars.c.
2011-03-08 09:49:42 +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
joerg 5c3ccd6eba Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-03-07 05:09:09 +00:00
christos 959ab2631c Restore historical behavior of tgoto() to return "OOPS" on failure. This is
best for now because there are too many programs that don't check the return
value of it. Of course cursor motion commands from $TERMCAP have 0 chance
of working now, since their % escapes are not translated to terminfo. In
the window case %+ expects one param from the stack in the termcap case
and two in the terminfo so we barf. We need proper captoinfo handling for
the % escapes, like the one in ncurses. Hi Roy :-)
2011-03-07 00:27:51 +00:00
wiz 9ef313636b Various fixes:
Remove trailing whitespace.
Sort sections.
Sort errors.
Fix typos.
Use more markup.
Probably something else I forgot.
2011-03-06 17:19:25 +00:00
bouyer 063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
christos ce009e37f0 Check bits on each loop to prevent integer oveflow.
Reported by Maksymilian Arciemowicz
2011-03-06 16:00:20 +00:00
martin 49f1dcc8e5 While we use hardware (for float and double), but cooperate with softfloat
(to do long double), we need to not only handle the hardware exception
mask and cummulated flags, but also update/query the softfloat variables.
Since this may go away sometime (to make us psABI compliant), ifdef it
properly.
2011-03-06 10:32:47 +00:00
martin 598174eb2b Apply local namespace protection equivalent to the weak alias done
in softfloat-for-gcc.h, which we can't include here, to move
"float_exception_mask" into implementation namespace.
2011-03-06 10:27:37 +00:00
martin a5ad420211 Use sigqueueinfo() instead of raise() to generate exceptions. Provide
minimalistic siginfo data.
2011-03-04 11:48:58 +00:00
yamt 5c50d59d8b puffs__cc_destroy: clear PCC_HASCALLER. the caller info is not
necessarily relevant to the next life of the cc.  this also fixes
the failure of the assertion in the next line.
2011-03-04 09:47:47 +00:00
christos cf7b1c6bb2 PR/44663: Corinna Vinschen: Fix misplaced parenthesis that produces the wrong
result.
2011-03-02 13:24:43 +00:00
soda fd45f5444a fuse_opt_parse() was using uninitialized struct fuse_opt_option::data,
this bug made fuse_opt_proc_t not work, if it used first ``data'' argument,
and might cause memory corruption even.
2011-03-01 11:23:42 +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
wiz 055ec59523 Whitespace nit. 2011-03-01 08:48:41 +00:00
haad 6024239e67 Fix problems in libdm manual page pointed by njoly@ thanks for help. 2011-02-28 23:23:08 +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
njoly 252a7f0f2e Small macro fix (SS -> Ss). 2011-02-28 09:10:28 +00:00
wiz 9e76b48586 Merge EINVAL descriptions; sort errors alphabetically; bump date. 2011-02-28 07:17:02 +00:00
dholland 4669b00fb3 Improve discussion of alignment and rounding per PR 33527. 2011-02-28 04:03:00 +00:00
pooka ee6e286c6f Take reasonable precautions against init in a parent process
which did a rump-transparent host-only fork().
2011-02-27 12:58:29 +00:00
pooka ee9b785d83 make error messages sensible. from uwe 2011-02-27 11:32:12 +00:00
christos ebc56329ec Add <stdint.h> for uint8_t from Jess Thrysoee 2011-02-27 01:53:22 +00:00
christos c0ee155271 Fix argument for EL_EDITOR from Jess Thrysoee 2011-02-27 01:51:37 +00:00
njoly 51cca89d16 Switch from floating point to fixed point integer for run sizes maths.
From FreeBSD (part of revision 1.154).
2011-02-26 23:27:49 +00:00
matt 2bf60042d7 When loading r13 and r2 with _SDA_BASE_ and _SDA2_BASE, do so in a PIC
manner.  With this change, simple programs can now run with MKPIE=yes
2011-02-26 17:11:23 +00:00
wiz 35124272d3 Remove duplicate "the". From Henning Petersen in PR 44640. 2011-02-26 12:56:35 +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 9e33d7d6e2 fix __RCSID 2011-02-25 15:12:06 +00:00
joerg b7b592d544 Back out using the thread register (if present) for now.
libgcc_s's __register_frame_info gets called from libc's CSU code before
the libc constructors are run. __register_frame_info in turn calls
pthread_mutex_lock. libpthread is not initialised at this point and
therefore pthread__self() traps when deferencing the thread register.
This worked before because the garbage from pthread__self() is
effectively ignored.
2011-02-25 14:32:38 +00:00
pooka 74ed8d21f3 fix my whitespace copypaste 2011-02-25 11:55:28 +00:00
pooka ba7613308e Fix LE softfloat (mostly theoretical) and comment.
from Alessandro Forin
2011-02-25 11:53:07 +00:00
pooka 8c15d641b0 Fix static fallback path. 2011-02-24 14:22:04 +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 e1463ae3cd Die with a sensible error message if a symbol cannot be found. 2011-02-24 09:52:34 +00:00
joerg 1631a78097 Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-02-24 04:28:41 +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
skrll 1548def5e3 Remove old hack for broken binutils. 2011-02-23 10:26:09 +00:00
tron fb1591b100 Remove "NOLINT" setting that was apparently committed by accident and
breaks the build.
2011-02-22 17:32:49 +00:00
pooka 27ec9b9d1d Add support for a byteswapped disklabel so that I can mount
NetBSD/sparc anita images on my i386.
2011-02-22 15:42:15 +00:00
pooka 97c20c765b Disable string aliasing for rump_syscalls.c. I can't figure out
how to otherwise make the kernel's register_t coreography to work
with the return value here in a MI fashion.
2011-02-22 14:02:54 +00:00
joerg 9674b81ed9 Introduce __weakref_visible to handle the different required visibility
for weak references. GCC 4.2+ and Clang require static, older GCC wants
extern. Change __weak_reference to include sym. This requires changes
the existing users to not reuse the name of the symbol, but avoids
further differences between GCC 4.1 and GCC 4.2+/clang.
2011-02-22 05:45:05 +00:00
christos 10e6f9749d remove duplicate weak aliases 2011-02-21 22:07:44 +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 611baabe1a xfer rump_server(1), downgrade experimentalness level a bit 2011-02-21 08:50:45 +00:00
pooka aa7f369f19 v-node -> vnode
(for consistency)
2011-02-21 07:11:11 +00:00
joerg 4bf46019d9 Redo the SSP wrappers to be transparent on the resulting object files.
This works by having the inline wrapper calling a second function which
uses renaming to output the correct function name.
2011-02-21 00:40:07 +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
joerg e189b01ad3 Support the different weakref semantic in GCC 4.2 and clang. 2011-02-18 23:41:57 +00:00
joerg 86df96f692 Allow building with the changed weakref semantic in GCC 4.2 and clang. 2011-02-18 23:37:36 +00:00
christos 01d6c84859 PR/44599: Steven Vernon: libedit acts as if no data read if editmode is turned
off because nread is uninitialized in the edit disabled case.
2011-02-18 20:53:05 +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 4674f09289 I think I skipped the class where they taught that multiplication
is done before addition...
2011-02-18 16:22:10 +00:00
pooka f836d17195 Improve isrmt() check: it cannot be a rmt fd if there are no pipes
open for the fd.  Prevents collision with rumphijack.

Also, prevent potential hyperspace memory access.

Does someone want to write tests for this facility?
2011-02-18 16:10:09 +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 aedd7db813 Support rest of file types in vtype -> s_ifmt 2011-02-17 17:55:36 +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
wiz cd90032d22 Use more appropriate markup. Fix a typo. 2011-02-17 17:03:17 +00:00
joerg 6f7bc0c1ed Deal with changes in the weak_reference semantic in GCC 4.2 and later. 2011-02-17 16:44:48 +00:00
pooka 78bedf0f20 st_blocks is in units of DEV_BSIZE, not st_blksize.
from Derrik Pates
2011-02-17 15:41:34 +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
pooka df19bb20b9 fix signature. from pgoyette 2011-02-17 12:52:33 +00:00
pooka 4d5a38cb17 Hijack pathname-based system calls. Now all paths starting with
/rump are hijacked to go to the rump server.  So you can e.g. start
a hijacked shell and cd to /rump:

$ cd /rump
$ pwd
/rump
$ ls -l dev/null
crwxr-xr-x  1 root  wheel  2, 2 Feb 17 12:35 dev/null
$ ls -l /dev/null
crw-rw-rw-  1 root  wheel  2, 2 Dec 22  2009 /dev/null
$ chmod 0 /dev/null
chmod: /dev/null: Operation not permitted
$ chmod 0 dev/null
$ ls -l /rump/dev/null
c---------  1 root  wheel  2, 2 Feb 17 12:35 /rump/dev/null

(of course the rump server must have vfs loaded for that to work)
2011-02-17 12:23:58 +00:00
pooka cd3bc9a153 sprinkle a few references (just a diet sprinkling really) 2011-02-16 23:51:50 +00:00
pooka 2e866e7646 add some excuse of a manpage for librumpclient 2011-02-16 23:45:40 +00:00
tron aa934b7969 Include "sys/null.h" to get the definition of NULL. 2011-02-16 22:35:41 +00:00
tron f1f20d6adf Fix build with SSP enabled. 2011-02-16 20:20:25 +00:00
pooka f8af939582 fix signature of rumpclient_fork() 2011-02-16 19:58:01 +00:00
pooka 246da2148a document RUMPHIJACK_RETRYCONNECT 2011-02-16 19:46:42 +00:00
pooka 2e5776377c * set default server connection retry to 0 (no reconnection attempts).
while for some cases attempting retry after server restart works
  brilliantly (e.g. firefox), in other cases it's quite disasterous
  (sshd doesn't like its file descriptors going missing and does not
  attempt to reopen them, leading to a quite catastophic loop of
  EBADF once the server does come back)
* rename RUMPHIJACK_RETRY to the slightly more sensible
  RUMPHIJACK_RETRYCONNECT
2011-02-16 19:26:58 +00:00
pooka 36f6818061 Support vfork. Add rumpclient wrapper for daemon(3). 2011-02-16 17:56:46 +00:00
pooka f4ba3dcd9e Push the fiddly tasks for exec and fork from rumphijack to rumpclient.
This makes it possible easily execute those operations also from
non-hijacked rump clients (plus fixes one memory leak in an error
branch).
2011-02-16 15:33:46 +00:00
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