Commit Graph

3393 Commits

Author SHA1 Message Date
mrg 11179568db add a note about how to setup http -> https redirection.
bump documented version.
2023-06-07 20:22:22 +00:00
mrg f655db1db4 serve .iso as "application/octet-stream". bump version & copyright. 2023-06-07 20:12:31 +00:00
joerg cc08a85a25 TLS variant I archs need to fudge the offset by the size of the TCB. 2023-06-07 13:50:04 +00:00
riastradh 1c55978778 ld.elf_so: Sprinkle more debug messages on dlopen and error.
PR pkg/57445
2023-06-04 23:42:38 +00:00
martin 35e060692e Avoid using uninitialized variable "symnum" when building with DEBUG
enabled by borrowing the rdbg_symname() macro from arch/x86_64.
2023-06-04 20:02:29 +00:00
joerg 3caa8dc735 Fix interactions of initial-exec TLS model and dlopen
(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).

Fix this by forcing the computation of the correct DSO (the one defining
the symbol).

This code uses __UNCONST to avoid the vast interface changes for this
special case.

(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.

(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.
2023-06-04 01:24:56 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem f937c412f3 bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
andvar cb40c69b16 follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
2023-06-02 08:51:46 +00:00
riastradh 78e97c0a70 ld.elf_so: Make tls alloc debug messages more detailed and greppable.
XXX pullup-10
2023-06-01 08:20:10 +00:00
riastradh 3e105dc2be ld.elf_so: Sprinkle tls debug messages.
XXX pullup-10
2023-05-31 18:44:39 +00:00
christos bffdc903ae Deal with OpenSSL-3.x 2023-05-09 13:07:43 +00:00
christos bbe2f6f754 accommodate OpenSSL-3.x 2023-05-09 01:47:21 +00:00
skrll 75b842b847 RISC-V support that works on QEMU with a single hart.
Thanks for Simon Burge for plic(4).
2023-05-07 12:41:45 +00:00
riastradh b8bbdc68a0 dlopen(3): Read _rtld_objtail under the lock.
XXX pullup-8
XXX pullup-9
XXX pullup-10
2023-04-23 11:53:00 +00:00
christos 6d8ba4b8b8 Oops wrong mask. 2023-04-18 22:42:52 +00:00
christos 5eb593004f The SysV ABI specifies that the symbol hash function should return only 32
bits of hash. Unfortunately due to an implementation bu and the fact that
the return type is unsigned long which is 64 bits in LP64, this can fail
in some cases: "\xff\x0f\x0f\x0f\x0f\x0f\x12". See:
    https://maskray.me/blog/2023-04-12-elf-hash-function
From Ed Maste @ FreeBSD:
    https://cgit.freebsd.org/src/commit/\
	?id=29e3a06510823edbb91667d21f530d3ec778116d
Need to write Unit Tests for this.
2023-04-18 16:48:45 +00:00
chs 916c1920bc ld.elf_so powerpc: remove bogus ldscript
This ldscript is not needed and actually makes things worse by putting
everything in one LOAD section, which then needs to have rwx permission.
Remove it so that we get two LOAD sections with better permissions.
Fixes PR 57323.
2023-04-09 17:24:48 +00:00
skrll 1fe403d437 Alignment. NFCI. 2023-02-10 08:12:48 +00:00
christos 2f8ed368a1 fix the ldd build 2023-01-12 19:17:11 +00:00
christos 5550906484 Handle program headers properly; fixes c++ exceptions on arm32. 2023-01-12 18:52:47 +00:00
christos acf7fb3abf Remove the limitation of only being able to load binaries with 2 PT_LOAD
sections, like the kernel can. From FreeBSD.
2023-01-06 15:33:47 +00:00
christos 7d5e3ea3ec comment out a function that is only used in rtld 2023-01-04 01:37:24 +00:00
christos 6f661f3b8e make the what argument size_t since we are passing in size_t 2023-01-04 01:37:00 +00:00
skrll 40505c9552 Use the SZREG symbol instead of __SIZEOF_POINTER__ as its shorter. Assert
that they're the same just in case.

Sprinkle some KNF whitespace while I'm here.
2022-12-05 07:33:43 +00:00
skrll d9992aa755 RISC-V is RELA 2022-12-05 07:26:25 +00:00
skrll 1beb9ce90d Consistently use the 'mv' instrucation (which is itself an alias) instead
of the (old) alternative alias 'move'.
2022-12-04 17:04:06 +00:00
skrll 7893424154 Trailing whitespace 2022-12-03 09:38:53 +00:00
skrll b9abccc917 Whitespace. NFC. 2022-12-03 09:10:40 +00:00
andvar daa7d68ea3 fix various typos in comments and messages. 2022-11-02 20:38:21 +00:00
andvar fa98a90b9b s/varaible/variable/ and s/varible/variable/ in comments. 2022-11-01 19:45:35 +00:00
riastradh 65715c6162 ld.elf_so(8): Make fork take a shared, not exclusive, lock.
We only need to ensure that there are no concurrent modifications to
the rtld data structures in flight, since the threads that began
those modifications will not exist in the child and will therefore be
unable to complete them in the child.

A shared lock suffices to ensure there are no such concurrent
modifications in flight; an exclusive lock is not necessary, and can
cause deadlock if fork is executed from a signal handler, which is
explicitly allowed by POSIX (and our own sigaction(2) man page) which
marks fork as async-signal-safe.

PR lib/56979
2022-09-13 10:18:58 +00:00
martin c17bac1ed4 Document the -q option. 2022-09-12 10:34:20 +00:00
martin 3e94b8871c Add a -q option to make http quiet (no log messages).
Usefull when running multiple instances and some for (high traffic)
APIs e.g. to receive log data from appliences - it makes not sense
to duplicate the whole log in the xferlog file (but we can't configure
that at the syslog level due to other httpd instances using that).
2022-09-12 10:30:39 +00:00
hgutch 1192cf8e2b Fix CVE-2020-10188 2022-08-26 22:01:20 +00:00
dholland b96fc4cb8e telnetd: fix the crash that's been talked about the past couple days.
(Move initialization of the slc table earlier so it doesn't get
accessed before that happens.)

Calling the crash a DoS or security problem is a bit overwrought; it's
just a bug.
2022-08-26 19:30:44 +00:00
martin 75fe422388 Fix copy & pasto: DTPREL relocations do not need to allocate a static
TLS index. Patch from joerg@
2022-07-06 17:35:20 +00:00
skrll f927c76aaf Support ifunc on aarch64. The tests pass at least. 2022-06-21 06:52:17 +00:00
skrll 810da4c4dd Wrap long #if defined(...) || ... and sort. NFCI. 2022-06-21 06:47:37 +00:00
nia b7957d1677 build system: Revert all the recent additions of MK[...] knobs that
allow conditionally disabling the building of certain user space
programs in the 'base' set.

There is not enough consensus that this is the right way and a few
people had strong objections, see source-changes-d@.
2022-06-06 10:56:27 +00:00
andvar ff23aff6ad fix various typos in comments, documentation and messages. 2022-05-31 08:43:13 +00:00
mrg 4e4ca7afa5 add .mobi / application/x-mobipocket-ebook. 2022-05-31 06:34:33 +00:00
skrll f28ba59fd0 Set DP early so that any binary functions that override others get the
right value if they're called before _start.  This is true of bash where
it provides its own getenv.

Part of port-hppa/56118: sporadic app crashes in HPPA -current
2022-05-30 17:06:34 +00:00
nia e994758d71 mk: Add MKFINGER, MKTALK flags for not building
talk, talkd, finger, fingerd.
2022-05-28 14:31:11 +00:00
nia cbb875961a mk: Add a MKLFS flag for excluding the log-structured filesystem userspace
tools from the build.
2022-05-27 07:28:20 +00:00
mrg 1d41f43af4 call this bozohttpd 20220517. 2022-05-18 00:37:11 +00:00
kre b17b839ae3 fix local privilege escalation due to a race condition
NetBSD-SA2016-006 included an incomplete fix for CVE-2016-6253,
a local privilege escalation vulnerability in mail.local(8).

mail.local(8) attempts to open(2) a user's existing mailbox file
to append to it.  If that call fails, mail.local(8) will then issue
a second open(2) call to create the file (O_CREAT).

An attacker had the opportunity to create the file in question (as
a symlink, or link to some other file) in between these two open(2) calls.

Fix this by using O_EXCL in the 2nd open call, if the file exists when
that one happens, something is going wrong, so just abort.  Also, only
attempt that 2nd open if the reason the first failed was that the file
did not exist (this doesn't fix the issue, but it potentially saves
some cycles).

Thanks to Jan Schaumann for bringing this to our attention.
2022-05-17 11:18:58 +00:00
andvar e2710f6fc4 fix various typos in comments. 2022-04-17 21:24:52 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
riastradh 207d886754 rtld: Convert membar_exit/enter to membar_release/acquire.
These are basic CAS-based locking primitives needing release and
acquire semantics, nothing fancy here -- except the membar_sync parts
which are questionable but not relevant to the present audit.
2022-04-09 23:39:07 +00:00