Commit graph

9933 commits

Author SHA1 Message Date
Mark Johnston
4ea42d9d46 libc/tests: Further refine the condition for installing h_raw
See 8164d511d6a6 ("libc/tests: Fix installation without MK_TOOLCHAIN")
for some background.  Here we should really be testing MK_CLANG instead,
since that's what gates compilation of libclang_rt.

Fixes:	8164d511d6a6 ("libc/tests: Fix installation without MK_TOOLCHAIN")

(cherry picked from commit da925fcebf397cc3bfc74b7aa9757efd6231aa00)
2024-07-14 12:16:32 -04:00
Mark Johnston
a3e706fd42 libc/tests: Fix installation without MK_TOOLCHAIN
There is some exotic conditional logic here to avoid building a
particular test if a certain UBSAN library isn't present in the
toolchain sysroot.  This causes build failures for me when doing an
"installworld WITHOUT_TOOLCHAIN=", which I do frequently during tests.

I believe the problem is that SYSROOT is unset during installworld, so
the build sees the host's copy of libclang_rt.ubsan_standalone.a and
then tries to install a binary that wasn't built during buildworld.  Try
to make the check a bit less fragile.

Reviewed by:	dim
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45035

(cherry picked from commit 8164d511d6a6053df82911e7d4ebb34fff3d765c)
2024-07-14 12:16:22 -04:00
Mariusz Zaborski
e77813f7e4 capsicum: introduce cap_rights_is_empty Function
Before this commit, we only had the capability to check if a specific
capability was set (using cap_rights_is_set function). However, there
was no efficient method to determine if a cap_rights_t structure doesn't
contain any capability. The cap_rights_is_empty function addresses
this gap.

PR:		275330
Reported by:	vini.ipsmaker@gmail.com
Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D42780

(cherry picked from commit a7100ae23aca07976926bd8d50223c45149f65d6)
2024-06-05 11:55:17 -04:00
Ed Maste
1e3dfe0c34 libc: move NIS xdr_* symbols from rpc's to yp's Symbol.map
To fix WITHOUT_NIS build.  Building yp_xdr.c is gated by MK_NIS.

PR:		279270
Reported by:	peterj
Reported by:	matteo
Reported by:	Michael Dexter's Build Option Survey run
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45347

(cherry picked from commit 61639bb3fc5abe0bb7b096e643b51c30703ac432)
2024-05-29 11:40:18 -04:00
Dag-Erling Smørgrav
79b39f23e1 access(2): Discourage use of these system calls.
Fixes:		421025a274fb
PR:		262895
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45240

(cherry picked from commit a4be1eb21165d7aedae9dc6634528619ff10d025)
2024-05-23 04:41:32 +02:00
Gordon Bergling
f075b61137 access.2: Mention that lstat(2) should be used for symbolic links
access(), eaccess() and faccessat() will always dereference
symbolic links.

So add a note in the manual page, that lstat(2) should be
used in the case of symbolic links.

PR:	262895
Reviewed by:	gbe, pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44890

(cherry picked from commit 421025a274fb5759b3ecc8bdb30b24db830b45ae)
2024-05-23 04:41:32 +02:00
Alexander Ziaee
828e648b26 intro.2 as errno.2: Update maximum hard link limit
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192

(cherry picked from commit 6dfbe695c3223822734dddc926415a3ba347b42c)
2024-05-20 21:15:00 -06:00
Alexander Ziaee
cbe2436dda intro.2: Add sys/syscall.h to SYNOPSIS
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192

(cherry picked from commit 69ff2d754c1c8bd9c2b6cea28aa754e9f92f9613)
2024-05-20 21:14:13 -06:00
Ed Maste
f2109683ce dlopen(3): mention fdlopen for capsicum(4)
Capsicum-sandboxed applications generally cannot use dlopen, as absolute
and cwd-relative paths cannot be accessed.  Mention that fdlopen is
useful for sandboxed applications.

PR:		277169
Reviewed by:	markj, oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45108

(cherry picked from commit d84fd89ecd404ffbf629381d2dde14fd79b39402)
2024-05-13 10:22:34 -04:00
Ed Maste
0e0220d11a clock_gettime.2: fix markup
The CLOCK_* constants are "defined variable or preprocessor constants"
and so use .Dv.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45106

