Commit graph

24324 commits

Author SHA1 Message Date
Jose Luis Duran
f7eb6b134d open(2): Extend EINVAL's description
PR:	281033

(cherry picked from commit 02c23c3b5ac9c9c1115c8b892034bb5d67b05c06)
2024-09-01 03:53:36 +03:00
Jose Luis Duran
97ccb41979 rename(2): Extend EINVAL's description
PR:	281033

(cherry picked from commit 33f58ac0795b2b02593ad0a8bf8a1ea24c1dc5e1)
2024-09-01 03:53:36 +03:00
Jose Luis Duran
f968e0819d open(2): mandoc -T lint
(cherry picked from commit f5a37f8dd319e3007b126b77376e61ad96f44d8b)
2024-09-01 03:53:36 +03:00
Maxim Konovalov
2545829e1c pam_xdg.8: the module option name corrected
PR:	280994
(cherry picked from commit 6aee1dc48006445b6e062db86c5c3697b04b98f6)
2024-08-25 04:12:44 +00:00
Cy Schubert
78c66b88cc unbound: Vendor import 1.21.0
Release notes at
	https://nlnetlabs.nl/news/2024/Aug/15/unbound-1.21.0-released/

Merge commit '96ef46e5cff01648c80c09c4364d10bc6f58119d'

(cherry picked from commit 5685098846d7f11ad642d9804d94dc7429a7b212)
2024-08-23 12:29:42 -07:00
Konstantin Belousov
2a1e8d7c30 exit(3): clarify how to obtain full exit status of the exited process
(cherry picked from commit c4269e63ecf301306a6176b9fe9002c4c2265695)
2024-08-21 13:32:49 +03:00
Konstantin Belousov
8d801641a3 exit(3): make it thread-safe
(cherry picked from commit 3f3ec4b99f79d32a0bf15495559ca9883bd751f2)
2024-08-21 13:32:49 +03:00
Konstantin Belousov
023b97a699 msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local
(cherry picked from commit 0c00dbfeb0c814c3a87a4d490db3692c1f9441e9)
2024-08-14 06:25:55 +03:00
Konstantin Belousov
ac4866f142 msun/ld80/e_powl.c: add const qualifiers to the static immutable values
(cherry picked from commit 10ac6c48a3e4ec6bb6f09d9c93e6ce5eb3381251)
2024-08-14 06:25:55 +03:00
Christos Margiolis
db238c7c52 mixer.3: Fix mixer_get_mode() description
Improve wording and also fix the constants' names.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46220

(cherry picked from commit 6e744de1a3dc5dde8d2ee51e97a1224a01bdfb21)
2024-08-08 16:49:10 +03:00
Robert Clausecker
644d814471 lib/libc/amd64/string: fix overread condition in memccpy
An overread condition in memccpy(dst, src, c, len) would occur if
src does not cross a 16 byte boundary and there is no instance of
c between *src and the next 16 byte boundary.  This could cause a
read fault if src is just before the end of a page and the next page
is unmapped or unreadable.

The bug is a consequence of basing memccpy() on the strlcpy() code:
whereas strlcpy() assumes that src is a nul-terminated string and
hence a terminator is always present, c may not be present at all in
the source string.  It was not caught earlier due to insufficient
unit test design.

As a part of the fix, the function is refactored such that the runt
case (buffer length from last alignment boundary between 1 and 32 B)
is handled separately.  This reduces the number of conditional
branches on all code paths and simplifies the handling of early
matches in the non-runt case.  Performance is improved slightly.

os: FreeBSD
arch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        │ memccpy.unfixed.out │        memccpy.fixed.out           │
        │       sec/op        │   sec/op     vs base               │
Short             66.76µ ± 0%   62.45µ ± 1%  -6.44% (p=0.000 n=20)
Mid               7.938µ ± 0%   7.967µ ± 0%  +0.36% (p=0.001 n=20)
Long              3.577µ ± 0%   3.577µ ± 0%       ~ (p=0.429 n=20)
geomean           12.38µ        12.12µ       -2.08%

        │ memccpy.unfixed.out │         memccpy.fixed.out           │
        │         B/s         │     B/s       vs base               │
