]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 weeks agointro.2: Import HISTORY from OpenBSD but our style
Alexander Ziaee [Fri, 19 Apr 2024 22:22:39 +0000 (16:22 -0600)]
intro.2: Import HISTORY from OpenBSD but our style

Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065

6 weeks agomailwrapper(8): change behaviour if mailer.conf cannot be opened
Lexi Winter [Sat, 30 Dec 2023 15:09:15 +0000 (15:09 +0000)]
mailwrapper(8): change behaviour if mailer.conf cannot be opened

Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA
(i.e., dma) if mailer.conf couldn't be opened for any reason, including
transient errors like ENFILE.  This behaviour is undesirable, because if
the administrator has configured a different MTA in mailer.conf, they
almost certainly don't want mailwrapper to unpredictably fall back to
the compiled-in default; and in any case, the default MTA is probably
not running, meaning the mail may be queued and then never delivered,
which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

- If it doesn't exist, keep the existing behaviour of falling back to
  the default MTA, on the assumption that this is a reasonable default
  if mailer.conf hasn't been configured at all.

- If it cannot be opened for any other reason, do not invoke an MTA and
  instead return an error to the caller.

PR: 25218
Reviewed by: imp, emaste, markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/969

6 weeks agolibc/quad: further narrow list of i386 symbols
Brooks Davis [Fri, 19 Apr 2024 21:54:39 +0000 (22:54 +0100)]
libc/quad: further narrow list of i386 symbols

It's unclear to me why lld didn't complain about these are they aren't
present and haven't been.  Instead ld.bfd complained.

Reviewed by: dim
Fixes: 6e6cd03c911c libc/quad: narrow list of symbols exposed on i386
Differential Revision: https://reviews.freebsd.org/D44879

6 weeks agolibgcc_s: expose __divmoddi4 on i386
Brooks Davis [Fri, 19 Apr 2024 21:52:42 +0000 (22:52 +0100)]
libgcc_s: expose __divmoddi4 on i386

GCC has used this for some time (since 7.0) and apparently we were
getting away with using the hidden symbol, but when linking with
--no-undefined-version we get an error unless it's properly exported.
(For anyone who wonders at the assymetry, __udivmoddi4 is indeed much
older and was introduced with GCC 3.0.)

MFC after: 3 days
Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D44878

6 weeks agolibgcc_{eh,s}: restore __*_frame_info symbols post llvm18
Brooks Davis [Fri, 19 Apr 2024 21:45:05 +0000 (22:45 +0100)]
libgcc_{eh,s}: restore __*_frame_info symbols post llvm18

The upstream llvm commit 5eb44df1b64d made the addition of these GCC
compatability symbols dependent on build configuration rather than
hardcoded for amd64, i386, and powerpc.  Reenable them.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D44877

6 weeks agoxargs: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:31 +0000 (15:11 -0600)]
xargs: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agopatch: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:30 +0000 (15:11 -0600)]
patch: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agojoin: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:30 +0000 (15:11 -0600)]
join: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agohead: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:30 +0000 (15:11 -0600)]
head: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agodiff: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:30 +0000 (15:11 -0600)]
diff: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agocut: use getline() instead of fgetln()
Martin Tournoij [Fri, 19 Apr 2024 21:11:30 +0000 (15:11 -0600)]
cut: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
               https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

6 weeks agoztest: use ASSERT3P to compare pointers
Brooks Davis [Fri, 19 Apr 2024 21:31:53 +0000 (22:31 +0100)]
ztest: use ASSERT3P to compare pointers

Fixes i386-gcc13 build.  Direct commit while waiting for upstream.

Pull Request: https://github.com/openzfs/zfs/pull/16115

6 weeks agoRevert "lib{c,sys}: normalize export of openat, setcontext, and swapcontext"
Brooks Davis [Fri, 19 Apr 2024 21:21:46 +0000 (22:21 +0100)]
Revert "lib{c,sys}: normalize export of openat, setcontext, and swapcontext"

I put the symbols in the wrong file (should have been
lib/libc/sys/Symbol.map), added a duplicate pdfork entry due to a botch
rebase, and there seems to be a issue with gcc13/binutils not exposing
the symbols so revert the whole thing while I debug.

This reverts commit ee632fb9eb4a060a4087a7f5425bfe36e65cda61.

6 weeks agokasan: fix false-positive kasan_report upon thread reuse
Ka Ho Ng [Fri, 19 Apr 2024 19:18:27 +0000 (15:18 -0400)]
kasan: fix false-positive kasan_report upon thread reuse

In fork1(), if a thread is reused and thread_alloc_stack() is not
called, mark the reused thread's kstack pages clean in the KASAN shadow
buffer.

Sponsored by: Juniper Networks, Inc.
MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44875

6 weeks agoctags: Use C99 bool instead of defining our own
Collin Funk [Wed, 7 Feb 2024 00:34:50 +0000 (16:34 -0800)]
ctags: Use C99 bool instead of defining our own

Use stdbool.h definitions instead of defining non-standard ones.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed by: markj
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1107

6 weeks agotests: move atf_python/sys/ into the tests package
Lexi Winter [Tue, 16 Apr 2024 11:18:23 +0000 (12:18 +0100)]
tests: move atf_python/sys/ into the tests package

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1174

6 weeks agobpf: Make BPF interop consistent with if_loop
Seth Hoffert [Sun, 22 Oct 2023 14:12:45 +0000 (09:12 -0500)]
bpf: Make BPF interop consistent with if_loop

The pseudo_AF_HDRCMPLT check is already being done in if_loop and
just needed to be ported over to if_ic, if_wg, if_disc, if_gif,
if_gre, if_me, if_tuntap and ng_iface.  This is needed in order to
allow these interfaces to work properly with e.g., tcpreplay.

