Commit Graph

3312 Commits

Author SHA1 Message Date
maya
0a4e3118cb Fix typo in comment
from freebsd
2017-12-25 05:29:27 +00:00
maya
6f158d565c fix debug build 2017-12-24 01:22:16 +00:00
wiz
ffa84063eb Document script handler issues with httpd(8).
From martin@, addressing PR 52194.

While here, use American spelling consistently and upper-case some
abbreviations.

Bump date.
2017-11-28 12:22:27 +00:00
martin
e9e7c8e344 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
sometimes with EFAULT due to not NULL terminated environment.
2017-11-28 10:33:51 +00:00
joerg
da03f1ef14 init/fini for the main program is handled by crt0.o, so ifunc handling
is skipped right now as it iterates the same list. Don't repeat that
mistake and explicitly take care of it in the dynamic linker.
2017-11-06 21:16:03 +00:00
ryo
9f03e9b6d3 fix to compile without USE_PAM. (unused variables) 2017-10-07 19:23:02 +00:00
mrg
803cb099d6 s/u_int/unsigned/.
from Jan Danielsson.  increases/fixes portability.
2017-10-05 04:22:41 +00:00
christos
e771911261 make this compile. 2017-10-02 22:14:32 +00:00
joerg
42f0ecedd8 Include time.h for time.
XXX Doesn't build with newer zlib, remove?
2017-10-02 22:04:51 +00:00
nisimura
dfab1def86 explain AARCH64 PLT design 2017-08-28 06:59:25 +00:00
nisimura
695ffc63ca - avoid caddr_t. use Elf_Addr instead.
- iron out rdbg() errors.
2017-08-23 09:17:48 +00:00
joerg
610e531ea3 Add sparc/sparc64 support for irelative relocations. 2017-08-12 09:03:27 +00:00
joerg
e78cfb8eb8 Add IRELATIVE support for ARM, X86 and PowerPC. 2017-08-10 19:03:25 +00:00
joerg
493a7561e4 If a DF_1_NODELETE DSO has been removed from the DAG list, it still
needs to be able to resolve relocations against itself. As such, search
the referencing object explicitly last, if it hasn't been searched
before.
2017-08-09 18:44:32 +00:00
martin
806d1922a8 Fix thinko in previous: even if the address is an unsigned value and we
have verified the range before, we still need to mask the bit pattern
to the target instruction field.
2017-07-24 08:08:34 +00:00
martin
41cf8822e9 Simplify and fix the offset calculation when doing a %pc relative
branch from the PLT slot to the target.
2017-07-23 14:37:51 +00:00
joerg
bde7a58ae6 Fix two bugs related to promotion of DSO TLS blocks into the static
thread allocation:
(1) Set the DTV vector up whenever an offset into the static allocation
is assigned, even if the block itself is not initialized. This has been
seen in libstdc++.
(2) Do not free a DTV block if it is part of the static thread
allocation.
2017-07-13 14:10:38 +00:00
christos
97c79d531d rename the macro 2017-07-12 17:55:24 +00:00
christos
15e7a34b21 make this compile with debug again (symnum uninitialized) 2017-07-12 17:54:23 +00:00
joerg
e5678be828 Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
2017-07-11 15:21:31 +00:00
joerg
88b397335b Drop comments about symbol exporting, the relevant code is gone. 2017-07-09 17:57:59 +00:00
mrg
68bd8b44d6 fix ordering of a couple of words. from Edgar Pettijohn in PR#52375.
thanks!
2017-07-07 07:05:49 +00:00
wiz
d2c81abc95 Add EXIT STATUS section. Use Ex. 2017-07-04 06:56:50 +00:00
wiz
01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
joerg
a7f7db4a1a Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.
2017-06-23 15:29:21 +00:00
joerg
3870ab1fa7 Replace last use of r_type. 2017-06-21 12:34:01 +00:00
joerg
152a0d21c4 Add back symnum, fix debug print. 2017-06-20 15:02:54 +00:00
joerg
ddeaaf811f Add last_symnum, move up def and defobj. 2017-06-20 13:45:20 +00:00
joerg
d5127e3ef7 Fix C&P bug. Deal with more MIPS hacks overriding def. 2017-06-20 13:24:03 +00:00
joerg
6d0511e34f Expand symnum, GCC's uninitialized used tracking is too imprecise. 2017-06-20 12:41:49 +00:00
joerg
fd7c99c412 Drop symbol number from default branch diagnostic, it isn't set at this
point and most likely not valid either.
2017-06-20 11:01:18 +00:00
joerg
e45d4ba084 Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.
The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.
2017-06-19 11:57:01 +00:00
joerg
28b12dab1c Fix indentation. 2017-06-15 23:08:46 +00:00
joerg
130ea7cf18 Call _rtld_debug_state before running the global initialisers, so give
gdb a chance to set break points etc.
2017-06-08 18:24:39 +00:00
alnsn
9a921db489 Cosmetic changes to Lua binding in bozohttpd.
- Don't use negative indicies to read arguments of Lua functions.
- On error, return nil, "error string".
- Use ssize_t for return values from bozo_read() and bozo_write().
- Prefer lstring especially when if saves you from appending NUL and
  doing len + 1 which can potentially wraparound.