Short            1.744Gi ± 0%   1.864Gi ± 1%  +6.89% (p=0.000 n=20)
Mid              14.67Gi ± 0%   14.61Gi ± 0%  -0.36% (p=0.001 n=20)
Long             32.55Gi ± 0%   32.55Gi ± 0%       ~ (p=0.429 n=20)
geomean          9.407Gi        9.606Gi       +2.12%

Reported by:	getz
Reviewed by:	getz
Approved by:	mjg (blanket, via IRC)
See also:	D46051
MFC:		stable/14
Event:		GSoC 2024
Differential Revision:	https://reviews.freebsd.org/D46052
2024-08-07 16:18:40 +02:00
Ed Maste
5bd6e6c1dd libusb: claim to be version 1.0.16
We are not 100% compatible with 1.0.16, but implement some
functionality from that version that is required by certain ports.

PR:		277799
PR:		279555 (exp-run)
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45514

(cherry picked from commit 5654b42142e1f689b26d405c90379b85f22349a0)
2024-08-06 17:25:21 -04:00
Steve Kargl
dc39004bc6 libm: fma: correct zero sign with small inputs
This is a fixed version of 888796ade284.

PR:		277783
Reported by:	Victor Stinner
Reviewed by:	emaste
MFC after:	1 week

(cherry picked from commit 888796ade2842486d3167067e8034254c38aadd3)
(cherry picked from commit e77ad954bb825983b4346b9cc646c9c910b1be24)
(cherry picked from commit 34f746cc7f8a8dd261027a8b392b76e70adc8438)
2024-08-06 17:25:10 -04:00
Ed Maste
f06d322e9d Remove "All Rights Reserved" from FreeBSD Foundation copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5c2bc3db201a4fe8d7911cf816bea104d5dc2138)
2024-08-06 15:39:53 -04:00
Ed Maste
d1d8c91147 libm: add parens to clarify expressions in fma, fmal
Obtained from:	NetBSD

(cherry picked from commit 001606523a48ca2aa440c985db47327a00671358)
2024-08-06 15:39:52 -04:00
Ed Maste
6cd4450c6c msun: update Clang bug reference in fma test
LLVM bugzilla bug 8100 became issue #8472 with the migration to GitHub.

https://github.com/llvm/llvm-project/issues/8472
(cherry picked from commit 92927b8bcf51dcbcf99d633c1b3cab3cab2373ac)
2024-08-06 15:39:52 -04:00
Konstantin Belousov
15ee14d0f7 rtld: avoid division in __thr_map_stacks_exec()
(cherry picked from commit 31f688a26d82ce00d1ec7ca9ed17b9914bf5176f)
2024-08-05 03:32:11 +03:00
Michael Tuexen
37c9f79561 sctp: document sctp_recvmsg as implemented
PR:		275990

(cherry picked from commit eee88ef45f78d7f9996a740c2a554bc6e8496114)
2024-08-04 00:19:33 +02:00
Ed Maste
128bace510 libfido2: update to 1.14.0
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 60a517b66a69b8c011b04063ef63a938738719bd)
2024-08-01 11:11:45 -04:00
Michal Meloun
fb084dd01e Fix mismerge in lib/libthr/arch/riscv/include/pthread_md.h
Fixes:	bd774d7aa1
2024-07-31 20:27:05 +02:00
Michal Meloun
bd774d7aa1 libthr: Preresolve selected EABI symbols on arm.
Add the ability to pre-resolve architecture-specific EABI symbols and
use it on arm for selected EABI functions. These functions can be called
with rtld bind lock write-locked, so they should be resolved in forward.

Reported by:	Mark Millard <marklmi@yahoo.com>, John F Carr <jfc@mit.edu>
Reviewed by:	kib, imp
MFC after:	1 week
Differential Revision:  https://reviews.freebsd.org/D46104

