Commit Graph

24580 Commits

Author SHA1 Message Date
Kristof Provost
71d3c7041d pf: convert DIOCNATLOOK to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-04 14:59:58 +02:00
Kristof Provost
9dbbe68bc5 pf: convert DIOCCLRSTATUS to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-04 14:59:58 +02:00
Xin LI
3b35e7ee8d MFV: xz 5.6.2.
MFC after:	4 weeks
2024-06-03 18:14:43 -07:00
Mariusz Zaborski
bb421be6c1 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
2024-05-29 14:36:09 +02:00
Kristof Provost
cd2054d48b libpfctl: add pfctl_get_rule_h()
Add a handle variant of pfctl_get_rule(). This converts us from using
the nvlist variant to the netlink variant, and also moves us closer to a
world where all libpfctl functions take the handle.

While here have pfctl use the new function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-28 22:27:22 +02:00
Mark Johnston
8164d511d6 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
2024-05-28 08:24:43 -04:00
Mariusz Zaborski
e24ff5c99b 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
2024-05-27 13:17:34 +02:00
Andre Albsmeier
cca0ce62f3 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
2024-05-27 08:33:14 +02:00
Warner Losh
364c014d9b cross-tools: fts has different types for cmp routine
fts has different types for its compare rotuine. Other systems, not
4.4BSD based, have a non-const version. Before we tested against
__GLIBC__, but now we test against __linux__ because that's Linux's API
and musl doesn't define __GLIBC__.

In addition, link against libftl on this platform since musl doesn't
include ftl routines in libc, but rather in libftl.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45349
2024-05-26 11:38:30 -06:00
Ed Maste
61639bb3fc 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
2024-05-24 16:47:37 -04:00
Dimitry Andric
3a0793336e 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
2024-05-24 17:58:04 +02:00
Ricardo Branco
ddbfb544c6 mqueuefs: Relax restriction that path must begin with a slash
This is needed to support Linux implementation which discards the leading slash when calling mq_open(2)

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248
2024-05-23 13:40:46 -06:00
Tom Hukins
2ce32ab21a Fix "version introduced" in two manual pages
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1252
2024-05-23 10:30:32 -06:00
Brooks Davis
fcc5fa091e libcompiler_rt: gcc13 doesn't support _Float16 on arm
Don't set CRT_COMMON_F16_ARCH for arm as it's not supported by gcc13.

Differential Revision:	https://reviews.freebsd.org/D45234
2024-05-23 17:27:37 +01:00
Brooks Davis
6729e8a40b libpmc: remove tautological assert
gcc13 whines about this assert than an unsigned integer is >= 0.

Reviewed by:	luporl
Fixes:		b48a2770d4 powerpc64: add Power8 and Power9 PMCs
Differential Revision:	https://reviews.freebsd.org/D45232
2024-05-23 17:27:37 +01:00
Christos Margiolis
1ab62c8d06 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
2024-05-23 02:57:49 +02:00
Christos Margiolis
67c89b21b9 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
2024-05-23 02:57:36 +02:00
Christos Margiolis
5d980fadf7 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
2024-05-23 02:57:17 +02:00
Andrew Turner
82854693ae arm64: Allow userspace to be built with PAC and BTI
Add the WITH/WITHOUT_BRANCH_PROTECTION build flags. This can be used
to enable the use of pointer authentication (FEAT_PAuth) and branch
target identification (FEAT_BTI) in userspace.

The kernel already handles both of these is userspace, we just need
to enable it.

Leave disabled for a short period for this to settle before enabling.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42596
2024-05-22 17:02:26 +00:00
Andrew Turner
53120fbb68 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
2024-05-22 08:18:10 +00:00
Pierre Pronchery
408572a24e libnvmf: avoid resource leak
In nvmf_host_fetch_discovery_log_page(), the log variable may have been
allocated on the heap during the first loop cycle, and should be
free()'d before exiting upon errors.

Reported by:	Coverity
CID:		1545034
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1239
2024-05-21 17:41:04 -06:00
Dag-Erling Smørgrav
a4be1eb211 access(2): Discourage use of these system calls.
Fixes:		421025a274
PR:		262895
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45240
2024-05-22 00:35:22 +02:00
Chris Moerz
c80c104cbd
glabel.8: Describe cases related to permissions / existing mounts
Specially, note some requirements for label changes:

- glabel requires write permission on device
- filesystems first need to be unmounted for new labels to persist
  across reboots
- if the affected device node holds the filesystem root, single-user
  mode with r/o mount will be required.

Also, while here, apply some formatting tweaks.

PR:		276724
Reported by:	Alex Matei <matei35@yahoo.com>
Reviewed by:	gbe, jrm, Alexander Ziaee <concussious@runbox.com>
Differential Revision:	https://reviews.freebsd.org/D44394
2024-05-21 15:49:17 -03:00
Dag-Erling Smørgrav
9c7f83bbb4 diff: Nits in tests.
Sponsored by:	Klara, Inc.
2024-05-20 16:27:50 +02:00
Dag-Erling Smørgrav
02d98d1850 libdiff: Add a test for the truncation issue.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45218
2024-05-20 15:26:42 +02:00
Brooks Davis
1062db3070 libcxxrt: allow build with gcc13 and --no-undefined-version
GCC 13 supports _Float16 and __int128 on fewer architectures than clang
and thus libcxxrt compiled with gcc13 is sometimes missing related
symbols.  Hack around this by explicitly appending --undefined-version
to LDFLAGS in problematic cases.

Reviewed by:	theraven, dim
Differential Revision:	https://reviews.freebsd.org/D45233
2024-05-17 21:50:57 +01:00
Brooks Davis
25db7bd2fa libgcc_s: fix nonsense defines
These symbols are present on amd64 or i386.