PR: 256587
Reviewed by: markj
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/876

6 weeks agoinstall: Fix a compiler warning when bootstrapping
Mark Johnston [Fri, 19 Apr 2024 18:22:00 +0000 (14:22 -0400)]
install: Fix a compiler warning when bootstrapping

Fixes: 4336161cc9c6 ("install: Don't skip syncing in the common case.")
Reviewed by: imp, des
Differential Revision: https://reviews.freebsd.org/D44866

6 weeks agoLinuxKPI: utsname.h add missing SPDX-License-Identifier
Bjoern A. Zeeb [Fri, 19 Apr 2024 18:23:12 +0000 (18:23 +0000)]
LinuxKPI: utsname.h add missing SPDX-License-Identifier

Reported by: markj (2023-05-24; sorry took me a while)
MFC after: 3 days

6 weeks agofreebsd-update(8): Use kern.module_path
Fernando Apesteguía [Mon, 15 Apr 2024 12:18:06 +0000 (14:18 +0200)]
freebsd-update(8): Use kern.module_path

Instead of tailored configuration files to look for module_path entries.

Reported by: kevans@
Reviewed by: kevans, imp, zlei
Approved by: kevans,zlei
Differential Revision: https://reviews.freebsd.org/D44797

6 weeks agoexpand.1: Fix markup for the '-t' option
Gordon Bergling [Fri, 19 Apr 2024 15:39:37 +0000 (17:39 +0200)]
expand.1: Fix markup for the '-t' option

When viewing the manpage the '-t' option is shown as follows

    -t -Sm tab1, tab2, ..., tabn Sm

with the markup '\&Sm' included within '.It Fl t', which doesn't
makes any sense.

So just remove it.

PR: 274897
MFC after: 3 days

6 weeks agoadduser: Overhaul.
Dag-Erling Smørgrav [Fri, 19 Apr 2024 15:11:16 +0000 (17:11 +0200)]
adduser: Overhaul.

Most importantly:

* Make local variables local.
* Use `$()` instead of backticks.
* Avoid unsafe use of `-a` and `-o` operators in `test` expressions.
* Remove a hack intended to ease the transition from Perl 22 years ago.

MFC after: 1 week
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44863

6 weeks agoldconfig: use little-endian hints file on all architectures
Stefan Eßer [Fri, 19 Apr 2024 14:49:57 +0000 (16:49 +0200)]
ldconfig: use little-endian hints file on all architectures

Remove the test for building on a big-endian architecture, which
preserved the previous default of creating the ELF hints file in
native byte-order of the respective architecture.

Support for little-endian hints files has been added to the
run-time linker and the pkg command.

This is a step towards architecture independent little-endian hints
files, but support for big-endian hints files shall only be removed
from the run-time linker (and ldconfig and pkg) when the last release
that defaulted to hints files in host-byte has been declared EOL.

Reviewed by:    kib
Tested by: tuexen
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D44734

6 weeks agoldconfig: small optimization
Stefan Eßer [Fri, 19 Apr 2024 14:29:12 +0000 (16:29 +0200)]
ldconfig: small optimization

Swap which side of a comparison is byte-swapped by be32toh()
on little-endian architectures.

The be32toh() macro just returns the operand and big-endian
architectures and returns it byte-swapped on little-endian
architectures.

When operating on a constant argument, the compiler can perform
the swap operation at build time instead of swapping the data
read from the hints file at run time.

Reviewed by: kib
Tested by: tuexen
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44734

7 weeks agoarm: Fix a typo in a KASSERT message
Gordon Bergling [Fri, 19 Apr 2024 06:54:39 +0000 (08:54 +0200)]
arm: Fix a typo in a KASSERT message

- s/resoure/resource/

MFC after: 5 days

7 weeks agouipc_shm: Fix a free() of an uninitialized variable
Mark Johnston [Fri, 19 Apr 2024 00:15:51 +0000 (20:15 -0400)]
uipc_shm: Fix a free() of an uninitialized variable

Reported by: Coverity
CID: 1544043
Fixes: b112232e4fb9 ("uipc_shm: Copyin userpath for ktrace(2)")

7 weeks agoice(4): Update to 1.39.13-k
Eric Joyner [Tue, 13 Feb 2024 06:26:26 +0000 (22:26 -0800)]
ice(4): Update to 1.39.13-k

- Adds mirror interface functionality
- Remove unused virtchnl headers

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
MFC-with: 768329961dc0c041f7647f1c4549944a2ca168aa
MFC after: 3 days
Sponsored by: Intel Corporation
Tested by: jeffrey.e.pieper@intel.com
Differential Revision: https://reviews.freebsd.org/D44004

7 weeks agoice(4): Update copyright year to 2024
Eric Joyner [Tue, 13 Feb 2024 06:25:47 +0000 (22:25 -0800)]
ice(4): Update copyright year to 2024

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D44003

7 weeks agoiflib: Add subinterface interrupt allocation function
Eric Joyner [Wed, 18 Jan 2023 00:46:39 +0000 (16:46 -0800)]
iflib: Add subinterface interrupt allocation function

The ice(4) driver will add the ability to create extra interfaces
that hang off of the base interface; to do that the driver requires
a method for the subinterface to request hardware interrupt resources
from the base interface.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D39930

7 weeks agoiflib: Add sysctl to request extra MSIX vectors on driver load
Eric Joyner [Wed, 22 Mar 2023 19:18:44 +0000 (12:18 -0700)]
iflib: Add sysctl to request extra MSIX vectors on driver load

Intended to be used with upcoming feature to add sub-interfaces, since
those new interfaces will be dynamically created and will need to have
spare MSI-X interrupts already allocated for them on driver load.