- Don't mix C allocations with Lua functions marked with "m" in the Lua
  manual. Those functions may throw (longjump) and leak data allocated
  by C function. In one case, I use luaL_Buffer, in the other case,
  I rearranged calls a bit.
2017-05-28 22:37:36 +00:00
riastradh
ef315f7931 Remove MKCRYPTO option.
Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export.  The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated.  I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S.  Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet...  That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
2017-05-21 15:28:36 +00:00
uwe
672fc2f785 PR port-macppc/47464 - Old binutils generated bogus zero-sized COPY
relocations for _SDA_BASE_ and _SDA2_BASE_ that happened to work by
accident.  They no longer happen to work when old binaries are run on
newer systems.  Explicitly ignore these bogus relocations.
2017-04-27 08:37:15 +00:00
maya
cfef4500d4 Revert to version 1.55 of map_object.c. This reverts:
"really unmap the gap between the text and data rather than just removing
all access with mprotect().  the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero."

As per toolchain/52054: src/libexec/ld.elf_so update breaks everything,
this commit is very broken for some people (but not others). chs mentioned
he has a fix, but best not to leave -current broken in the meantime.
2017-03-10 09:13:49 +00:00
chs
cf66c8999a really unmap the gap between the text and data rather than just removing
all access with mprotect().  the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero.
2017-03-09 00:43:50 +00:00
chs
1c75bf6f84 tag the powerpc hackish_return_address() as __noinline. 2017-02-27 20:25:26 +00:00
mrg
002f468d50 uh, this is actually called 20170201 :-) 2017-02-05 01:55:03 +00:00
mrg
7dd016e517 fix the prototype for bozo_set_pref(). from cfkoch 2017-02-04 01:32:54 +00:00
mrg
630f2c0b49 call this bozohttpd 20170201. 2017-01-31 14:36:09 +00:00
mrg
2c19cec69e - fix a bug in cgi processing. from Dennis Lindroos.
- add a testcase for this, and expand test-simple to handle additional
  args to bozohttpd for eg, cgi-bin setting.
- fix objdir bugs in the testsuite.
2017-01-31 14:33:54 +00:00
christos
92838f1e37 kerberos needs sqlite3 2017-01-28 23:40:51 +00:00
abhinav
b461520850 Fix typo: s/suport/support 2017-01-20 16:14:44 +00:00
christos
a80110f6b6 need <sys/stat.h> 2017-01-10 21:08:48 +00:00
christos
7d85ef5c1f need <sys/stat.h> for chmod 2017-01-10 21:08:15 +00:00
christos
2c1d98b710 missing <sys/stat.h> include. 2017-01-10 20:29:48 +00:00
schmonz
10c3be53a3 When testing non-verbosely, show diff on failure. ok mrg@ 2016-12-27 12:09:19 +00:00
abhinav
96415509bf Fix a sentence. 2016-12-24 05:40:49 +00:00
abhinav
c665c84ea5 We don't have any ``name'' program, so remove its reference
and use markup to refer finger(1).

ok wiz@
2016-12-22 12:42:24 +00:00
abhinav
cad7fa138e Fix sentences at a couple of places. 2016-12-21 09:33:08 +00:00
abhinav
ca3357623e s/users/user's
Also, add an xref to services(5)
2016-12-20 09:22:18 +00:00
maya
21cc7f1b6b acknowleg -> acknowledg, proceedure -> procedure.
only comments were changed.

from miod
2016-12-12 15:58:44 +00:00
wiz
d8a6eb3c16 Whitespace. 2016-12-12 10:07:48 +00:00
mrg
48524f008b there was a bug fix in july. call this 20160720. 2016-12-11 20:40:41 +00:00
christos
a106fb55e5 Add libprop for static linking 2016-12-11 15:43:48 +00:00
christos
a363700a4c Fix the direction; ipf/pf seem to be wrong... 2016-12-10 22:09:18 +00:00
christos
4ce8846de5 Fix varargs. 2016-12-10 22:08:13 +00:00
christos
b525cd90e0 add npf support. 2016-12-10 05:43:11 +00:00
christos
c8c18415f0 n dl_iterate_phdr return the path not the name. 2016-12-01 18:21:39 +00:00
christos
f9f702d000 Instead of using a function to resolve symbols that should be supplied by
the dynamic linker itself, use a version script that exposes them. From joerg@
2016-12-01 14:29:15 +00:00
christos
1abd6678f6 add missing newline in comment 2016-11-30 20:25:23 +00:00
christos
d32757ced4 Emulate the standard symbol search order in dlsym() i.e. resolve weak or
not found symbols that are in the dynamic linker list of exported symbols
from the dynamic linker itself.
2016-11-30 19:43:32 +00:00
christos
07303da5f3 revert, I'll fix libc instead. 2016-10-07 19:10:03 +00:00
christos
94e616077b Mips o32 needs -lgcc for __udivdi3 in headers.c for fast_divide32_prepare(). 2016-10-07 17:12:59 +00:00
mrg
da548da125 update the -V documentation to be more clear about what it does.
inspired by Swift Griggs on netbsd-users.
2016-10-04 18:33:00 +00:00
mrg
5261f4fbc4 add -V to the usage() list. noted by Swift Griggs on netbsd-users. 2016-10-04 18:26:47 +00:00
schmonz
7ec9a291e1 Missed in previous: exit 1 if html_cmp says no match. 2016-09-26 00:21:22 +00:00
schmonz
268438cada Add a VERBOSE knob to the testsuite ("yes" by default, producing
basically the same output as before). When turned off, tests run
silently except when there's a failure.