(cherry picked from commit 2d29d2ecebf8ea19221995b3ea2e3a7ac700bf81)
2024-05-10 09:01:52 -04:00
Konstantin Belousov
6a8ca2ff53 __cxa_thread_call_dtors(3): fix dtor pointer validity check
PR:	278701

(cherry picked from commit b27eb9ce96b838622e125fd969e8dc4914aabe18)
2024-05-10 10:49:10 +03:00
Mateusz Piotrowski
ba13e6546d gettimeofday.2: Do mention improbable future removal
As kib@ noted:

> Obviously gettimeofday(2) is not going to be removed
> even in the far future.

Reported by:	kib
Fixes:		4395d3ced5cf Document that gettimeofday() is obsolescent
MFC after:	3 days

(cherry picked from commit 6662c2312e956439652ce2d06b42753b6a78fc61)
2024-05-04 15:05:09 +02:00
Mateusz Piotrowski
c32f8e613e Document that gettimeofday() is obsolescent
Reported by:	kaktus
Reviewed by:	kaktus, pstef
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23942

(cherry picked from commit 4395d3ced5cfa46df400b5bb9996f9d74476997e)
2024-05-04 15:04:47 +02:00
Konstantin Belousov
a951992d1e libc_private.h: use private namespace name for size_t
This is direct commit to stable/14.
2024-04-30 04:14:52 +03:00
Konstantin Belousov
09bcfbd1ae libc printf_render_errno(): do not use strerror()
(cherry picked from commit aa66995b4c804cbb579f71645d97fe282a798bfc)
2024-04-30 03:48:10 +03:00
Konstantin Belousov
0451d4287a libc: minor style, wrap long lines
(cherry picked from commit bac9d7e8f2931149815c3d5a9ab69594bbdffde6)
2024-04-30 03:48:10 +03:00
Konstantin Belousov
ade62d4062 __vprintf(): switch from strerror() to strerror_rl()
PR:	278556

(cherry picked from commit f887667694632c829b0599b54ff86a072e93df87)
2024-04-30 03:48:10 +03:00
Konstantin Belousov
8f19af4b09 libc: make strerror_rl() usable for libc
(cherry picked from commit 92771bc00ad0f567b27876c34450bef7a0ee61d0)
2024-04-30 03:48:10 +03:00
Konstantin Belousov
afc8b17816 sigqueue(2): Document __SIGQUEUE_TID
(cherry picked from commit dcc180c51b9c13df3d1158d14d450308711fe93c)
2024-04-30 03:48:09 +03:00
Gordon Bergling
499d4a6094 timerfd.2: Remove a double word
- s/is is/is/

(cherry picked from commit bbef63ec27fdb86814e34c4b4013cd92ba86bc42)
2024-04-23 07:22:46 +02:00
Christopher Davidson
ac4ddd8b1f open.2: remove self-reference
Change .Xr reference to .Fn, which quiets a mandoc warning.

Reviewed by:	mhorne
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1135

(cherry picked from commit d3de1bd429bc51fbbcb37fadaf2581461edf848b)
2024-04-18 15:18:34 -03:00
Dag-Erling Smørgrav
fdde01c5b4 libc: Improve description of mktime() / timegm().
* Mention that mktime() and timegm() set errno on failure.
* Correctly determining whether mktime() / timegm() succeeded with
  arbitrary input (where -1 can be a valid result) is non-trivial.
  Document the recommended procedure.

PR:		277863
MFC after:	1 week
Reviewed by:	pauamma_gundo.com, gbe
Differential Revision:	https://reviews.freebsd.org/D44503

(cherry picked from commit 7534109d13a6cdb22e78d9d4c0a0cd5efd323c45)
2024-04-04 11:41:41 +02:00
Baptiste Daroussin
77205dbc13 pkgbase: install all libc test files into the tests package
(cherry picked from commit 3a9ddfa1ab46b492c861022ea254b3277ef74dde)
2024-03-27 09:37:10 +01:00
Gordon Bergling
87aff05164 xdr(3): Fix a few typos in source code comments
- s/reoutines/routines/
- s/paraemters/parameters/