This sysctl is marked as a tunable since it will need to be set before
the driver is loaded since MSI-X interrupt allocation and setup is
done during the attach process.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41326

7 weeks agoUpdate sys.dirdeps.mk set default DEP_*
Simon J. Gerraty [Thu, 18 Apr 2024 21:07:24 +0000 (14:07 -0700)]
Update sys.dirdeps.mk set default DEP_*

Even at level 0 it is handy to default DEP_*
used by Makefile.depend* to aid the first include if
in a leaf dir.

Reviewed by: stevek

7 weeks agosound: Remove obsolete DV_F_* flags
Christos Margiolis [Thu, 18 Apr 2024 20:35:26 +0000 (22:35 +0200)]
sound: Remove obsolete DV_F_* flags

The ISA sound drivers that used them are retired.

Last reference of DV_F_DRQ_MASK and DV_F_DUAL_DMA:
716924cb4832ea0a440daf09913a06f3166f243e ("Retire snd_sbc ISA sound card
driver")

Last reference of DV_F_DEV_MASK and DV_F_DEV_SHIFT:
5126e5eeeb5e07ceef3c809452a8c9f508b2d4d1 ("Retire snd_mss ISA sound card
driver")

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44858

7 weeks agosound: Simplify unit fetching in dsp_oss_audioinfo()
Christos Margiolis [Thu, 18 Apr 2024 20:35:20 +0000 (22:35 +0200)]
sound: Simplify unit fetching in dsp_oss_audioinfo()

"i" keeps the value of the current unit, so we do not have to call
PCMUNIT() and device_get_unit() to fetch it.

In the mixer case, I think it is more correct to do it like this, since
mixer and DSP device units have a 1-1 relationship (i.e the mixer unit
is always the same as the corresponding DSP device one) and that way we
can make it more clear.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44855

7 weeks agosound: Remove PCMMINOR()
Christos Margiolis [Thu, 18 Apr 2024 20:35:15 +0000 (22:35 +0200)]
sound: Remove PCMMINOR()

It's a NO-OP.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44854

7 weeks agosound: Remove obsolete chn_setvolume()
Christos Margiolis [Thu, 18 Apr 2024 20:35:11 +0000 (22:35 +0200)]
sound: Remove obsolete chn_setvolume()

It is marked as obsolete and there are no consumers of it anymore.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44853

7 weeks agosound: Get rid of snddev_info->devcount
Christos Margiolis [Thu, 18 Apr 2024 20:35:06 +0000 (22:35 +0200)]
sound: Get rid of snddev_info->devcount

snddev_info->devcount keeps track of the total number of channels for a
given device. However, it is redundant to have it, since it is only used
in sound_oss_sysinfo() to populate the "numaudios" field, and we also
keep track of the channel counts in the playcount, pvchancount, reccount
and rvchancount fields anyway. We can simply sum those fields together
instead of updating a separate variable upon every channel
addition/deletion.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44852

7 weeks agosound: Call device_get_name() and device_get_unit() only once in mixer_init()
Christos Margiolis [Thu, 18 Apr 2024 20:35:01 +0000 (22:35 +0200)]
sound: Call device_get_name() and device_get_unit() only once in mixer_init()

No functional change intended.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44840

7 weeks agosound: Be more verbose with virtual channel descriptions
Christos Margiolis [Thu, 18 Apr 2024 20:34:45 +0000 (22:34 +0200)]
sound: Be more verbose with virtual channel descriptions

Non-virtual channel description denote "play" or "record", so do the
same for virtual ones as well.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D44839

7 weeks agotcp rack: improve BBR_LOG_CWND event
Michael Tuexen [Thu, 18 Apr 2024 19:57:44 +0000 (21:57 +0200)]
tcp rack: improve BBR_LOG_CWND event

Fix a typo, which resulted in missing r_ctl.gate_to_fs in the BBLog
event.

Reported by: Coverity Scan
CID: 1540024
Reviewed by: rrs, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D44648

7 weeks agotcp: drop data received after a FIN has been processed
Michael Tuexen [Thu, 18 Apr 2024 19:50:31 +0000 (21:50 +0200)]
tcp: drop data received after a FIN has been processed

RFC 9293 describes the handling of data in the CLOSE-WAIT, CLOSING,
LAST-ACK, and TIME-WAIT states:
This should not occur since a FIN has been received from the remote
side. Ignore the segment text.
Therefore, implement this handling.

Reviewed by: rrs, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D44746

7 weeks agoorganization.dot: Fix typos
Mateusz Piotrowski [Thu, 18 Apr 2024 19:59:49 +0000 (21:59 +0200)]
organization.dot: Fix typos

MFC after: 3 days

7 weeks agoCONTRIBUTING: request only one submission type per change
Ed Maste [Thu, 18 Apr 2024 18:38:54 +0000 (14:38 -0400)]
CONTRIBUTING: request only one submission type per change

We have some instances of contributors opening a GitHub pull request and
a Phabricator review for the same change, which divides or duplicates
review effort.

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

7 weeks agoCONTRIBUTING: mention sys/crypto as another "contrib" directory
Ed Maste [Thu, 18 Apr 2024 18:44:30 +0000 (14:44 -0400)]
CONTRIBUTING: mention sys/crypto as another "contrib" directory

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

7 weeks agoshare/mk/bsd.cpu.mk: add F16C feature for i386 and amd64 architectures
Dimitry Andric [Thu, 18 Apr 2024 17:46:57 +0000 (19:46 +0200)]
share/mk/bsd.cpu.mk: add F16C feature for i386 and amd64 architectures

As discussed in bug 278417, some ports require the F16C instruction set
to compile, but there is no way yet to detect whether the currently
chosen CPUTYPE supports this feature.

Add the feature to the MACHINE_CPU variable, for each processor that
supports it. The list of processors was extracted from clang 18's -dM
output, filtered on the __F16C__ define.

PR: 278417
Reviewed by: brooks, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44848

7 weeks agoAdd preliminary in-tree CI infrastructure for developers
Muhammad Moinur Rahman [Thu, 18 Apr 2024 17:57:38 +0000 (19:57 +0200)]
Add preliminary in-tree CI infrastructure for developers

The goal of this project is to integrate the relevant scripts from the
FreeBSD-CI project (https://github.com/freebsd/freebsd-ci) into the src
repository. This allows developers to run the test suite similar to how
it is executed on ci.freebsd.org, and eventually, have it directly used
by our CI system. This effort is also part of the workflow improvement
project, aiming to incorporate pre-merge testing.

Current Features:
* Does smoke tests using either bhyve(amd64 only) or qemu(Non x86_64 or
  when defined USE_QEMU=1). Currently defined CITYPE=smoke. Once we have
  added full tests we can also utilize something like CITYPE=full
* Most of the resources are dynamically allocated based on available
  resources in the host
* If CPU supports POPCNT or vmm can be loaded then bhyve is used for
  amd64 otherwise automatically installs and uses qemu@nox11
* When required third party applications or packages for booting non-x86
  images are automatically installed

Current Limitation:
* Does not support full tests like the one in our Jenkins
* At this moment this is also not suitable to be used in our Jenkins
  platform as the jobs are divided in multiple smaller tasks and
  artifacts are moved here and there which are not exactly the scenario
  for individual developers.

Future Works:
* Add full tests like the one in ci.freebsd.org
* Add different tests or options to disable some tests
* Add test profiles full
* Possibly add test through Cloud Providers like AWS/GCP/Azure or Cirrus
  or Github Actions
* Update documentation

Test Plan:
cd /usr/src/tests/ci
make ci
make TARGET=amd64 TARGET_ARCH=amd64 ci
make TARGET=amd64 TARGET_ARCH=amd64 USE_QEMU=1 ci
make TARGET=arm64 TARGET_ARCH=aarch64 ci
make TARGET=powerpc TARGET_ARCH=powerpc64 ci
make TARGET=powerpc TARGET_ARCH=powerpc64le ci
make TARGET=riscv TARGET_ARCH=riscv64 ci

Reviewed by:           lwhsu
Sponsored by:          The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43786

7 weeks agointro(7): add link to new networking(7)
Mitchell Horne [Thu, 18 Apr 2024 17:58:33 +0000 (14:58 -0300)]
intro(7): add link to new networking(7)

It improves the discoverability of the page.

Sponsored by: The FreeBSD Foundation

7 weeks agohier.7: polish entry to system manual
Alexander Ziaee [Wed, 20 Mar 2024 17:40:57 +0000 (13:40 -0400)]
hier.7: polish entry to system manual

Entries reworded to improve grammar or add keywords:
- document description: substitute layout for index for first-glance
- /etc/freebsd/update.conf
- /usr/share/vi/

Entries that have been wordshuffled for brevity or consistency:
- /{bin,libexec,nonexistent,sbin,tmp}/
- /boot/dtb/overlays/
- /boot/{defaults,efi,kernel,lua}/
- /usr/libexec/
- /var/{db,games,lib,log/{bsdisks.log,spool/,tmp/}}
- /usr/share/sysroot/VERSION/MACHINE.MACHINE_ARCH/ (unfold a little)
- /usr/local/share/doc/freebsd/ (unfold a little)

Entries that have macro or linking adjustments:
- /{boot,boot/efi,dev,etc,home,sbin,usr/bin}/ (overview or intro pages)
- /media/ (bsdisks is from ports, but afaik pulled by every desktop)
- /usr/share/{lib/,lib/dtrace/,libdata/games/,man/}/ (intro pages)
- /var/log/messages (syslog(3) -> syslogd(8))

Entries that have been added:
- /dev/{cuaU0,vmm,zvol}/
- /usr/share/{atf,bhyve}/
- /usr/share/libexec/hyperv/ (thanks @rtprio)
- /local/<subdirectories>/
- /var/log/debug.log (thanks @pauamma)
- /var/spool/{lock,lpd}

Please forgive my earlier mistakes fixed in this commit:
- /{dev,/usr/share/{calendar,misc}} : accidentally reverted description
- /etc/local-unbound.conf/ (wrong link)
- /usr/{freebsd-dist,lib32,libdata},/var/log/{dmesg.today,lpd-errs} (typos)
- /{usr/libdata/gcc/,var/log/bsdisks.log} (removed, unnecessary)

PR: 261349
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1131

7 weeks agodumpon: fix set but not used variable
inkeliz [Wed, 17 Apr 2024 21:22:44 +0000 (21:22 +0000)]
dumpon: fix set but not used variable

Signed-off-by: inkeliz <inkeliz@inkeliz.com>
Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1178

7 weeks agotools: Remove stray "then"
Cy Schubert [Thu, 18 Apr 2024 14:31:13 +0000 (07:31 -0700)]
tools: Remove stray "then"

Fixes: 26a09db3add3

7 weeks agovtnet: use CURVNET_SET() instead of CURVNET_SET_QUIET()
Gleb Smirnoff [Thu, 18 Apr 2024 14:58:00 +0000 (07:58 -0700)]
vtnet: use CURVNET_SET() instead of CURVNET_SET_QUIET()

We don't expect the VNET context to be set for virtqueue neither
for taskqueue handlers.

Suggested by: zec
Fixes: 3f2b9607756d0f92ca29c844db0718b313a06634

7 weeks agooce(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 18 Apr 2024 14:19:18 +0000 (16:19 +0200)]
oce(4): Fix a typo in a source code comment

- s/addres/address/

MFC after: 3 days

7 weeks agomuge(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 18 Apr 2024 14:18:26 +0000 (16:18 +0200)]
muge(4): Fix a typo in a source code comment

- s/addres/address/

MFC after: 3 days

7 weeks agonetpfil: Fix typos in source code comments
Gordon Bergling [Thu, 18 Apr 2024 14:17:10 +0000 (16:17 +0200)]
netpfil: Fix typos in source code comments

- s/addres/address/

MFC after: 3 days

7 weeks agoFix incremental build with WITH_NVME newly enabled
Brooks Davis [Thu, 18 Apr 2024 13:57:38 +0000 (14:57 +0100)]
Fix incremental build with WITH_NVME newly enabled

rescue.mk doesn't get updated when options change so nvme_util.o is now
missing on architectures were NVME was previously marked BROKEN.

Reviewed by: imp
Fixes: 2fda3ab0ac19 WITH_NVME: Remove from broken.
Differential Revision: https://reviews.freebsd.org/D44826

7 weeks agolib{c,sys}: normalize export of openat, setcontext, and swapcontext
Brooks Davis [Tue, 16 Apr 2024 22:26:29 +0000 (23:26 +0100)]
lib{c,sys}: normalize export of openat, setcontext, and swapcontext

List them in the symbol map rather than using the __sym_default to
expose them.  This will allow later improvements in the stub
implementations in libc.so.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44113

7 weeks agolibsys: expose a few more symbols for libc's use
Brooks Davis [Tue, 16 Apr 2024 21:50:52 +0000 (22:50 +0100)]
libsys: expose a few more symbols for libc's use

These private symbols are used by libc so expose as we do with
auxargs bits rather then relying on duplicate implementations in libc.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44114

7 weeks agolibcompiler_rt Makefile.inc: update _Float16/__bf16 checks
Dimitry Andric [Wed, 17 Apr 2024 20:20:47 +0000 (22:20 +0200)]
libcompiler_rt Makefile.inc: update _Float16/__bf16 checks

Clang supports __bf16 for riscv from version 18.0 onwards, so update the
checks for it. While here, rewrite the checks so they are hopefully more
readable, and also handle gcc a little better.

In addition, define COMPILER_RT_HAS_FLOAT16 and COMPILER_RT_HAS_BFLOAT16
when these features should be available, since there are some parts in
compiler-rt that check for these defines.

PR: 276104
MFC after: 1 month

7 weeks agocrunchgen: add --list option
Martin Tournoij [Wed, 17 Apr 2024 16:04:27 +0000 (10:04 -0600)]
crunchgen: add --list option

"bsdbox --list" will print all tools in the binary, one per line. The
main use case for this is to make it easier to create links:

for t in $(bsdbox --list); do
ln -s bsdbox $t
done

The name --list was taken from busybox.

This just adds a new "program" with the name "--list". I don't think we
need to do real argument parsing here, and this is also how busybox does
it.

An additional minor change is that just "bsdbox" will no longer print
the binary name itself ("bsdbox" in this case). Before it would do:

% bsdbox
usage: boxlike <prog> <args> ..., where <prog> is one of:
 cp ls mv bsdbox

And now just:

% bsdbox
usage: boxlike <prog> <args> ..., where <prog> is one of:
 cp ls mv

And just "bsdbox" will also exit with code 0 (and print to stdout)
rather than exit with 0 and print to stderr

Example output:

% ./bsdbox
usage: bsdbox program [args ...]
       bsdbox --list
       program [args ...]

bsdbox combines several programs in one executable. Create a link to this
executable with the program name to run that program, or give the program
name as the first argument.

Currently defined programs:
 true false tail head uname

% ./bsdbox --list
true
false
tail
head
uname

% ./bsdbox uname -a
FreeBSD freebsd 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64

% ln -s bsdbox uname
% ./uname -a
FreeBSD freebsd 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64

Pull Request: https://github.com/freebsd/freebsd-src/pull/894
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/894

7 weeks agoheimdal: asn1: Use unsigned bitfields for named bitsets
Dimitry Andric [Wed, 17 Apr 2024 17:49:30 +0000 (19:49 +0200)]
heimdal: asn1: Use unsigned bitfields for named bitsets

Import upstream 6747e1628:

  asn1: Use unsigned bitfields for named bitsets

  Signed 1-bit bitfields are undefined in C.

This should fix the following warnings, which for unknown reasons are
errors in CI:

  /usr/src/crypto/heimdal/lib/hx509/ca.c:1020:22: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1020 |         ku.digitalSignature = 1;
        |                             ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1021:21: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1021 |         ku.keyEncipherment = 1;
        |                            ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1028:17: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1028 |         ku.keyCertSign = 1;
        |                        ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1029:13: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1029 |         ku.cRLSign = 1;
        |                    ^ ~

PR: 276960
Fixes: 1b7487592987
MFC after: 1 week

7 weeks agoheimdal: Add 64-bit integer support to ASN.1 compiler
Dimitry Andric [Tue, 16 Apr 2024 18:56:37 +0000 (20:56 +0200)]
heimdal: Add 64-bit integer support to ASN.1 compiler

Import upstream 19d378f44:

  ASN.1 INTEGERs will now compile to C int64_t or uint64_t, depending
  on whether the constraint ranges include numbers that cannot be
  represented in 32-bit ints and whether they include negative
  numbers.

  Template backend support included.  check-template is now built with
  --template, so we know we're testing it.

  Tests included.

Also adjusts the generated files:
* asn1parse.c, asn1parse.h (not strictly necessary, but nice to have)
* der-protos.h, which needs a bunch of new prototypes. I copied these
  from a der-protos.h generated by the upstream build system, which
  uses a perl script for this.
* adjust printf format strings for int64_t. Upstream uses %lld for this,
  but that is not portable, and leads to lots of -Werror warnings.

This should fix target-dependent differences between headers generated
by asn1_compile. For example, when cross compiling world from amd64 to
i386, the generated cms_asn1.h header has:

  CMSRC2CBCParameter ::= SEQUENCE {
    rc2ParameterVersion   INTEGER (0..-1),
    iv                    OCTET STRING,
  }

while a native build on i386 has:

  CMSRC2CBCParameter ::= SEQUENCE {
    rc2ParameterVersion   INTEGER (0..2147483647),
    iv                    OCTET STRING,
  }

These are _both_ wrong, since the source file, cms.asn1, has:

  CMSRC2CBCParameter ::= SEQUENCE {
          rc2ParameterVersion   INTEGER (0..4294967295),
          iv                    OCTET STRING -- exactly 8 octets
  }

PR: 276960
Reviewed by: cy, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44814
Differential Revision: https://reviews.freebsd.org/D44815

7 weeks agonetworking.7 : create network quickstart guide
Alexander Ziaee [Wed, 17 Apr 2024 15:51:35 +0000 (09:51 -0600)]
networking.7 : create network quickstart guide

Now that the handbook has been moved to ports, I think it's very nice to
have a network quickstart guide in-band, in base, in the system manual.
If the user uses any of the following terms "man -k
{network,networking,wifi,quickstart}" this page will come up, which is I
think a very common use case for new users.

Currently, this document explains connecting to a basic Ethernet
network, a basic wifi network, scanning for wifi networks, and airplane
mode, as well as linking to other sections, including the handbook

Co-authored-by: Graham Perrin <grahamperrin@gmail.com>
Reviewed by: imp, bcr, freebsd@igalic.co
Pull Request: https://github.com/freebsd/freebsd-src/pull/833

7 weeks agonfsserver: Rate-limit messages about requests from unprivileged ports
Mark Johnston [Wed, 17 Apr 2024 14:36:58 +0000 (10:36 -0400)]
nfsserver: Rate-limit messages about requests from unprivileged ports

If access from unreserved ports is disabled, then a remote host can
cause an NFS server to log a message by sending a packet.  This is
useful for diagnosing problems but bad for resiliency in the case where
the server is being spammed with a large number of rejected requests.

Limit prints to once per second (racily).

Reviewed by: rmacklem, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44819

7 weeks agonuageinit: start the script after zfs
Baptiste Daroussin [Wed, 17 Apr 2024 14:25:02 +0000 (16:25 +0200)]
nuageinit: start the script after zfs

It prevents the home directory for the new users to be hidden
by late mount of the home directory

7 weeks agolibarchive: add two missing package files to libarchive tests
Martin Matuska [Wed, 17 Apr 2024 07:58:32 +0000 (09:58 +0200)]
libarchive: add two missing package files to libarchive tests

MFC after: 1 week

7 weeks agolibarchive: fix null format string error in tests (unbreaks gcc13 build)
Martin Matuska [Wed, 17 Apr 2024 07:33:13 +0000 (09:33 +0200)]
libarchive: fix null format string error in tests (unbreaks gcc13 build)

Obtained from: libarchive (d43c39247)
MFC after: 1 week

7 weeks agozfs: unbreak aarch64 build with non-gcc compilers
Martin Matuska [Tue, 16 Apr 2024 23:34:25 +0000 (01:34 +0200)]
zfs: unbreak aarch64 build with non-gcc compilers

Workaround until a permanent fix comes from vendor

7 weeks agoWITH_NVME: Remove from broken.
Warner Losh [Tue, 16 Apr 2024 23:07:49 +0000 (17:07 -0600)]
WITH_NVME: Remove from broken.

NVME works everywhere, so we can eliminate this. We may remove the
option altogether.

Sponsored by: Netflix
Discussed with: ken, jhb

7 weeks agonvmecontrol: One file per line
Warner Losh [Tue, 16 Apr 2024 22:37:30 +0000 (16:37 -0600)]
nvmecontrol: One file per line

Move to a one file per line setup, and sort the files alphabetically.

Sponsored by: Netflix
Reviewed by: chuck, jhb
Differential Revision: https://reviews.freebsd.org/D44684

7 weeks agonvmecontrol: Add nvme 2.0 fields to read_logpage
Warner Losh [Tue, 16 Apr 2024 22:37:20 +0000 (16:37 -0600)]
nvmecontrol: Add nvme 2.0 fields to read_logpage

Add the lpo, ot, csi and uuid_index fields to read_logpage. The logpage
command has not been updated to allow these to be specified.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D44683

7 weeks agonvmecontrol: Preliminary namespace documentation
Warner Losh [Tue, 16 Apr 2024 22:37:02 +0000 (16:37 -0600)]
nvmecontrol: Preliminary namespace documentation

Provide preliminary namespace subcommand documentation, along with some
basic definitions from the NVM standards relating to namespaces.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D44682

7 weeks agonvmecontrol: add newlines where needed for ns command printfs
Warner Losh [Tue, 16 Apr 2024 22:36:54 +0000 (16:36 -0600)]
nvmecontrol: add newlines where needed for ns command printfs

Sponsored by: Netflix
Reviewed by: chuck, jhb
Differential Revision: https://reviews.freebsd.org/D44681

7 weeks agonvme: Eliminate intel_log_temp_stats_swapbytes
Warner Losh [Tue, 16 Apr 2024 22:36:47 +0000 (16:36 -0600)]
nvme: Eliminate intel_log_temp_stats_swapbytes

We can't post a AER for this page, so there's no need to be able to swap
it to host byte order. It's not one of the standard defined pages that
can post via AER, and the vendor's public docs for this temperature page
don't suggest it's possible to get over or under event changes. Since
nvmecontrol no longer needsd the swap routine, remove it since it's
now unused.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44659

7 weeks agonvmecontrol: Move intel temperature page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:41 +0000 (16:36 -0600)]
nvmecontrol: Move intel temperature page printing to little endian orderinng

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44658

7 weeks agonvmecontrol: Move sanitize status page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:36 +0000 (16:36 -0600)]
nvmecontrol: Move sanitize status page printing to little endian orderinng

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44657

7 weeks agonvmecontrol: Move reservation notifcation page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:31 +0000 (16:36 -0600)]
nvmecontrol: Move reservation notifcation page printing to little endian orderinng

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44656