Reported by:	kaktus, jhibbits
Fixes:		98c8caafff libgcc_s: 80-bit long double function are x86-only
2024-05-17 20:05:36 +01:00
Mariusz Zaborski
3cb6c6c9ee libcapsicum: document return values
Reviewed by:	emaste
Requested by:	des
Differential Revision:	https://reviews.freebsd.org/D45222
2024-05-16 20:29:18 +02:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Kyle Evans
8b0682644e Fix the GCC build after _FORTIFY_SOURCE import
We haven't exposed gets(3) in a long time, rip out __gets_chk before
it's too late and something builds a gets(3) user with it enabled.
2024-05-13 11:21:38 -05:00
Gordon Bergling
421025a274 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
2024-05-13 10:40:12 +02:00
Kyle Evans
9bfd3b4076 Add a build knob for _FORTIFY_SOURCE
In the future, we will Default to _FORTIFY_SOURCE=2 if SSP is enabled,
otherwise default to _FORTIFY_SOURCE=0.  For now we default it to 0
unconditionally to ease bisect across older versions without the new
symbols, and we'll put out a call for testing.

include/*.h include their ssp/*.h equivalents as needed based on the
knob. Programs and users are allowed to override FORTIFY_SOURCE in their
Makefiles or src.conf/make.conf to force it off.

Reviewed by:	des, markj
Relnotes:	yes
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32308
2024-05-13 00:23:50 -05:00
Kyle Evans
e55512504d Prepare the system for _FORTIFY_SOURCE
Notably:
- libc needs to #undef some of the macros from ssp/* for underlying
  implementations
- ssp/* wants a __RENAME() macro (snatched more or less from NetBSD)

There's some extra hinkiness included for read(), since libc spells it
as "_read" while the rest of the world spells it "read."

Reviewed by:	imp, ngie
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32307
2024-05-13 00:23:50 -05:00
Kyle Evans
be04fec426 Import _FORTIFY_SOURCE implementation from NetBSD
This is a mostly-unmodified copy of the various *_chk implementations
and headers from NetBSD, without yet modifying system headers to start
actually including them.  A future commit will also apply the needed
bits to fix ssp/unistd.h.

Reviewed by:	imp, pauamma_gundo.com (both previous versions), kib
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32306
2024-05-13 00:23:49 -05:00
Cy Schubert
335c7cda12 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
2024-05-10 14:23:43 -07:00
Simon J. Gerraty
f77b5b295d Allow -DNO_STRICT_REGEX to restore historic regex behavior
Allow restoring the behavior of '{' as described in regex(3).
Ie. only treat it as start of bounds if followed by a digit.

If NO_STRICT_REGEX is not defined, the behavior introduced by
commit a4a801688c is retained,
otherwise the previous behavior is restored.

Differential Revision:	https://reviews.freebsd.org/D45134
2024-05-09 18:29:43 -07:00
Kristof Provost
f1612e7087 libpfctl: fix file descriptor leak
pfctl_get_rules_info() opened a netlink socket, but failed to close it again.
Fix this by factoring out the netlink-based function into a _h variant that
takes struct pfctl_handle, and implement pfctl_get_rules_info() based on that,
remembering to close the fd.

While here migrate all in-tree consumers to the _h variant.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-05-09 14:07:07 +02:00
Brooks Davis
ec2b6b16aa libthr: avoid varargs in fcntl and openat interposers
Align these signatures with the ones in syscalls.master (and thus
libsys.h).  There's no reason to do va_args twice and in some ABIs
(e.g,, CheriABI) you can't access fixed arguments as varargs if you
weren't called with varargs signature.

Reviewed by:	imp, kib, jhibbits
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D45126
2024-05-08 15:49:13 +01:00
Kristof Provost
3711515467 carp: support VRRPv3
Allow carp(4) to use the VRRPv3 protocol (RFC 5798). We can distinguish carp and
VRRP based on the protocol version number (carp is 2, VRRPv3 is 3), and support
both from the carp(4) code.

Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44774
2024-05-08 13:19:03 +02:00
John Baldwin
6ca0468a2f libcbor: Ignore errors for unknown #pragmas
libcbor embeds clang-specific #pragmas that GCC then warns about.

Reviewed by:	emaste
2024-05-07 11:44:52 -07:00
Ed Maste
d84fd89ecd 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
2024-05-07 09:09:59 -04:00
Poul-Henning Kamp
66bee50af7 Remove cross-references to GBDE 2024-05-07 07:35:33 +00:00
Ed Maste
2d29d2eceb 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
2024-05-06 17:52:22 -04:00
John Baldwin
a7db82cfd9 nvmf_tcp: Correct tests for PDU direction
Add parentheses to ensure the correct order of operations.

Reported by:	GCC
2024-05-06 14:03:48 -07:00
Dimitry Andric
6f44401900 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
2024-05-04 19:34:18 +02:00
Ed Maste
60a517b66a libfido2: update to 1.14.0
Sponsored by:	The FreeBSD Foundation
2024-05-04 12:51:08 -04:00
Dimitry Andric
894cb08f0d Fixup: Merge llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9
Update version numbers, config headers, etc. Git tricked me into losing
these before pushing.

PR:		276104
Fixes:		d67fc74b9249
MFC after:	3 days
2024-05-04 17:49:57 +02:00
Alexander Ziaee
9a62cdc013 intro.2 as errno.2: Use the name macro for errno
Reviewed by: imp
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1192
2024-05-04 08:56:10 -06:00
Alexander Ziaee
69ff2d754c 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
2024-05-04 08:56:06 -06:00
Alexander Ziaee
6dfbe695c3 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
2024-05-04 08:55:59 -06:00