Obtained from:	NetBSD

(cherry picked from commit 577a721d05aa20f38a615ad1cd5089a51c8571c1)
2024-03-26 06:55:55 +01:00
Konstantin Belousov
e87a6f8860 wmemchr(3): fix prototypes for wcpcpy() and wcpncpy()
PR:	277855

(cherry picked from commit 69d5783ae81b74295118950d01b6dddb3e504a56)
2024-03-24 07:12:39 +02:00
Ed Maste
c3c75c142c open: make non-POSIX errno value more apparent
In the errno list, add an explicit note and reference to the note in the
STANDARDS section.

When O_NOFOLLOW is specified and the target is a symbolic link FreeBSD
sets errno to a value different than that specified by POSIX.  Commit
295159dfa3 added a note to this effect, but I missed it when reading
through the list of errno values.

PR:		214633
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43618

(cherry picked from commit ea6a6b63e1fd304e790c8ed7627caf5e3ba52bc7)
2024-03-22 09:30:30 -04:00
Konstantin Belousov
f8b5e5320e libc posix_spawn(): explain why rtld can be used after fork
(cherry picked from commit 2ce23b1f76721e44646fc98ba4e24a113a6d5972)
2024-03-11 02:25:58 +02:00
Konstantin Belousov
8e9963d7b0 posix_spawn.c: fix typo in comment
(cherry picked from commit ebaf907114aa6bda49be4204185072571396bb0d)
2024-03-11 02:25:58 +02:00
Konstantin Belousov
7178cd5f81 posix_spawn(3): document POSIX_SPAWN_DISABLE_ASLR_NP
(cherry picked from commit a725a7a24de585e996f21e190b5af41261ebc774)
2024-03-11 02:25:58 +02:00
Konstantin Belousov
b5e95d17ec posix_spawn(3): add POSIX_SPAWN_DISABLE_ASLR_NP
(cherry picked from commit 822042fdfca79faada89e67110b01dd9ecc05996)
2024-03-11 02:25:58 +02:00
Konstantin Belousov
eb36277dc9 posix_spawnattr_setflags(3): validate argument
(cherry picked from commit 80ac36c3a2a87a19790eba487466bf70d55f566e)
2024-03-11 02:25:58 +02:00
Konstantin Belousov
8a7d5d73b8 libc/sys: add errno test
(cherry picked from commit 32fdcff8703da6f2795193acc77ec3c1fb8b723d)
2024-03-02 07:05:05 +02:00
Dag-Erling Smørgrav
e257a38de4 Update tzcode to 2024a.
MFC after:	3 weeks
Sponsored by:	Klara, Inc.

(cherry picked from commit 46c599340f187db577b9212ab18022f3c7380c68)
2024-02-21 21:33:23 +01:00
Andrew Turner
bce8a0ba15 libc: Teach libc about the BTI elf note
Add the Branch Target Identification (BTI) note to libc assembly
sources. As all obect files need the note for the library to have it
we need to insert it in all asm files.

Reviewed by:	emaste, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42228

(cherry picked from commit fd5aaf2ea0178b03aa93c35245053247e5d3840c)
2024-02-19 13:17:37 +00:00
Konstantin Belousov
8309579720 Document aio_read2/aio_write2
(cherry picked from commit a52cb4c480f270fc7158a0f58179f7b80d8a5b3c)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
e331ce2d60 aio_read2/aio_write2: add AIO_OP2_VECTORED
(cherry picked from commit 8dfc788b8480a13f1f945f0a94d8b1e327af5c6f)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
e9014ead57 libc: add aio_read2() and aio_write2() functions
(cherry picked from commit 06cb1c3f9528f088bdaf10d28dcfe7eeaad726d3)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
1298ecb6ba lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
(cherry picked from commit e4b7bbd6ab77e908a60362aa29e518f224a117b0)
2024-02-18 12:01:46 +02:00
Brooks Davis
0667d0e0e3 libc: expose execvpe for Linux compat
PR:		275370

(cherry picked from commit 8ccd0b876e67fda6249f294ff484798cc1e1569f)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
16b1438c73 read.2: Describe debug.iosize_max_clamp
PR:	276937