7 weeks agonvmecontrol: Move command effeccts page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:25 +0000 (16:36 -0600)]
nvmecontrol: Move command effeccts page printing to little endian orderinng

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44655

7 weeks agonvmecontrol: Move self test status page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:19 +0000 (16:36 -0600)]
nvmecontrol: Move self test status page printing to little endian orderinng

Also, add printing vnedor_specific field, which doesn't have a valid
bit, so is always valid.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44654

7 weeks agonvmecontrol: Move namespace change page printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:13 +0000 (16:36 -0600)]
nvmecontrol: Move namespace change page printing to little endian orderinng

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44653

7 weeks agonvmecontrol: Move smart/health printing to little endian orderinng
Warner Losh [Tue, 16 Apr 2024 22:36:05 +0000 (16:36 -0600)]
nvmecontrol: Move smart/health printing to little endian orderinng

Move health printing to little endian ordering...

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44652

7 weeks agonvmecontrol: Fix to128 for big endian targets
Warner Losh [Tue, 16 Apr 2024 22:35:59 +0000 (16:35 -0600)]
nvmecontrol: Fix to128 for big endian targets

The source is always 128-bits in little endian format. For big endian
hosts, we have to convert, or we print bogus numbers.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44651

7 weeks agonvmecontrol: Have to truncate on all 32-bit architectures
Warner Losh [Tue, 16 Apr 2024 22:35:53 +0000 (16:35 -0600)]
nvmecontrol: Have to truncate on all 32-bit architectures