Reviewed by mrg@.
2016-09-23 16:55:56 +00:00
martin
fee8b601f9 Despite the 10 in the name, the OLO10 relocation targets a 13 bit field,
the offset (O) providing the additional data.
2016-08-29 16:00:10 +00:00
mrg
bfef5cee0b use netbsd rcsid 2016-08-20 00:36:41 +00:00
shm
febbddea26 Fix error checks in open(2) calls. 2016-07-21 12:29:37 +00:00
shm
ef0b7ea3b6 CID 976523: add FALLTHROUGH 2016-07-20 20:18:21 +00:00
shm
31d615acc3 CID 603440: ensure that closing socket exists 2016-07-19 21:25:38 +00:00
shm
d3c94bcc3a Fix race condition in deliver(), fix resource leak. 2016-07-19 13:11:38 +00:00
shm
1202090c01 Do not send encoding header for compressed formats. 2016-07-19 09:27:40 +00:00
mrg
9d18868a64 avoid an impossible case the compiler can't quite tell. 2016-06-30 13:17:48 +00:00
martin
115160e654 Fix a few bounds and instruction sequences generated in the PLT; exercised
by ASLR and verified to work with the aslr fixed random debug sysctls.
2016-06-20 08:12:25 +00:00
christos
4910b5ce72 Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)
2016-06-16 11:34:13 +00:00
christos
3ee1ef9906 Turn off GNU_RELRO for now. 2016-06-15 12:08:47 +00:00
christos
0e6265fc35 Add support for GNU RELRO headers from Matthias Weckbecker. 2016-06-14 13:06:41 +00:00
agc
205633288c As proposed in:
http://mail-index.netbsd.org/tech-userlevel/2016/05/18/msg009999.html

and

	https://www.netbsd.org/~agc/bozo-20160517.diff

add a patch to httpd to return the version string of httpd itself, and use the
-G option on the command line to enable this. This gives httpd the ability to
show, from the command line, what version is running.

	% /usr/build/obj/x86_64/usr/src/libexec/httpd/bozohttpd -G
	bozohttpd version bozohttpd/20160415
	%
2016-05-24 21:18:29 +00:00
christos
564475388a Put the name of the dynamic linker in allocated memory, so that it becomes
part of the core file link-map, so that gdb can find it.
2016-05-24 20:32:33 +00:00
joerg
6e49b77769 obj->phdr must be the absolute address, not the virtual offset from the
main binary. Historically, this has been the same. For PIE though,
relocbase can be pretty much anywhere. Fixes PR toolchain/51159.
2016-05-22 19:28:39 +00:00
christos
f7945701d6 CID 1358679: Fix memory leak.
XXX: pullup 7
2016-04-24 18:24:47 +00:00
mrg
0a7cdc80ba use %zu instead of %lu for size_t. 2016-04-15 20:00:13 +00:00
mrg
27da98ff14 updates and bozohttpd 20160415:
o  add search-word support for CGI
o  fix a security issue in CGI suffix handler support which would
   allow remote code execution, from shm@netbsd.org
o  -C option supports now CGI scripts only
2016-04-15 17:57:21 +00:00
skrll
42fe483061 Remove duplicated __RCSIDs I added years ago - I blame CVS.
Spotted by Miod Vallat
2016-04-14 20:17:07 +00:00
christos
80c3d4eb2a - Print a warning for text relocations
- Don't remap the text segment executable while relocating
2016-04-12 19:10:48 +00:00
mrg
7bc3291858 move the compiler hack closer to the source of the fail 2016-03-18 10:10:21 +00:00
christos
43c3c3f74a Add volatile for gcc 5 2016-03-17 00:21:04 +00:00
christos
f2192299b9 volatile for gcc 5 2016-03-17 00:17:58 +00:00
mrg
2dc66b067e make the GCC 4.8 specific hack for ci.clean being set GCC >= 4.8. 2016-03-16 18:58:34 +00:00
dholland
d9047ae69b Use functions instead of preprocessor abuse. 2016-03-13 00:32:09 +00:00
christos
80fa2ce1a5 where is already void * 2016-02-20 15:20:23 +00:00
macallan
3709f36323 make debug code compile again
from christos
2016-02-19 22:09:09 +00:00
riastradh
9628679b27 Need <stdbool.h> for true/false. 2016-02-19 03:53:46 +00:00
skrll
19b4c45621 Actually, descsz should not contain the padding. The note still needs to
be padded out.
2016-02-09 10:20:03 +00:00
skrll
a5b645efc7 Fix .note.netbsd.march by ensuring correct padding 2016-02-08 11:59:39 +00:00
christos
a21e664447 we don't need <sys/mbuf.h> 2016-01-24 01:56:04 +00:00
christos
ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
christos
8d60259f07 PR/50665: David Binderman: move "dir" to the outer scope so it stays alive
when the pointer is used later.
2016-01-17 14:46:07 +00:00
elric
591b978b80 Fix bug in cleanup of reply headers. 2016-01-02 20:35:59 +00:00
elric
afe55bf842 Add the concept of ``reply headers'', that is a SIMPLEQ of headers that
will be included in the HTTP reply.  We define this as we are about to
add an authentication method that may need to have a conversation with
the client.
2016-01-02 18:40:13 +00:00
mrg
0841a79ea3 bump the version; we have real fixes now. 2015-12-31 04:58:43 +00:00
mrg
614a8b6713 redo the fix for rev 1.26 - instead of getting a new string wrong,
just delay the free until the parent has finished using them.
also, free query as well.