(cherry picked from commit 5670b8cc3672d5a6bc2c41eb48d7d01343c43ad0)
2024-07-31 14:10:58 +02:00
Andrew Turner
71f04a3609 csu: Find the main pointer through the GOT
Use the Global Offset Table to find the location of main in crt1. With
lld the old code would point to main@plt, however ld.bfd fails to link
when main is in a shared library.

Fix this by using the GOT address to find main as it works with both
lld and bfd.

Reviewed by:	jrtc27
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45259

(cherry picked from commit 53120fbb68952b7d620c2c0e1cf05c5017fc1b27)
2024-07-15 12:26:22 +00:00
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
Gordon Bergling
939f5a7b2b erf.3: Add a STANDARDS section
Add a STANDARDS section for the erf(3) manual page.

PR:	273413
Reviewed by:	pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44140

(cherry picked from commit 16c3d7e1fa150ee136b910448cf431e8deab5293)
2024-06-30 07:29:47 +02:00
Mariusz Zaborski
2c88494a33 libcapsicum: cache more time zone information
The functions like gmtime(3) expect to cache a GMT time zone. Some
sandboxed programs (like last(1)) use the gmtime(3) function.
In case of last(1), this function fails to load a proper time zone
because it is called after entering the capability mode.

_open () at _open.S:4
0x00000008011bc5a8 in tzloadbody (name=0x8018b9580 "/usr/share/zoneinfo/Etc/UTC", sp=0x801870140,
tzload (name=<optimized out>, sp=0x801870140, doextend=true)
0x00000008011bb8ba in gmtload (sp=0x801870140) at /usr/src/contrib/tzcode/localtime.c:1456
gmtcheck () at /usr/src/contrib/tzcode/localtime.c:1581
0x000000080111f85a in _libc_once (once_control=0x80127c550, init_routine=0x0)
_once (once_control=0x80127c550, init_routine=0x0) at /usr/src/lib/libc/gen/_once_stub.c:63
0x00000008011bb9d0 in gmtime_r (timep=0x7fffffffe3a8, tmp=0x80127c568)
gmtime (timep=timep@entry=0x7fffffffe3a8) at /usr/src/contrib/tzcode/localtime.c:1865
0x0000000001024cd4 in printentry (bp=bp@entry=0x8018b4800, tt=tt@entry=0x80186a0a0)
0x00000000010245ae in doentry (bp=0x8018b4800)
0x00000000010243a7 in main (argc=1, argv=<optimized out>)

This time zone is not loaded by the tzset(3) function. Because of
that, extend the caph_cache_tzdata(3) function to also include the
GMT time zone. There is no other way to cache this data than
calling gmtime(3) once.

MFC after:	5 days
Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D45297

(cherry picked from commit e24ff5c99be080007ff9086398fbe3ef56cd94dc)
2024-06-28 12:20:15 +02:00
Mariusz Zaborski
c5e0b035d9 libutil: move ftime to libutil
It seems that there are still some applications that use ftime(3)
(for example, science/siconos and sysutils/lcdproc). The issue
is that we don't build libcompat as a shared library anymore.
The easiest solution is to move it to libutil, until we
deprecate it for good.

This solution was proposed by kib@ in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257789.

PR:		257789
MFC after:	1 month
Reviewed by:	kib (ages ago)
Differential Revision:	https://reviews.freebsd.org/D39994

(cherry picked from commit bb421be6c1174fad837973acc5e4a7bade4489db)
2024-06-28 12:17:52 +02:00
Baptiste Daroussin
2b9196bd3a ncurses: reinstantiate bsd specific code
This fixes ncurses 6.5 badly reading termcap

(cherry picked from commit e402155e1ad7ec92a1fbd1712ce86c2ca43e1823)
2024-06-27 11:06:37 +02:00
Baptiste Daroussin
30ef78b46b ncurses: vendor import version 6.5
(cherry picked from commit 21817992b3314c908ab50f0bb88d2ee750b9c4ac)
2024-06-27 11:06:04 +02:00
Baptiste Daroussin
8ef92ee26b libarchive: fix thread autodetermination for zstd compression format
The libarchive code uses sysconf(3) to determine the number of threads
when 0 has been given as the number of thread to use

MFC after:	3 days

(cherry picked from commit a25e0ba57ee17e75ab27fdc09ac3275a8215087e)
2024-06-27 10:53:41 +02:00
Andreas Kempe
7f0392e1c8 libusbhid: add missing include guards
PR:		265136

(cherry picked from commit 230efeda080f09bc282f50a7a4cfc337fd7c6d0d)
2024-06-09 12:32:16 -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
Andre Albsmeier
9fe726012d pam_xdg: pam_get_item can return NULL
Fix pam_xdg as pam_get_item can return NULL, this happens when pressing
control + C in xdm for example.

MFC after:	1 week
PR:		279268

(cherry picked from commit cca0ce62f367d03ed429bf99e41e6aca8cb7f2ac)
2024-06-03 09:35:41 +02: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
Dimitry Andric
f1e3279983 Merge llvm-project release/18.x llvmorg-18.1.6-0-g1118c2e05e67
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.6-0-g1118c2e05e67.

PR:		276104
MFC after:	3 days

(cherry picked from commit 3a0793336edfc21cb6d4c8c5c5d7f1665f3e6c5a)
2024-05-28 07:25:48 +02:00
Christos Margiolis
63be29379c mixer.3: Fix mandoc -Tlint warnings
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45290

(cherry picked from commit 1ab62c8d067454b77bc9fb1c5aac75f263bb4143)
2024-05-25 21:31:19 +02:00
Christos Margiolis
0a1eb394d7 mixer(3): Implement mixer_get_path() function
This is better than hardcoding device paths in mixer applications.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45275

(cherry picked from commit 67c89b21b95601c01bafe5a0c518d320a39111c0)
2024-05-25 21:31:05 +02:00
Christos Margiolis
ab7c894154 sound: Handle unavailable devices in various OSS IOCTLs
mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45256

(cherry picked from commit 5d980fadf73df64a1e0eda40a93170ed76ce6f14)
2024-05-25 21:30:40 +02: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
Brooks Davis
7ad1775107 msun/riscv: expose fe{disable,enable}except
This is required for GCC to build.

PR:		272759
Reported by:	dgilbert@eicat.ca
Submitted by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D44333

(cherry picked from commit 1947a9383ec3a048e334022365aa199a6ae55289)
2024-05-20 21:49:06 +01:00
Cy Schubert
7a2bb28f8e unbound: Vendor import 1.20.0
Release notes at
	https://www.nlnetlabs.nl/news/2024/May/08/unbound-1.20.0-released/

Security:	The DNSBomb vulnerability CVE-2024-33655

Merge commit 'c2a80056864d6eda0398fd127dc0ae515b39752b' into main

(cherry picked from commit 335c7cda12138f2aefa41fb739707612cc12a9be)
2024-05-20 20:39:57 +00:00
Kristof Provost
14c2c7913c libpfctl: fix incorrect pcounters array size
The array is 2 x 2 x 2, not 2 x 2 x 3.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
MFC after:	2 weeks

(cherry picked from commit a3f7176523e8611b259cefd7431c01e24f446db7)
2024-05-13 17:28:02 +02: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
Alan Somers
1c5b58a717 geli.8: minor proofreading
Sponsored by:	Axcient
Reviewed by:	imp, pauamma (manpages)
Differential Revision: https://reviews.freebsd.org/D44907

(cherry picked from commit c0f02dcd4c9c17181c59fa3c43259cce793a0b21)

geli.8: add some notes regarding performance tuning

Sponsored by:	Axcient
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D44908

(cherry picked from commit 4b7949144cfbf25b0e0bf593b135a88417304d71)
2024-05-09 14:24:06 -06:00
Dimitry Andric
0b8cdac883 lib/clang: clean out old llvm/clang Sparc target remnants
The WITH_LLVM_TARGET_ENABLE_SPARC option was removed a long time ago,
but some ifdefs were still laying around, so clean them up.

PR:		276104
MFC after:	3 days

(cherry picked from commit 6f444019009a55aac18d18054d154155fbf606c9)
2024-05-07 19:04:07 +02:00