armv7, powerpc, powerpcspe and i386 all lack 128-bit integer
types. Adjust the comment and #ifdef. I don't think we support nvme on
any of these other architectures at the moment, but it won't hurt to be
more precise.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44650

7 weeks agonvmecontrol: Make the error log page work on native format
Warner Losh [Tue, 16 Apr 2024 22:35:46 +0000 (16:35 -0600)]
nvmecontrol: Make the error log page work on native format

As the number of page types proliferates, it becomes untennable to
convert them in read_logpage (especailly since new UUID page types will
need to be supported). Convert the error page printing code to operate
on little endian data.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44680

7 weeks agonvmecontrol: Create letoh to generically convert to host order
Warner Losh [Tue, 16 Apr 2024 22:35:33 +0000 (16:35 -0600)]
nvmecontrol: Create letoh to generically convert to host order

Using _Generic, create letoh which will generically convert uintXX_t
types from little endian to host, regardless of the size. This name has
been floated as a possible addition to endian.h.

Sponsored by: Netflix
Discussed with: jhb
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44649

7 weeks agoarm_kernel_bothdr.awk: Update to latest ota
Warner Losh [Mon, 15 Apr 2024 21:07:46 +0000 (15:07 -0600)]
arm_kernel_bothdr.awk: Update to latest ota

