Stefan Eßer [Sat, 20 Apr 2024 06:30:35 +0000 (08:30 +0200)]
ldconfig: document changed default byte-order
Document that the hints file is created in little-endian byte-order
by default now. The -B option can be used to create a big-endian hints
file. Currently, both formats are accepted by the run-time linker on
all architectures.
- if the kernel is configured with a packet filter which drops packets
by default, pfctl or ipfw will be required in the rescue environment
to make the network functional.
- rescue's stated purpose is to be useful for small/embedded systems
(and is also quite useful for small jails); a rescue-based router
would want these binaries.
On amd64, this increases the size of rescue from 17346200 to 17907248,
or 561048 bytes (3.2%).
usr.bin/units: use else..if to avoid calling the next branch
Even if the first branch succeeds, next time it will still check for
the second branch (which will be false) as the first one was true.
Add an else..if statement to address this.
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.
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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
* 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.
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.
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.
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
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
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
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
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
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
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.
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
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)
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.
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.
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
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;
| ^ ~
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:
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
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.
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.