fixes PR#50374.
2015-12-31 04:39:16 +00:00
mrg
84411b5891 rewrite the redirection url generation code to use bozoasprintf(). 2015-12-29 04:30:33 +00:00
mrg
c2e98309d5 - convert most asprintf() calls to bozoasprintf().
- don't call getpwuid(0) if we don't need to, or fail it it fails,
  and remove the 'username' member of bozohttpd_t since it is not
  used outside of bozo_setup().
2015-12-29 04:21:46 +00:00
mrg
881b8188de rename bozo_err/bozo_warn/bozo_asprintf to bozoerr/etc.
new rule is that function that mirror libc-style functions get no underscore.
2015-12-28 07:37:59 +00:00
mrg
cff2d95613 several clean ups:
- bozostrdup() gains a request parameter, and uses it to determine
  what sort of error handling is required
- bozo_strdup() dies
- size_arrays() reduced slightly, pushing error handling into the caller
- convert to size_t for some array indices
- bozo_set_pref() and bozo_init_prefs() gain httpd parameters
- apply a bunch of manual CSE to vastly reduce the number of times the
  string "request->hr_httpd" appears.
- CGI parse_header() takes a request not httpd now

XXX: lua glue updated to call bozo_init_prefs() with htttpd parameter,
     but i'm only guessing here.
2015-12-27 10:21:35 +00:00
mrg
71e7babf6d fix running the testsuite from the build tree 2015-12-27 07:43:39 +00:00
christos
f47ab3a37e Introduce bozo_strdup and bozo_asprintf to add error checking and reduce
code duplication.

Note that bozo_strdup is different that bozostrdup; the _ routines exit
loging error to syslog or stderr, whereas the non _ routines send error
responses to the http client.
2015-12-12 18:06:58 +00:00
christos
14ba256990 - restrict the default list of ciphers to something more secure
- restrict ssl options
From Travis Paul
2015-12-12 16:57:53 +00:00
kamil
d3f055bfc7 Improve the httpd(8) printenv.lua Lua example
Stop using Lua builtin print function and replace them with http.* ones.
httpd.print and http.write wraps SSL support when needed.

Print http headers, without them browser may interpret page as raw text.

No need to hardcode prefix path in the form.

Add comments for a user with tips how to use this script.

Patch by Travis Paul

Closes PR misc/50502
2015-12-07 03:11:48 +00:00
kamil
a2fa5fef62 Bump date for previous 2015-11-29 15:58:07 +00:00
kamil
1e3b6beb3f Synchronize SYNOPSIS with reality 2015-11-29 15:29:55 +00:00
kamil
55cd314790 Remove nonexistent option z: in the getopt(3) call 2015-11-29 15:26:10 +00:00
christos
59f3853f3e handle asprintf errors consistently. 2015-10-31 00:55:17 +00:00
christos
e3e5f7f09b fix wrong variable 2015-10-30 23:45:31 +00:00
christos
1932f6942a simplify 2015-10-30 23:27:47 +00:00
christos
b44c2ed92e - don't use alloca and then check if alloca returns null and then try to
free it. Allocating from the stack does not return null, and freeing it
  will have unpredictable results. use malloc instead.
- now we are using malloc remove -Wno-stack-protector kludge
2015-10-30 23:21:05 +00:00
tron
63d7176dc2 Fix build with "USE_SSP" set to "yes". 2015-10-30 18:53:26 +00:00
shm
c4fe1fac22 * add CGI support for ~user translation (-E switch)
* add redirects to ~user translation
* fix bugs around ~user translation
* add schema detection for absolute redirects
* fixed few memory leaks
* bunch of minor tweaks
* removed -r support
* smarter redirects

OK mrg@
2015-10-28 09:20:15 +00:00
mrg
ce12165d33 s/USE_NBUTIL/HAVE_NBUTIL_H/, to match the Makefile.
fixes a merge problem in introduced when merging the QNX patches.