The latest ota is the first one in FreeBSD that treats 0 + "0xf" as
being '0' instead of '15'. Don't use this old trick anymore to convert
from hexidecimal to a number. Write a function to do that instead. This
fixes kernel.bin building on arm*. awk on 14 doesn't need this, but to
build FreeBSD stable/14's kernel.bin on 15 we'll need it, so fast MFC.

MFC After: 3 days
Sponsored by: Netflix
Reviewed by: kevans
Differential Revision:  https://reviews.freebsd.org/D44801

7 weeks agocp: Use warnc().
Dag-Erling Smørgrav [Wed, 17 Apr 2024 02:07:20 +0000 (04:07 +0200)]
cp: Use warnc().

MFC after: 1 week
Sponsored by: Klara, Inc.

7 weeks agoinstall: Assorted nitpickery.
Dag-Erling Smørgrav [Wed, 17 Apr 2024 01:36:42 +0000 (03:36 +0200)]
install: Assorted nitpickery.

* Use `errc()` instead of manually setting `errno` before calling `err()`.
* Change one warning into a fatal error.
* Drop some unnecessary casts.
* `strlcat()` bounds checks were off-by-one.  This does not matter in
  practice because the subsequent code renders an overrun harmless.
* We were passing `SSIZE_MAX` to `copy_file_range()` instead of the
  requested size.  This only matters if we're asked to install a file
  which is still being written to while we are copying it.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44810