(cherry picked from commit 3e9515846f8cbff0ecccaab65d9f70890d04429e)
2024-02-14 05:41:54 +02:00
Minsoo Choo
fd15ba7d72 libc: Specify parameter types for function pointer
Reviewed by:	dab
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43726

(cherry picked from commit 6bd60e15b1484c6a3f5a87469e42a8e6ad9ab733)
2024-02-11 10:15:07 -05:00
Mark Johnston
324e914106 libc: Annotate a couple of local functions as such
No functional change intended.

MFC after:	1 week

(cherry picked from commit 8d5353de74471038bd75a6cb39bf58f50a600642)
2024-02-09 09:55:45 -05:00
Konstantin Belousov
14b7cf92e7 open(2): describe *at behavior for dirfd opened without O_SEARCH
(cherry picked from commit a570fe4d0dd979ce099374259ffc45d56ae4e471)
2024-02-01 02:30:40 +02:00
Mark Johnston
ea3197e69b kcmp: Add a manual page
Reviewed by:	kib, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43562

(cherry picked from commit af0d437dd31f71726f7eb5e9aca9fbd374a8277a)
2024-01-31 09:16:29 -05:00
Yuri Pankov
c0565e7d34 Create namespace for the symbols added during 15-CURRENT cycle
Reviewed by:	kib

(cherry picked from commit 95a4709b2cca726c6b76c6743ba2d665c1730666)
2024-01-31 01:14:38 -06:00
Konstantin Belousov
f8d885c08d Add kcmp(2) userspace bits
(cherry picked from commit 211bdd601ee51f90da9b123807ef68ac122116b9)
2024-01-30 22:24:42 +02:00
Mike Karels
e9e63d77c6 inet(3): clarify syntax accepted by inet_pton
The section INTERNET ADDRESSES describes the acceptance of dotted
values with varying number of parts in multiple bases.  This applies
to inet_aton and inet_addr, but not to inet_pton.  Clarify this
section by listing the functions to which this applies.  Move the
description of what inet_pton accepts into this section from STANDARDS,
where it is easily missed.  Rename the section to clarify that it
applies only to IPv4.  (inet_pton also works with IPv6.)

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43537

(cherry picked from commit 9231c42127bf8e47588169ecc395f57cae0e15fb)
2024-01-30 14:10:30 -06:00
Mark Johnston
06fc42c0cb libc/amd64: Disable ASAN for amd64_archlevel.c
The code in this file runs before the sanitizer can initialize its
shadow map.

Fixes:	ad2fac552c ("lib/libc/amd64: add archlevel-based simd dispatch framework")

(cherry picked from commit 4dedcb1bb54cbbe8043c79ad733f966b6ffc6972)
2024-01-30 13:01:58 -05:00
Robert Clausecker
ff7799e003 lib/libc/amd64/string: add memrchr() scalar, baseline implementation
The scalar implementation is fairly simplistic and only performs
slightly better than the generic C implementation. It could be
improved by using the same algorithm as for memchr, but it would
have been a lot more complicated.

The baseline implementation is similar to timingsafe_memcmp.  It's
slightly slower than memchr() due to the more complicated main
loop, but I don't think that can be significantly improved.

Tested by:	developers@, exp-run
Approved by:	mjg
MFC after:	1 month
MFC to:		stable/14
PR:		275785
Differential Revision:	https://reviews.freebsd.org/D42925

(cherry picked from commit fb197a4f7751bb4e116989e57ba7fb12a981895f)
2024-01-24 20:39:31 +01:00
Robert Clausecker
acb47064d6 lib/libc/tests/string: add memrchr unit tests
The "values" test case is specifically crafted to detect the off-by-one
error previous discovered in the scalar strchrnul implementation.

Tested by:	developers@, exp-run
Approved by:	mjg
MFC after:	1 month
MFC to:		stable/14
PR:		275785
Differential Revision:	https://reviews.freebsd.org/D42925

(cherry picked from commit 691ff1832e09a6ccbc8f5b04c88cafc7452b3ce6)
2024-01-24 20:39:30 +01:00