| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D50483
|
|
|
|
|
|
|
| |
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D50483
|
|
|
|
|
|
|
| |
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D50483
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_libc_get_static_tls_base() is just _tcb_get() followed by adding (for
Variant I) or subtracting (for Variant II) the offset, so just inline
that as the implementation (like we do in rtld-elf) rather than having
another copy (or equivalent) of _tcb_get()'s assembly.
_get_static_tls_base() doesn't even have any MD assembly as it's
reading thr->tcb, the only difference is whether to add or subtract, so
again just inline that.
Whilst here add some missing blank lines to comply with style(9) for
elf_utils.c's includes, and use a pointer type rather than uintptr_t to
reduce the need to cast, as is done in rtld-elf.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50592
|
|
|
|
|
|
| |
This change was unreviewed and should not have been committed to :main.
This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These tests were recently enabled on main and have failed consistently
since they were enabled.
- lib.libc.net.getaddrinfo.getaddrinfo.basic
- lib.libc.net.getaddrinfo.getaddrinfo.nofamily
- lib.libc.net.getaddrinfo.getaddrinfo_test.basic
- lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname
- lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw
Mark them as expected failures so they no longer count as failures in
Jenkins CI.
PR: 285826
MFC with: 5313457780, 0b773a94ab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The offset here is relative to the TCB, not whatever the thread pointer
points to, so as with powerpc and powerpc64 we need to account for that.
However, rather than using hard-coded offsets as they did, due to
predating machine/tls.h, we can just re-use _tcb_get().
Note that if libthr is used, and its initialiser has been called, it
will take a different path that uses _get_static_tls_base, which works
just fine on riscv (adding the offset to thr->tcb). This only affects
programs that aren't linked against libthr (or that are but manage to
dlopen before the initialiser is called, if that's even possible).
In future this code should be made MI by just reusing _tcb_get() and
checking the TLS variant (since the offset here is positive even for
variant II, where it should be subtracted), but this is a targeted fix
that makes it clear what's changing.
Reviewed by: kib
Fixes: 5d00c5a6571c ("Fix initial exec TLS mode for dynamically loaded shared objects.")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50564
|
|
|
|
|
|
|
| |
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D50509
|
|
|
|
|
|
|
|
| |
This daemon has been removed; also remove things which reference it.
Reviewed by: manu, des, emaste
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50441
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TIL traceroute.8 has one of the oldest liceses, predating BSD-4-Clause!
The SPDX tag was not even on Wikipedia. These are all the files I could
find in the tree with git grep that look like the license reported on
the SPDX website, including one that was misfiled.
Ref: https://spdx.org/licenses/BSD-4.3TAHOE.html
MFC after: 3 days
Reported by: brooks
Reviewed by: brooks, carlavilla, imp, ivy
Approved by: carlavilla (mentor)
Differential Revision: https://reviews.freebsd.org/D50362
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function pointer table is overwritten by libthr when it's loaded.
libc's pthread stubs are implemented by looking up an entry in this
table and invoking the function pointer contained in the entry.
pthread calls are fairly expensive even when libthr is not loaded: each
call involves indirection through the PLT, then through the GOT to look
up __thr_jtable, then the function pointer itself. We can however
eliminate one level of indirection by disallowing preemption of the
__thr_jtable symbol, and since the existence table is an internal
implementation detail, disabling preemption is unlikely to break
anything. This gives a modest improvement in some microbenchmarks which
call libc's pthread stubs.
Reviewed by: kib
MFC after: 1 month
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D50354
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instead of accepting any character as a delimiter, only accept ':', '.'
and '-', and only permit a single delimiter in an address.
this prevents accepting bizarre addresses like:
ifconfig epair2a link 10.1.2.200/28
... which is particularly problematic on an INET6-only system, in which
case ifconfig defaults to the 'link' family, meaning that:
ifconfig epair2a 10.1.2.200/28
... changes the Ethernet address of the interface.
bump __FreeBSD_version so link_addr() consumers can detect the change.
Reviewed by: kp, des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D49936
|
|
|
|
|
| |
Fixes: da2025a0e894
Sponsored by: Klara, Inc.
|
|
|
|
| |
Sponsored by: Klara, Inc.
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50235
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50234
|
|
|
|
|
|
|
|
| |
MFC after: never
Relnotes: yes
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50233
|
|
|
|
|
|
|
|
| |
We've never not had DT_DIR or FTS_WHITEOUT.
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50218
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than treating the DTV as a raw array of uintptr_t, use proper
struct types and gain the benefit of having different types for
different members. In particular, the module slots now have real pointer
types so less casting is generally needed.
Note that, whilst struct dtv_slot may seem a little unnecessary, this
will help downstream in CheriBSD where we wish to be able to easily
alter the layout of a module's slot, which this helps abstract.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50231
|
|
|
|
|
|
|
|
| |
This lets us access via named struct members rather than magic
hard-coded indices.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Firstly, the first argument to __libc_allocate_tls is the old TCB
(versus oldtls, which has less of a clear meaning), so rename it to
oldtcb like Variant I.
Secondly, segbase and oldsegbase are oriented towards what ends up in
the segment registers, but that's not the main concern here, and those
don't convey what they actually point to. Instead, rename segbase to tcb
and change it to a uintptr_t **, and remove oldsegbase as it's always
equal to oldtcb, again both matching Variant I.
Finally, rename tls to tls_block, and add back a (different) tls
variable rather than constantly recomputing tcb - libc_tls_static_space,
again both matching Variant I.
Whilst here, similarly fix the oldtls argument to be oldtcb in the PIC
__libc_allocate_tls stub.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50227
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Elf_Addr is the format of addresses in the ELF file with the current
ABI's default class. This is normally the same as the format of an
address at run time, though technically exceptions do exist outside of
FreeBSD's currently-supported architectures (for example, IA-64's LP64
supports both ELFCLASS32 and ELFCLASS64 file formats; LP64 vs ILP32 is
an orthogonal EF_IA_64_ABI64 flag). On traditional architectures,
including all currently-supported FreeBSD architectures, addresses and
pointers are synonymous, but on CHERI they are not, as pointers are
capabilities that contain metadata alongside the address. In the cases
here, the quantities are run-time pointers, not addresses (and
definitely not ELF file addresses), so we should use pointer-ish types.
Note that we already use uintptr_t in struct tcb (both Variant I and
Variant II) but still use Elf_Addr in various places here.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50225
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than compute a biased pointer only to then un-bias it again, un-bias
the offset before adding it to the DTV entry.
This mirrors rtld-elf commit d71c97026366 ("rtld-elf: Push
TLS_DTV_OFFSET into tls_get_addr_common's arguments")
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50224
|
|
|
|
|
|
|
|
|
|
|
|
| |
this is a re-entrant version of link_ntoa. use an in-out parameter for
the buffer size, so the user requires at most two calls to determine the
needed size.
reimplement link_ntoa using link_ntoa_r with a static buffer.
Reviewed by: des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50202
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The implementation of dl_iterate_phdr for statically-linked binaries
abuses __tls_get_addr to get to the start of the TLS block. For most
architectures, tls_index's ti_offset (relocated by DTPOFF/DTPREL for GOT
entries) is just the offset within that module's TLS block. However, for
PowerPC and RISC-V, which have a non-zero TLS_DTV_OFFSET and thus are
designed assuming DTV entries are biased by that value, ti_offset
normally has TLS_DTV_OFFSET pre-subtracted. By using an offset of zero
here we end up getting a pointer TLS_DTV_OFFSET past what __tls_get_addr
would return for the first TLS variable.
Fix this by using -TLS_DTV_OFFSET to mirror what the General Dynamic GOT
entry for the first TLS variable would be.
(Note this also applies to MIPS on stable/13)
Reviewed by: kib
Fixes: dbd2053026a6 ("libc dl_iterate_phdr(): dlpi_tls_data is wrong")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50182
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PowerPC and RISC-V have a non-zero TLS_DTV_OFFSET. The intent behind
this in the design is that DTV entries are biased by this, as are (in
the other direction) the DTPOFF/DTPREL entries in the GOT. However, this
is pretty pointless in practice, and both FreeBSD and glibc's run-time
linkers don't bother to bias DTV entries, instead just adding the bias
back on at the end in __tls_get_addr. In libc we also have a minimal
implementation of this for statically-linked binaries, which is only in
practice used for code compiled with -fPIC (not -fPIE) that is also
linked without TLS relaxation support. PowerPC supports linker
relaxation for TLS sequences, so this likely never gets hit there, but
RISC-V does not, and so easily does if you compile an executable with
-fPIC. In this implementation we add TLS_DTV_OFFSET both to the DTV
entries in __libc_allocate_tls and to the result of __tls_get_addr,
meaning that any TLS accesses using the General Dynamic model in static
binaries on RISC-V end up off by 0x800.
Historically this also did not matter as __tls_get_addr was a stub that
always returned NULL, so although 6e16d0bc4376 ("Rework alignment
handling in __libc_allocate_tls() for Variant I of TLS layout.") added
this DTV implementation, nothing actually read the entries. However, now
it's a real implementation, and dl_iterate_phdr also now relies on it,
it does matter.
Fix this by not biasing the DTV entries, just like RTLD. We could
instead stop adding TLS_DTV_OFFSET in __tls_get_addr, but being
consistent between libc and RTLD seems better.
(Note this also applies to MIPS on stable/13)
Reviewed by: kib
Fixes: ca46b5698e8a ("libc: implement __tls_get_addr() for static binaries")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50181
|
|
|
|
|
|
|
|
|
|
|
| |
<cstddef> is the correct header; this fixes the GCC build.
while here, sort the headers.
Fixes: 757e973fb211 ("libc tests: add tests for link_addr(3) and link_ntoa(3)")
Reviewed by: des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50189
|
|
|
|
|
|
| |
Fixes: 873420ca1e6e ("libc: Add getenv_r() function.")
Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D50172
|
|
|
|
|
|
|
|
|
| |
for now, since link_addr() has no way to indicate an error, these are
only positive tests which check the outcome of valid inputs.
Reviewed by: ngie, des, adrian
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50062
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several manual pages for releng/14.3 incorrectly claim that features
were first introduced in FreeBSD 15.0.
I discovered these by running:
git checkout origin/releng/14.3
git grep -F '.Fx 15.0'
MFC After: 3 days
Reviewed by: imp, ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/1685
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Export all integer and floating point __aeabi_ functions defined by
"Run-time ABI for Arm Architecture" from libgcc, excluding __aeabi_h2f_alt,
__aeabi_f2h_alt and __aeabi_d2h_alt, which are not yet implemented by
compiler-rt.
To maintain ABI backward compatibility, convert __aeabi_ floating-point
symbols previously exported from libc to an explicit non-default version.
Remove guessing of vfp/not-vfp version for compiler-rt sources. The vfp
version needs additional runtime logic to select the right implementation
and we don't have it implemented.
MFC after: 1 month
Reviewed by: dim
PR: 271087
Differential Revision: https://reviews.freebsd.org/D50100
|
|
|
|
|
|
|
| |
The SYNOPSIS uses "optstring" as the argument name but the body text
used a mixture of "optstr" and "optstring."
Sponsored by: The FreeBSD Foundation
|
|
|
|
|
|
|
| |
The alloca() API is a compiler builtin and not generally part of libc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50055
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GCC does not support the blocks extension, contrary to clang with which
it is automatically enabled by our infrastructure (see
'lib/libc/gen/Makefile.inc') when compiling 'fts.c'. The alternate code
(blocks extension not supported/enabled) tried to dereference a 'void *'
pointer (field 'fts_compar_b' of 'FTS') to access field 'isa' of the
block mocked by 'block_abi.h'. Fix this by casting the pointer to the
block type.
Reviewed by: jhb, des
Fixes: f0ac5e919f3f ("fts: Add blocks support.")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50068
|
|
|
|
|
|
|
|
|
|
| |
This is a calque of the NetBSD function of the same name.
MFC after: never
Relontes: yes
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D49979
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some program intercepts the execvpe call in runtime. At the same time, the
implementation of posix_spwan use execvpe. If execvpe is intercepted and
then calls posix_spawn when intercepted. It wil create a infinite loop
because the intercepted execvpe will spawn a posix_spwan call and will be
intercepted again.
See https://github.com/rizsotto/Bear/issues/557 for reference.
Reviewed by: brooks, kib, emaste
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49733
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D49963
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds an `fts_open_b()` variant of `fts_open()` which takes a block
instead of a function pointer.
This was inspired by, and is intended to be compatible with, Apple's
implementation; however, although our FTS and theirs share a common
ancestor, they have diverged significantly. That and the fact that
we still target compilers which don't support blocks means Apple's
implementation was not directly reusable.
This is the second use case for blocks in FreeBSD (the first being
`qsort_b()`, which we use here). This suggest we might want to add
a `COMPILER_FEATURE` for blocks to avoid hardcoding any further
`COMPILER_TYPE` checks.
MFC after: never
Relnotes: yes
Sponsored by: Klara, Inc.
Reviewed by: kevans, theraven, imp
Differential Revision: https://reviews.freebsd.org/D49877
|
|
|
|
|
|
|
|
|
| |
The order for KERN_PROC_XXX is by the OID values, at least for now.
Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D49943
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wchar_t is unsigned on ARM platforms, and signed pretty much everywhere
else. On signed platforms, `nm` ends up with bogus upper bits set if we
did in-fact have a valid CS2 or CS3 (MSB set). Mask just the low byte
to avoid sign bit garbage.
Bare basic test of converting a CS2 widechar in eucCN, which would
previously kick back an EILSEQ.
Reviewed by: bapt, rew
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D43262
|
| |
|
|
|
|
|
|
|
| |
Signed-off-by: Ricardo Branco <rbranco@suse.de>
PR: 286133
MFC after: 1 week
Github PR: https://github.com/freebsd/freebsd-src/pull/1666
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the compiler's default C++ standard was used unlike C where
bsd.sys.mk explicitly sets a default language version. Setting an
explicit default version will give a more uniform experience across
different compilers and compiler versions.
gnu++17 was chosen to match the default C standard. It is well
supported by a wide range of clang (5+) and GCC (9+) versions.
gnu++17 is also the default C++ standard in recent versions of clang
(16+) and GCC (11+). As a result, many of the explicit CXXSTD
settings in Makefiles had the effect of lowering the C++ standard
instead of raising it as was originally intended and are removed.
Note that the remaining explicit CXXSTD settings for atf and liblutok
explicitly lower the standard to C++11 due to use of the deprecated
auto_ptr<> template which is removed in later versions.
Reviewed by: imp, asomers, dim, emaste
Differential Revision: https://reviews.freebsd.org/D49223
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D49756
Reviewed by: des
|
|
|
|
|
|
|
|
|
|
| |
Add separators to make the maximum number of (micro)seconds
in (u)alarm.3 more readable.
Sponsored by: Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/Libc
Differential Revision: https://reviews.freebsd.org/D49712
Reviewed by: markj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
character classes
This change extends fnmatch to support collating symbol expressions,
equivalence class expressions, and character class expressions (as
defined by POSIX.1, section 9.3.5), along with the corresponding
tests.
Sponsored by: Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/Libc
Differential Revision: https://reviews.freebsd.org/D49660
Reviewed by: markj, ziaee (manpages)
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds support for matching single and multi-character
equivalence classes and collating symbols, as specified
by POSIX1, section 9.3.5.
Sponsored by: Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/Libc
Differential Revision: https://reviews.freebsd.org/D49659
Reviewed by: markj
|
| |
|
| |
|