7 weeks agoinstall: Remove the mmap(2) option.
Dag-Erling Smørgrav [Wed, 17 Apr 2024 01:36:31 +0000 (03:36 +0200)]
install: Remove the mmap(2) option.

We already removed it from cp(1) over a year ago but never followed up
here.  Do so now, for the same reasons: significant complexity for
little to no benefit.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44809

7 weeks agocp: Additional sanity check.
Dag-Erling Smørgrav [Wed, 17 Apr 2024 01:36:26 +0000 (03:36 +0200)]
cp: Additional sanity check.

Once we've successfully opened the file we've been asked to copy, check
that it's of the same type as FTS told us it was.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude, markj
Differential Revision: https://reviews.freebsd.org/D44806

7 weeks agocp: Clarify an obscure comment.
Dag-Erling Smørgrav [Wed, 17 Apr 2024 01:36:22 +0000 (03:36 +0200)]
cp: Clarify an obscure comment.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44805

7 weeks agoacpi_battery: avoid divide-by-zero when no devices have capacity info
Josef 'Jeff' Sipek [Tue, 16 Apr 2024 23:01:28 +0000 (19:01 -0400)]
acpi_battery: avoid divide-by-zero when no devices have capacity info

On laptops with builtin batteries, disconnecting the battery may show up
as a battery without any capacity information. (The theory is that one
is disconnecting the cells but the electronics identifying the battery
are still connected.) As a result, the loop over all batteries in
acpi_battery_get_battinfo results in total_lfcap == 0.