from Jan Danielsson.
2015-10-25 19:06:49 +00:00
dholland
fbd9d636b3 Enable lfs64 in the cleaner. 2015-10-15 06:25:04 +00:00
christos
029efed26d this is syslog-like 2015-10-14 15:53:50 +00:00
dholland
4f6e0f51f3 Use llabs(), not abs(), on the difference of daddr_t's.
Caught by clang, reported by joerg.

Turn off the clang-specific compiler flags that were making the report
nonfatal.
2015-10-10 22:34:46 +00:00
dholland
c4e7149610 Use IINFO in the cleaner. 2015-10-03 08:28:30 +00:00
dholland
89fa7c41df Remove dead assignment; from Henning Petersen in PR 50196. 2015-09-03 08:16:36 +00:00
dholland
ec175d5025 Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.
2015-09-01 06:16:58 +00:00
dholland
eb2560adae The ifile's inode number is constant. (it is always 1)
Therefore, storing the value in the superblock and reading it out
again is silly and offers the opportunity for it to become corrupted.
So, don't do that (most of the code already didn't) and use the
existing constant instead. Initialize new 32-bit superblocks with
the value for the sake of old userland programs, but don't keep the
value in the 64-bit superblock at all.

(approved by Margo Seltzer)
2015-09-01 06:12:04 +00:00
dholland
4d398b859d Add byteswapping to the dinode accessors.
This prevents regressions in the ulfs code when switching to the new
accessors. Note that while adding byteswapping to the other accessors
is straightforward, I haven't done it yet; and that also is not enough
to make LFS_EI work, because there are places lying around that bypass
the accessors for one reason and another and all of them need to be
updated. That is going to have to wait for a later day as LFS_EI is
not on the critical path right now.
2015-09-01 06:10:16 +00:00
mrg
4ff1396ff2 s/dirname/dirpath/ to avoid potentially shadowing dirname(3). 2015-08-27 17:12:18 +00:00
wiz
9e1c9adfc5 Remove trailing space in boast. 2015-08-13 12:30:08 +00:00
shm
7d14271c4e Extend AUTHORS section. Nobody likes a braggart.
OK mrg@
2015-08-13 09:00:29 +00:00
dholland
b1828e0ba3 Hack up dinode usage to be 64 vs. 32 as needed. Part 1.
(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
2015-08-12 18:28:00 +00:00
dholland
e54b457c15 Provide 32-bit and 64-bit versions of FINFO.
This also entailed sorting out part of struct segment, as that
contains a pointer into the current FINFO data.
2015-08-12 18:27:01 +00:00
dholland
2e090556c4 Make 32-bit and 64-bit versions of SEGSUM.
Also fix some of the FINFO handling as it's closely entangled.
2015-08-12 18:26:26 +00:00
dholland
32577c4f1c Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...
2015-08-12 18:25:51 +00:00
dholland
f11e4edeba Make 32-bit and 64-bit versions of CLEANERINFO.
XXX: while this is written to disk, it seems like much of it would
XXX: be better set up as a commpage shared with the cleaner.
2015-08-12 18:25:03 +00:00
dholland
17964a9f43 Fix assorted 64->32 truncations related to BLOCK_INFO.
Also make note of a cleaner limitation: it seems that when it goes to
coalesce discontiguous files, it mallocs an array with one BLOCK_INFO
for every block in the file. Therefore, with 64-bit LFS, on a 32-bit
platform it will be possible to have files large enough to overflow
the cleaner's address space. Currently these will be skipped and cause
warnings via syslog.

At some point someone should rewrite the logic to coalesce files to
use chunks of some reasonable size, as discontinuity between such
chunks is immaterial and mallocing this much space is silly and
fragile. Also, the kernel only accepts up to 65536 blocks at a time
for bmapv and markv, so processing more than this at once probably
isn't useful and may not even work currently. I don't want to change
this around just now as it's not entirely trivial.
2015-08-12 18:23:16 +00:00
shm
c766c3d3c2 Use explicit_memset(3) instead of memset(3) to clear password 2015-08-10 07:45:50 +00:00
shm
92a992f213 Fix directory stream leaks 2015-08-10 07:32:49 +00:00
shm
c09e755be0 Removed unnecessary memset(3) call 2015-08-09 20:34:24 +00:00
shm
0c7f5afe2e Clear utmpx struct before writing it to wtmpx files 2015-08-09 12:17:30 +00:00
mrg
e8204d05c3 on QNX, use nbutil.h. 2015-08-05 06:50:44 +00:00
dholland
9e5184b86b Add a (draft) 64-bit superblock. Make things build again.
Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
2015-08-02 18:18:09 +00:00
dholland
992b9a23af Use accessor functions for the version field of the lfs superblock.
I thought at first maybe the cases that test the version should be
rolled into the accessors, but on the whole I think the conclusion on
that is no.
2015-08-02 18:14:16 +00:00
dholland
078ffcb8d8 Second batch of 64 -> 32 truncations in lfs, along with more minor
tidyups and corrections in passing.
2015-08-02 18:10:07 +00:00
dholland
e6aad7b613 Use lfs_accessors.h in conjunction with the cleaner's struct clfs.
Remove previous hacks.
2015-07-28 05:14:23 +00:00
dholland
34f0d74c9e Add a new lfs header file: lfs_accessors.h.
This contains all the accessor functions and macros out of lfs.h.
Add an include of lfs_accessors.h after all uses of lfs.h... except
for code that wants to define its own struct lfs-alike that the
accessors are supposed to play along with. For these, set STRUCT_LFS
and include lfs_accessors.h after the necessary structure has been
defined, so that lfs_accessors.h can emit functions in terms of it.
2015-07-28 05:09:34 +00:00
dholland
adca8af59e More lfs superblock accessors.
(This changes the rest of the code over; all the accessors were
already added.)

The difference between this commit and the previous one is arbitrary,
but the previous one passed the regression tests on its own so I'm
keeping it separate to help with any bisections that might be needed
in the future.
2015-07-24 06:59:31 +00:00
dholland
f59b8f4b3a Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
2015-07-24 06:56:41 +00:00
shm
51b65afab5 Fix handling path with multiple slashes at the beginning
Fix redirections escaping for user support

OK mrg@
2015-07-16 12:19:23 +00:00
shm
5f066e934a Remove d_namelen as it's an BSD extension. Fix building bozohttpd on SunOS.
OK mrg@
2015-07-09 12:32:16 +00:00
christos
a6e4c202c0 fix memory leaks on error; found by brainy. 2015-07-04 22:39:23 +00:00
joerg
3490cc6261 Add an explicit note about the search path used by dlopen(3). 2015-07-03 10:19:29 +00:00
wiz
369139181c Bump date for previous. 2015-05-05 08:08:33 +00:00
buhrow
3a2e9669fe Add a -b flag so that clients that return their acknowledgements to the
broadcast address can inter-operate with the tftpd server.
Discussed in bin/49868
2015-05-05 05:50:31 +00:00
mrg
56ba1ad0cf fix content type handling to not hard code (wrong) values for length,
but just call strlen() as needed.  call this 20150501.

reported by Jan Danielsson for ".svg".
2015-05-02 11:35:48 +00:00
mlelstv
826a26234a Use verrx with a va_list. 2015-04-26 08:56:19 +00:00
mlelstv
e0bd604ced size output buffer for strunvis to include the trailing NUL character. 2015-04-26 08:03:05 +00:00
christos
46b8188b2d Fix deref "command" after "free(file)", from KIYOHARA Takashi 2015-04-19 19:05:19 +00:00
mrg
1d0520b606 install as bozohttpd/bozohttpd.8 as well as httpd. 2015-04-16 02:32:33 +00:00
yamt
b549d229c6 Fix membars around rtld internal mutex.
This fixes the most of lockups i observed with Open vSwitch
on NetBSD/amd64.  ("most of" because it still occasionally
locks up because of other problems.  see PR/49816)
2015-04-06 09:34:15 +00:00
joerg
e0985a06ba lib/49813: Release mutex on error. 2015-04-04 18:51:57 +00:00
chopps
f89312b935 - Fix fallout for recent bread() change (removing cred arg). 2015-03-29 19:35:58 +00:00
matt
32b939b05c Update RISCV to use the ELF relocations and new ABI. 2015-03-27 23:14:53 +00:00
mrg
4135f5d46d copyright maintenance, note shm@ in the manual and update the CHANGES
for recent changes.  call this 20150320.
2015-03-20 19:54:53 +00:00
mrg
bcc73e9553 don't quote /. it doesn't work. this should fix PR#49765. 2015-03-20 18:54:18 +00:00
skrll
70289840ad HPPA hack for a problem where gdb doesn't see _rtld_debug_state when
it's a single bv,n %r0(%rp) instruction.

The nullify confuses something.
2015-03-05 09:49:53 +00:00
aymeric
45a53d184f Fix previous commit by using tty00 as an example of dialin peripheral instead
of dialout dty00.
Thanks to mrg@ for pointing it out.
2015-02-12 07:32:09 +00:00
snj
411a393d8d spit out a 403 not just when an open() fails with EPERM, but with
EACCES as well.
2015-01-27 04:20:23 +00:00
christos
068e5a5145 blacklist hooks 2015-01-25 15:52:44 +00:00
mrg
9e53ba939e more for the previous: make sure [i - 1] can never go negative. 2014-12-26 19:52:00 +00:00
mrg
7ce92dc944 properly handle ilen = 0 case, which could lead to array underflow.
pointed out by Maxime Villard.
2014-12-26 19:48:52 +00:00
wiz
c1a74a82ca Bring this man page back to this decade. 2014-12-25 18:56:28 +00:00
mrg
2b5d1d7deb call this 20141225. 2014-12-25 18:53:06 +00:00
chs
a60c43758e fix powerpc TLS problems by removing the hacks for PPC EABI.
the kernel no longer treats R2 specially and its use as
the TLS register is now handled entirely in userland.
2014-12-14 23:49:17 +00:00
mrg
d0483d05da add .ts and .vob suffixes. 2014-12-13 19:30:04 +00:00
shm
60a0878843 Fixed memory leak in case of multiple authentication headers sent by the
client.

OK mrg@
2014-11-21 08:58:28 +00:00
shm
b8c713d1a2 Fixed off-by-one in virtualhost processing. Previous code was checking if
Host header is a prefix of any existing vhost. This behaviour might be used to
uncover existing vitual hosts from the remote.

OK @mrg
2014-11-21 08:54:12 +00:00
aymeric
1885c4ecdf update the example to use dty00 instead of ttyd0 to reflect a current practice 2014-11-12 21:56:48 +00:00
martin
2782e828f4 Avoid use after free, reported by the coverity scanner. 2014-10-30 07:53:41 +00:00
mrg
6ec24a2914 don't truncate file sizes to 32 bits for directory indexes. 2014-10-10 05:10:59 +00:00
matt
463829e46a RISC-V support. 2014-09-19 17:43:33 +00:00
matt
6cf6fe02a9 New files for Userland support of UCB RISC-V (both 32-bit and 64-bit) 2014-09-19 17:36:24 +00:00
matt
27620987b8 New files for OR1K support 2014-09-03 19:34:25 +00:00
matt
00cc626e2f OR1K support 2014-09-03 19:31:32 +00:00
joerg
e4cd9bc4a2 Remove (now duplicated) target computation. 2014-08-31 20:06:22 +00:00
christos
94e1a89978 remove unused define 2014-08-27 04:07:04 +00:00
joerg
c1a71e8076 Restore parenthesis to cast in the right order. 2014-08-26 21:20:05 +00:00
joerg
b88be9f652 Replace casts in the inline version of _rtld_call_function_void of
_rtld_call_function_addr with ifdef on RTLD_LOADER.
2014-08-26 19:49:33 +00:00
christos
db25848c17 fix set but not used. 2014-08-26 15:06:50 +00:00
joerg
5d06599748 Go back to skipping init/fini handling for ldd, makes problems for 32bit
compat on LP64.
2014-08-26 12:14:14 +00:00
christos
d9972a4666 Introduce a cast to fix the build for Elf32 on _LP64. 2014-08-26 07:54:27 +00:00
joerg
7a1a6f1cf3 Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.
2014-08-25 20:40:52 +00:00
joerg
f5cd842d49 Outdated, kill. 2014-08-23 19:18:41 +00:00
joerg
6a83645936 Typo. 2014-08-23 18:05:33 +00:00
matt
5b3354816c Add proper registers for register counts. 2014-08-17 16:57:37 +00:00
matt
d32bdc3217 add a missing register prefix. 2014-08-17 16:14:19 +00:00
mbalmer
fe91fb6abb NUL terminate a string. 2014-08-15 19:35:28 +00:00
matt
30993f706c Use -fPIC since powerpc64 is always compiled as -fPIC and -fpic would cause
__PIC__ to change.
2014-08-15 09:40:07 +00:00
joerg
8a961968a8 Build position independent on PPC64, too. 2014-08-13 15:56:52 +00:00
matt
243b0ccea7 Don't provide __gnu_Unwind_Find_exidx if __ARM_DWARF_EH__ is defined 2014-08-10 23:35:26 +00:00
matt
547b3a3b01 Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only.  While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
2014-08-10 05:56:36 +00:00
matt
beb9c6d1b5 Preliminary files for AARCH64 (64-bit ARM) support.
Enough for a distribution build.
2014-08-10 05:47:35 +00:00
matt
154c7bc749 Fix parenthesis on __ha macro 2014-07-28 17:28:13 +00:00
lneto
4ab4902eb2 lua: updated from 5.1 to 5.3 work3
* lua(1):
  - changed lua_Integer to intmax_t
  - updated distrib/sets/lists and etc/mtree
  - updated bsd.lua.mk
  - fixed bozohttpd (lua-bozo.c)
  - compatibilized bindings: gpio, sqlite
* lua(4):
  - removed floating-point and libc dependencies using '#ifndef _KERNEL'
  - fixed division by zero and exponentiation
  - libkern: added isalnum(), iscntrl(), isgraph(), isprint() and ispunct()
  - acpica: removed isprint() from acnetbsd.h
  - libc: moved strcspn.c, strpbrk.c and strspn.c to common
  - removed stub headers
  - compatibilized bindings: luapmf, luasystm
* reorganized luaconf.h
* updated doc/CHANGES and doc/RESPONSIBLE
2014-07-19 18:38:33 +00:00
mrg
e8a778f4c0 call this 20140717. 2014-07-17 10:21:51 +00:00
mrg
71b444f24e rewrite much of the SSL code:
- handle errors in many places they weren't properly
- make SSL_accept() an error the main code notices
- expand bozo_ssl_err() to include bozo_ssl_warn(), bozo_clear_ssl_queue()
- remove empty bozo_ssl_flush()
2014-07-17 06:27:52 +00:00
mrg
cce952fc91 link against main.c and ssl-bozo.c (which provides the IO backend.) 2014-07-17 06:24:57 +00:00
mrg
002519bfa2 use const and remove unnecessary braces. 2014-07-17 06:14:46 +00:00
mrg
f3239b26ff make a minor output change match again. 2014-07-16 14:47:59 +00:00
mrg
dfbb0220fc make -t chroot option available always again. 2014-07-16 07:41:43 +00:00
mrg
8c06d93b7b call this bozohttpd 20140708, and add/fix a couple of CHANGES entries. 2014-07-08 14:06:17 +00:00
mrg
a212be1ee8 avoid truncating a directory path when using snprintf(), but instead
detect and return an error.

found and fixed by shm@netbsd.
2014-07-08 14:01:21 +00:00
mrg
681e9c9b00 make export-distfile target slightly more stable. 2014-07-08 13:59:39 +00:00
shm
d1ed37e48d Handle ENAMETOOLONG to return 404 error instead of 500.
OK mrg@
2014-07-02 13:58:09 +00:00
shm
ca5b33a5e8 * bozo_clean_request free(3) clean up (removed needless checks)
* HEAD method no longer returns response body on error
* fixed bug with multiple bozo_http_error calls caused by fix_url_percent

OK @mrg
2014-07-01 13:41:21 +00:00
dholland
fedb6c32b4 put the sccsids back here too 2014-06-26 03:24:51 +00:00
shm
55b8853aa5 PR/48810 use cgi handler for index files
OK mrg@ martin@
2014-06-24 07:23:59 +00:00
christos
bcd3afec62 Although the kernel handles non-NUL terminated interface names, it is better
to avoid this, and all other places that create ifdr_name use strlcpy anyway
so make it conform.
2014-06-06 15:33:14 +00:00
joerg
a300913f30 Remove remaining kvm glue. 2014-06-02 19:29:58 +00:00
joerg
b760a206df Remove majority of KVM usage. 2014-06-02 18:17:51 +00:00
joerg
80a70b4c48 Remove !BSD and lint branches. 2014-06-02 17:40:05 +00:00
mrg
5893f1db8f bump version, note .svg support. 2014-05-17 05:50:46 +00:00
mrg
f434e335cc enable .svg. as prompted by agc@. 2014-05-17 05:50:01 +00:00
martin
b87a9303be The table of masks applied for each relocation type was wrong for some
relocs with 64bit targets, like GLOB_DAT.
Change some instruction patterns used for PLT slots, so -current
objdump -d shows what the comment says.
Fix encoding of %lox() in PLT slots "close" to -1.
Enhance debug output slightly.
2014-04-02 14:11:25 +00:00
matt
a1f21652d9 Make sure r1 is preserved _rtld_bind_start. 2014-03-22 15:13:10 +00:00
matt
e26b436cdb Simplify. If we got called via a calls $n, *pcrel32, instead of constructing
a new stack frame, back up the PC by 7 and return back to the calls so it
will be reinvoked.  (This is by far the most common way it gets invoked).
Otherwise rebuild a new callframe and jump to the routine.
2014-03-21 14:03:30 +00:00
matt
bc069d405c Improve some of the rdbg messages to print the address of the pltgot slot
being modified.
2014-03-21 01:43:33 +00:00
matt
22fbc67ed0 Don't resolve symbols to PLT entries on the VAX. It just causes a lot of
overhead.
2014-03-21 01:40:41 +00:00
joerg
f8bf5bbce0 Save actual start of function, not address of entry mask on the stack. 2014-03-19 21:52:00 +00:00
matt
f71aaf7afb Fix two bugs. (jump past entry mask, fix insv) 2014-03-19 15:34:30 +00:00
matt
db747c73e4 Once we know the bound routine, rebuilt a new callframe that can be unwound
properly.
2014-03-19 02:39:22 +00:00
matt
bf06b1032e Add .cfi ops so that one can unwind through this. 2014-03-18 23:43:38 +00:00
riastradh
6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
joerg
47875e291b Ignore LD_BIND_NOW for setuid binaries, but keep it in the environment
otherwise.
2014-03-18 16:05:34 +00:00
gson
b941da03f1 Delay daemonization until RPC services have been registered.
Fixes one of the race conditions of PR misc/48282.
2014-03-18 11:00:20 +00:00
matt
cdbe3bab4f Change OUTPUT to powerpc:common to make powerpc64 ld happy 2014-03-07 05:57:46 +00:00
matt
9b490ebf92 Make ldd happy 2014-03-07 01:27:14 +00:00
matt
1200e7d3fe More PPC64 changes.
Nothing to do for lazy bindings.
Record DT_PPC64_GLINK and make _rtld_bind return it.
When resolving a JMP_SLOT, copy the source function descriptor into the PLTGOT
2014-03-06 19:19:40 +00:00
matt
15089cc505 Enable building ld.elf_so for powerpc
Produce a link map for ld.elf_so
2014-03-06 09:34:56 +00:00
matt
565a18129d Make ELF64 aware. 2014-03-06 09:34:07 +00:00
matt
fab57a4af5 powerpc64 changes 2014-03-06 07:47:39 +00:00
matt
746070937f Startup file for powerpc64. (too many difference with ppc32 to do
#ifdef dance)
2014-03-06 07:47:19 +00:00
joerg
5c4c6caf71 Make the abs() use check non-fatal for a bogus use in the LFS cleanerd. 2014-03-04 21:06:47 +00:00