Add prototype. Export from libdl.
Fixes: 1426fd6cff0603f0ee275b99f2ba35dc36f3d0c2
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 209fd89a2810419309944f10d11834321f0ebb25)
Some sanitizers need to be able to use dl_iterate_phdr() after stopping
the rest of the process, but it's very hard to do so reliably as a
non-participant in the main logic of the program.
Introduce _dl_iterate_phdr_locked to bypass the locking that's normally
required for dl_iterate_phdr() and slap some scary warning on it. It
will remain undocumented and probably shouldn't be used for anything
else.
Reviewed by: kib
(cherry picked from commit 1426fd6cff0603f0ee275b99f2ba35dc36f3d0c2)
Our implementation currently diverges from POSIX 2024 in a couple of
ways, as now noted in the BUGS section.
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47589
(cherry picked from commit 95b71a659a9bdc6e9071d80c7369a935c2bc16f4)
As suggested by jrtc27@ in https://reviews.freebsd.org/D42415, this
patch enables IE as default thread-local storage model in libc on arm.
Reviewed by: kib
Approved by: kp (mentor)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42445
(cherry picked from commit 6e5b1ff71e01bd48172483cb6df921f84300ea3a)
LSan wants to be able to register atfork handlers at __lsan_init time,
which can happen either at the first intercepted function call or in a
.preinit_array function. Both of these end up being very early in rtld
and executed with the bind lock held, which ends up causing problems
when we go to _libpthread_init().
Instead of requiring libpthread to be initialized, just insert the new
atfork handler straight into the list if it's not ready yet. The
critical section and locking should not be necessary if we're really
executing this early, as there won't be any threads to contend with.
Reviewed by: kib (earlier version), markj
(cherry picked from commit 4b202f4faf40fd7af8b84491360186aed8ce5733)
Test that it generally functions, and also that registering multiple
times calls each handler in the order that it's documented to call them
in.
Reviewed by: kib, markj
(cherry picked from commit 7e6ac503ffeb81733272d54af367db58e45e57ca)
Also remove some information from HISTORY that is no longer needed (and
could be confusing), now that _Fork is part of a standard.
Reported by: kib
Reviewed by: imp, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47588
(cherry picked from commit 566c039d1e7555343fcf6439a10e56f5a632c0fe)
getentropy has a comment about a special case to support kernels between
SVN revisions r331280 and r337999. Add the corresponding Git hashes so
there's a usable reference after Subversion infrastructure disappears.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 4ef07eb0802a6353faf79d58719d8008decabae0)
struct kld_file_stat embeds a reference to MAXPATHLEN, defined in
param.h.
PR: 280432
MFC after: 2 weeks
(cherry picked from commit f44029e322446469f116bbd26d51ba857083bacb)
xdr_void() should have type xdrproc_t, make it so.
PR: 280514
Reviewed by: brooks, dim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47340
(cherry picked from commit a5d1cf5e362a2e3c3ebdf6d8f2b86658a6d0b9d6)
It passes and so appears to have been silently fixed at some point.
PR: 240683
MFC after: 1 week
(cherry picked from commit 218f80226b82763c3cbd48de560959ad546b5e26)
These were reported by `mandoc -T lint ...` as warnings.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1475
(cherry picked from commit b74aaa1a2199261f9078247d29481a994b6b5e42)
These were reported by `mandoc -T lint ...` as warnings.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1467
(cherry picked from commit a51584a2d2fb3731a68eaf93b59e14227e572427)
These were reported by `mandoc -T lint ...` as warnings:
- unusual Xr order
- unusual Xr punctuation
Fixes made by script in https://github.com/Tarsnap/freebsd-doc-scripts
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1464
(cherry picked from commit 6e1fc0118033f42b7c0d3623c8f67a89ebecabb2)
These were reported by `mandoc -T lint ...` as errors.
The rendered output (in ascii and html) is not affected by this commit.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1448
(cherry picked from commit d21e322d563e0fd1f92c22205c2ced4bcd22dc23)
These were reported by `mandoc -T lint ...` as errors.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1453
(cherry picked from commit 8b92fa1ceb95bbe80b473fc35d4276146201e802)
These were reported by `mandoc -T lint ...` as errors.
The rendered output (in ascii and html) is not affected by this commit.
Additional clarification: there was a non-breaking space in
lib/libcasper/services/cap_grp/cap_grp.3.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1449
(cherry picked from commit c8b31033c3971b2b7349804ffda0cea5e4835b40)
These were reported by `mandoc -T lint ...` as errors; this commit only
handles unnecessary .Ed commands.
The rendered output (in ascii and html) is not affected by this commit.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Tarsnap Backup Inc.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1435
(cherry picked from commit 4f2ef756a404df70272b79c16fa7b1689cb0118b)
These were reported by `mandoc -T lint ...` as errors.
fhlink.2, fhreadlink.2: remove unneeded block closing.
getfh.2, procctl.2: add necessary block closing.
ptrace.2: -width only takes one argument.
swapon.2: <sys/vmparam.h> and <vm/swap_pager.h> weren't being displayed,
because .It is for a list item whereas .In is for included files.
Also, we want a blank line between <sys/ > headers and the other
one.
Signed-off-by: Graham Percival <gperciva@tarsnap.com>
PR: 281597
Reviewed by: mhorne
Sponsored by: Tarsnap Backup Inc.
(cherry picked from commit 650056363baddb83c61c85b0539ee536f3d4b56c)
Adding back arguments, which were missed during the import of ncurses version
6.5, to the code gen awk script.
This is modified from lib_keyname.c and keys.list targets in
contrib/ncurses/ncurses/Makefile.in of
21817992b3314c908ab50f0bb88d2ee750b9c4ac
PR: 280697
Reported by: np
Reviewed by: bapt
Tested by: scf
Fixes: 21817992b331 ncurses: vendor import version 6.5
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47153
(cherry picked from commit 514f4e89acd2e7b1824b261055bef49a3da6a956)
This function is called by GCC 14 if a destructor invoked during
exception unwinding throws an exception.
Reviewed by: emaste
Obtained from: libcxxrt commit 391a3dcc1054e18c2f0dff4e14d6d79ac95399d7
Differential Revision: https://reviews.freebsd.org/D46004
(cherry picked from commit 297a9e552b9a5adf07d195eae9649b0758f395af)
Previously a stream opened as read-only could be written to. Add a test
case for the fix.
Also correct another incorrect access mode check that worked by
accident, and improve the tests for that.
PR: 281953
Reported by: Erkki Moorits, fuz
Reviewed by: fuz, khng (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47265
(cherry picked from commit 0953460ce149e6f384aafbcb1e6213dfbf8f6a16)
(cherry picked from commit 6b9f7133aba44189d9625c352bc2c2a59baf18ef)
Prevent a potentially sufficiently smart compiler from optimising
away our attempts to clear sensitive buffers.
A related change was discussed and rejected in D16059, but I don't
believe the reasoning there applies: the code clearly documents its
intent that the `memset` calls clear sensitive buffers so they don't
hang around. `explicit_bzero` is the appropriate function for this
purpose. A potential performance disadvantage seems less important:
the functions in crypt are specifically designed to be slow, so a
few extra calls to guarantee that sensitive buffers are cleared does
not significantly affect runtime.
See also: D16059
Reviewed by: delphij, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47037
(cherry picked from commit a2c0d2026fb422ade2171da4bc6d5d2773b268a6)
Libarchive 3.7.7
Security fixes:
#2158 rpm: calculate huge header sizes correctly
#2160 util: fix out of boundary access in mktemp functions
#2168 uu: stop processing if lines are too long
#2174 lzop: prevent integer overflow
#2172 rar4: protect copy_from_lzss_window_to_unp() (CVE-2024-20696)
#2175 unzip: unify EOF handling
#2179 rar4: fix out of boundary access with large files
#2203 rar4: fix OOB access with unicode filenames
#2210 rar4: add boundary checks to rgb filter
#2248 rar4: fix OOB in delta filter
#2249 rar4: fix OOB in audio filter
#2256 fix multiple vulnerabilities identified by SAST
#2258 cpio: ignore out-of-range gid/uid/size/ino and harden AFIO parsing
#2265 rar5: clear 'data ready' cache on window buffer reallocs
#2269 rar4: fix CVE-2024-26256 (CVE-2024-26256)
#2330 iso: be more cautious about parsing ISO-9660 timestamps
#2343 tar: clean up linkpath between entries
#2364 tar: don't crash on truncated tar archives
#2366 gzip: prevent a hang when processing a malformed gzip inside a gzip
#2377 tar: fix two leaks in tar header parsing
Important bugfixes:
#2096 rar5: report encrypted entries
#2150 xar: fix another infinite loop and expat error handling
#2173 shar: check strdup return value
#2161 lha: fix integer truncation on 32-bit systems
#2338 tar: fix memory leaks when processing symlinks or parsing pax headers
#2245 7zip: fix issue when skipping first file in 7zip archive that
is a multiple of 65536 bytes
#2252 7-zip: read/write symlink paths as UTF-8
#2259 rar5: don't try to read rediculously long names
#2290 ar: fix archive entries having no type
#2360 tar: fix truncation of entry pathnames in specific archives
CVE: CVE-2024-20696, CVE-2024-26256
(cherry picked from commit bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
Add a minimal membarrier man page that documents the available cmd
values and errors that can be returned. We can add more information and
iterate on it in the tree.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46967
(cherry picked from commit 1fc766e3b41d0cdbd166ef95258434069a90ca52)
(cherry picked from commit 92cd5abb64dd70c305535c9504c6a2b73552147f)
(cherry picked from commit 8b41e693fc3956385d5771d60ee93e18001a5a0d)
This is a feature which allows one to splice two TCP sockets together
such that data which arrives on one socket is automatically pushed into
the send buffer of the spliced socket. This can be used to make TCP
proxying more efficient as it eliminates the need to copy data into and
out of userspace.
The interface is copied from OpenBSD, and this implementation aims to be
compatible. Splicing is enabled by setting the SO_SPLICE socket option.
When spliced, data that arrives on the receive buffer is automatically
forwarded to the other socket. In particular, splicing is a
unidirectional operation; to splice a socket pair in both directions,
SO_SPLICE needs to be applied to both sockets. More concretely, when
setting the option one passes the following struct:
struct splice {
int fd;
off_t max;
struct timveval idle;
};
where "fd" refers to the socket to which the first socket is to be
spliced, and two setsockopt(SO_SPLICE) calls are required to set up a
bi-directional splice.
select(), poll() and kevent() do not return when data arrives in the
receive buffer of a spliced socket, as such data is expected to be
removed automatically once space is available in the corresponding send
buffer. Userspace can perform I/O on spliced sockets, but it will be
unpredictably interleaved with splice I/O.
A splice can be configured to unsplice once a certain number of bytes
have been transmitted, or after a given time period. Once unspliced,
the socket behaves normally from userspace's perspective. The number of
bytes transmitted via the splice can be retrieved using
getsockopt(SO_SPLICE); this works after unsplicing as well, up until the
socket is closed or spliced again. Userspace can also manually trigger
unsplicing by splicing to -1.
Splicing work is handled by dedicated threads, similar to KTLS. A
worker thread is assigned at splice creation time. At some point it
would be nice to have a direct dispatch mode, wherein the thread which
places data into a receive buffer is also responsible for pushing it
into the sink, but this requires tighter integration with the protocol
stack in order to avoid reentrancy problems.
Currently, sowakeup() and related functions will signal the worker
thread assigned to a spliced socket. so_splice_xfer() does the hard
work of moving data between socket buffers.
Co-authored by: gallatin
Reviewed by: brooks (interface bits)
MFC after: 3 months
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D46411
(cherry picked from commit a1da7dc1cdad8c000622a7b23ff5994ccfe9cac6)
The upstream fix to make lld output for our EFI loaders reproducible
again was committed in 54521a2ff93a. Bump lld's LINKER_FREEBSD_VERSION
to be able to check this in the EFI loader Makefile.
MFC after: 3 days
(cherry picked from commit f97c7fdc59d252cc8611968ffac541d4b8342b8b)