So, just check that total_lfcap is non-zero to avoid a division by zero
(triggerable by sysctl hw.acpi.battery).

Reported by: Stefano Marinelli
Tested by: Stefano Marinelli
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D44818

7 weeks agoexports.5: Clarify that exported dirs should be local mount points
Mark Johnston [Tue, 16 Apr 2024 22:25:57 +0000 (18:25 -0400)]
exports.5: Clarify that exported dirs should be local mount points

If not, then in general the entire filesystem containing the exported
directory is accessiable.  This may be surprising, so try to make it
more clear.

Reviewed by: rmacklem, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44614

7 weeks agoexports.5: Update an example to use service(8)
Mark Johnston [Tue, 16 Apr 2024 22:25:19 +0000 (18:25 -0400)]
exports.5: Update an example to use service(8)

MFC after: 1 week

7 weeks agolibarchive: merge from vendor branch
Martin Matuska [Tue, 16 Apr 2024 21:39:31 +0000 (23:39 +0200)]
libarchive: merge from vendor branch

Libarchive 3.7.3

New features:
  #1941 uudecode filter: support file name and file mode in raw mode
  #1943 7-zip reader: translate Windows permissions into UNIX
        permissions
  #1962 zstd filter now supports the "long" write option
  #2012 add trailing letter b to bsdtar(1) substitute pattern
  #2031 PCRE2 support
  #2054 add support for long options "--group" and "--owner" to tar(1)

Security fixes:
  #2101 Fix possible vulnerability in tar error reporting introduced
        in f27c173

Important bugfixes:
  #1974 ISO9660: preserve the natural order of links
  #2105 rar5: fix infinite loop if during rar5 decompression the last
        block produced no data
  #2027 xz filter: fix incorrect eof at the end of an lzip member
  #2043 zip: fix end-of-data marker processing when decompressing zip
        archives

PR: 278315 (exp-run)
MFC after: 1 week

7 weeks agolibc/arm: export __signalcontext not _signalcontext
Brooks Davis [Tue, 16 Apr 2024 17:05:16 +0000 (18:05 +0100)]
libc/arm: export __signalcontext not _signalcontext

The former exists and architectures other than aarch64 and riscv provide
it.  The later does not exist.

Differential Revision: https://reviews.freebsd.org/D44329

7 weeks agolibcxxrt: don't export nonexistant symbols
Brooks Davis [Tue, 16 Apr 2024 17:04:16 +0000 (18:04 +0100)]
libcxxrt: don't export nonexistant symbols

Remove version entries that we don't build.

Add an arm specific Version.map and for other targets run the files
through sed to handle int vs long in new and delete.

Ideally we'd use the SYMBOL_MAPS functionality to preprocess with cpp,
but it doesn't currently handle C++ symbols so be annoyingly duplicative
for now.

Differential Revision: https://reviews.freebsd.org/D44325

7 weeks agolibgcc_s: exclude symbols not present on some arches
Brooks Davis [Tue, 16 Apr 2024 17:03:42 +0000 (18:03 +0100)]
libgcc_s: exclude symbols not present on some arches

arm, aarch64, and riscv lack some/all frame_info interfaces.
arm and powerpc lack some numeric functions.

Differential Revision: https://reviews.freebsd.org/D44324

7 weeks agolibgcc_s: only export 128-bit int APIs when available
Brooks Davis [Tue, 16 Apr 2024 17:03:21 +0000 (18:03 +0100)]
libgcc_s: only export 128-bit int APIs when available

These interfaces are only compiled when the platform supports 128-bit
ints.  Use a CRT_HAS_128BIT guard similar to the one used in the
compiler_rt sources.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D44323

7 weeks agolibgcc_s: only export 128-bit long double when available
Brooks Davis [Tue, 16 Apr 2024 17:02:55 +0000 (18:02 +0100)]
libgcc_s: only export 128-bit long double when available

These functions are only available on aarch64 and riscv so only try to
export them on those architectures.

Differential Revision: https://reviews.freebsd.org/D44322

7 weeks agolibrpcsec_gss: don't export non-existant symbols
Brooks Davis [Tue, 16 Apr 2024 17:02:14 +0000 (18:02 +0100)]
librpcsec_gss: don't export non-existant symbols

rpc_gss_mesh_to_oid was never implemented.

This doesn't seem to be any reason why we would need to export the _stub
functions, but it's also a little unclear to me why the linker thinks
they aren't present.  Perhaps they should be static.

Differential Revision: https://reviews.freebsd.org/D44248

7 weeks agolibc: don't try to export __sF
Brooks Davis [Tue, 16 Apr 2024 17:01:54 +0000 (18:01 +0100)]
libc: don't try to export __sF

This symbol has been static since 2008 (commit 1e98f88776fc).

Differential Revision: https://reviews.freebsd.org/D44188