]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agoAdd a comment to the new tcp_get_srtt method to clarify that ticks
Randall Stewart [Fri, 19 May 2023 19:53:26 +0000 (15:53 -0400)]
Add a comment to the new tcp_get_srtt method to clarify that ticks
are kept in a shifted form and need to be un-shifted before use.

Suggested by: rpokala@

13 months agodate: add -z output_zone option
Baptiste Daroussin [Fri, 19 May 2023 09:08:11 +0000 (11:08 +0200)]
date: add -z output_zone option

Inpired by OpenBSD date(1), this option allows to do timezone conversion
via the date(1) command.

For example, to determine when the BSDCan livestream begins for me:

$ env -i TZ=EST5EDT date -z Europe/Paris -j 0900

MFC After: 1 week
Reviewed by: kib, bcr (manpage)
Differential Revision: https://reviews.freebsd.org/D40159

13 months agoThere are congestion control algorithms will that pull in srtt, and this can cause...
Randall Stewart [Fri, 19 May 2023 15:16:28 +0000 (11:16 -0400)]
There are congestion control algorithms will that pull in srtt, and this can cause issues with rack.

When using rack, cubic and htcp will grab the srtt, but they think it is in ticks. For rack
it is in micro-seconds (which we should probably move all stacks to actually). This causes
issues so instead lets make a new interface so that any CC module can pull the srtt in
whatever granularity they want.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D40146

13 months agoCirrus-CI: switch to -lite LLVM package for native run
Ed Maste [Wed, 17 May 2023 18:16:06 +0000 (14:16 -0400)]
Cirrus-CI: switch to -lite LLVM package for native run

This reduces CI cycle time (a small amount).

Suggested by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40136

13 months agomi_startup: Instrument the bubblesort with TSLOG
Colin Percival [Fri, 19 May 2023 13:46:42 +0000 (06:46 -0700)]
mi_startup: Instrument the bubblesort with TSLOG

The bubblesort of SYSINITs is currently responsible for 7% of the
kernel boot time when booting a 1 CPU / 128 MB VM under Firecracker.

It needs to be replaced with a faster sort, but until that happens
at least instrumenting it with TSLOG makes it show up in flamecharts.

13 months agoif_bridge: fix potential panic
Kristof Provost [Thu, 18 May 2023 18:04:45 +0000 (20:04 +0200)]
if_bridge: fix potential panic

When a new bridge_rtnode is added it is added with a NULL brt_dst. The
brt_dst is set after the entry is added. This means there's a small
window where another core could also attempt to add this node, leading
to the code attempting to log that the MAC addresses moved to a new
interface.
Aside from that being a spurious log entry it also panics, because
obif is NULL (and we attempt to dereference it).

Avoid this by settings brt_dst before we insert the bridge_rtnode.
Assert that obif is non-NULL, as an extra precaution.

Reported by: olivier@
Reviewed by: zlei@
Differential Revision: https://reviews.freebsd.org/D40147

13 months agonetlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
Alexander V. Chernikov [Fri, 19 May 2023 09:44:21 +0000 (09:44 +0000)]
netlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
sockaddrs.

MFC after: 2 weeks

13 months agocarp test: improve jail names for unicast_ll_v6 test
Kristof Provost [Thu, 18 May 2023 20:06:37 +0000 (22:06 +0200)]
carp test: improve jail names for unicast_ll_v6 test

Rename the jails used in the unicast_ll_v6 test, to ensure the jail
names are unique to this test.
That is one of the requirements for running these tests in parallel.

13 months agopfsync tests: check for the correct IP address
Kristof Provost [Thu, 18 May 2023 19:37:48 +0000 (21:37 +0200)]
pfsync tests: check for the correct IP address

When checking if the state synced over we should look for
198.51.100.254, not 198.51.100.2. The test worked because the incorrect
address is a substring of the correct one, but we should fix it anyway.

Reported by: Naman Sood <naman@freebsdfoundation.org>
MFC after: 1 week

13 months agoproc: s/short/int lock-related counters
Mateusz Guzik [Thu, 18 May 2023 19:45:33 +0000 (19:45 +0000)]
proc: s/short/int lock-related counters

short is small enough that it can overflow in practice for certain cases
and then trigger wrong asserts.

One known example is vfs namecache resize which grabs all locks at once.

Reported by: gallatin
Sponsored by: Rubicon Communications, LLC ("Netgate")

13 months agoproc: s/short/u_char for td_stopsched
Mateusz Guzik [Thu, 18 May 2023 19:44:29 +0000 (19:44 +0000)]
proc: s/short/u_char for td_stopsched

bool is not used because of massive header mess

While here move it into a gap.

Sponsored by: Rubicon Communications, LLC ("Netgate")

13 months agoUnder RSS, assign a TCP flow's inp_flowid anyway.
Cheng Cui [Thu, 11 May 2023 09:06:04 +0000 (05:06 -0400)]
Under RSS, assign a TCP flow's inp_flowid anyway.

Summary:
This brings some benefit of a tcp flow identification for some kernel
modules, such as siftr.

Reviewers: rrs, rscheff, tuexen, #transport!
Approved by: tuexen (mentor), rrs
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40061

13 months agolibc: Update copyright text to match current templates.
Peter Wemm [Thu, 18 May 2023 18:30:10 +0000 (11:30 -0700)]
libc: Update copyright text to match current templates.

13 months agotraceroute.8: Document TOS as DiffServ and ECN
Jesse Rosenstock [Thu, 18 May 2023 17:10:13 +0000 (11:10 -0600)]
traceroute.8: Document TOS as DiffServ and ECN

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

13 months agolinux(4): Implement ptrace_pokeusr for x86_64
Dmitry Chagin [Thu, 18 May 2023 17:02:35 +0000 (20:02 +0300)]
linux(4): Implement ptrace_pokeusr for x86_64

Differential Revision: https://reviews.freebsd.org/D40097
MFC after: 1 week

13 months agolinux(4): Make ptrace_pokeusr machine dependent
Dmitry Chagin [Thu, 18 May 2023 17:01:12 +0000 (20:01 +0300)]
linux(4): Make ptrace_pokeusr machine dependent

Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week

13 months agolinux(4): Make ptrace_peekusr machine dependend
Dmitry Chagin [Thu, 18 May 2023 17:00:12 +0000 (20:00 +0300)]
linux(4): Make ptrace_peekusr machine dependend

And partially implement it for x86_64.

Differential Revision: https://reviews.freebsd.org/D40095
MFC after: 1 week

13 months agolinux(4): Move linux_debug decalration to linux_util.h
Dmitry Chagin [Thu, 18 May 2023 16:58:23 +0000 (19:58 +0300)]
linux(4): Move linux_debug decalration to linux_util.h

To avoid inclusion of linux_mib.h with linux_util.h in cases where
we need rate limiting macro.

MFC after: 1 week

13 months agocarp tests: test unicast carp via link-local addresses
Kristof Provost [Thu, 18 May 2023 14:43:46 +0000 (16:43 +0200)]
carp tests: test unicast carp via link-local addresses

Sponsored by: Rubicon Communications, LLC ("Netgate")

13 months agocarp: fix unicast link-local
Kristof Provost [Thu, 18 May 2023 15:30:39 +0000 (17:30 +0200)]
carp: fix unicast link-local

If the peer6 address is a link-local address we have to embed the
scopeid, much like we have to for IPv6 multicast as well.

Sponsored by: Rubicon Communications, LLC ("Netgate")

13 months agoifconfig: improve error checking for carp peer6
Kristof Provost [Wed, 17 May 2023 19:39:42 +0000 (21:39 +0200)]
ifconfig: improve error checking for carp peer6

getaddrinfo() returns 0 if it succeeded, but it's not guaranteed to
return 1 on error. Check for success rather than for one specific error.

Without this fix commands such as `ifconfig bnxt1 inet6 add vhid 1 peer6
2001:db8::1/64` would segfault ifconfig.

Sponsored by: Rubicon Communications, LLC ("Netgate")

13 months agoifconfig: improve trimming off interface number at end
Bjoern A. Zeeb [Wed, 17 May 2023 20:40:47 +0000 (20:40 +0000)]
ifconfig: improve trimming off interface number at end

When trying to auto-load a module, we trim the interface number off
the end.  Currently we stop at the first digit.  For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4).  For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by: The FreeBSD Foundation
Reported by: thierry
MFC after: 20 days
Reviewed by: melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137

13 months agorc.d/netif: Don't DAD if lo0 is the only IPv6 IF
Colin Percival [Thu, 18 May 2023 03:17:24 +0000 (20:17 -0700)]
rc.d/netif: Don't DAD if lo0 is the only IPv6 IF

The code in rc.d/netif waiting for IPv6 Duplicate Address Detection if
any network interfaces support IPv6.  Unfortunately, since lo0 *always*
has IPv6 enabled, this means unconditionally sleeping, even on systems
which have no external IPv6 interfaces.

Since we presume that there is little risk of a duplicate address being
assigned on lo0, amend the test to wait only if there is an interface
*other than lo0* which supports IPv6.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D40141

13 months agolinux(4): Check fd passed to unlockpt()
Dmitry Chagin [Thu, 18 May 2023 07:55:39 +0000 (10:55 +0300)]
linux(4): Check fd passed to unlockpt()

In our implementation, grantpt() and unlockpt() don't actually have
any use, because PTY's are created on the fly and already have proper
permissions upon creation.
Atleast check that a proper fd passed to unlockpt(). For grantpt()
Glibc calls TIOCGPTN ioctl which would fail if fd is not a master.

Differential Revision: https://reviews.freebsd.org/D40100
MFC after: 1 week

13 months agoktls: don't try to unlock pcb if tcp_drop() already did
Gleb Smirnoff [Wed, 17 May 2023 17:25:28 +0000 (10:25 -0700)]
ktls: don't try to unlock pcb if tcp_drop() already did

Reviewed by: rrs, gallatin

13 months agopf: Standardize rtableid
Kajetan Staszkiewicz [Wed, 17 May 2023 13:57:42 +0000 (15:57 +0200)]
pf: Standardize rtableid

Prepare for rtableid being included in struct pfsync_state where it will
be int32_t. Make variables which will be set to and from it the same
width.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40013

13 months agobhyve: error out if fwcfg user file isn't read completely
Corvin Köhne [Fri, 12 May 2023 05:37:32 +0000 (07:37 +0200)]
bhyve: error out if fwcfg user file isn't read completely

At the moment, fwcfg reads the file once at startup and passes these
data to the guest. Therefore, we should always read the whole file.
Otherwise we should error out.

Additionally, GCC12 complains that the comparison whether
fwcfg_file->size is lower than 0 is always false due to the limited
range of data type.

Reviewed by: markj
Fixes: ca14781c8170f3517ae79e198c0c880dbc3142dd ("bhyve: add cmdline option for user defined fw_cfg items")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40076

13 months agopf: release rules lock before passing the packet to dummynet
Kristof Provost [Thu, 11 May 2023 16:10:33 +0000 (18:10 +0200)]
pf: release rules lock before passing the packet to dummynet

In the Ethernet rules we held the PF_RULES lock while we called
ip_dn_io_ptr() (i.e. dummynet). That meant that we could end up back in
pf while still holding the PF_RULES lock.
That's not immediately fatal, because that lock is recursive, but still
not ideal.

There also appear to be scenarios where this can actually trigger
deadlocks.

We don't need to hold the PF_RULES lock, as long as we make a local copy
of the data we need from the rule (in this case, the action and
bridge_to target). It's safe to keep the struct ifnet pointer around,
because we remain in NET_EPOCH.

See also: https://redmine.pfsense.org/issues/14373
MFC after: 1 week
Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40067

13 months agoMove the arm64 sigcode to .rodata
Andrew Turner [Wed, 17 May 2023 11:00:12 +0000 (12:00 +0100)]
Move the arm64 sigcode to .rodata

The kernel doesn't execute this code, it's only ever copied to
userspace. Move it to .rodata as we don't need to modify it.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39399

13 months agoLinuxKPI: add ns_to_timespec64()
Bjoern A. Zeeb [Tue, 16 May 2023 21:00:45 +0000 (21:00 +0000)]
LinuxKPI: add ns_to_timespec64()

Add ns_to_timespec64() which does not seem to require anything from
us given timespec64 is aliases to timespec.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40123

13 months agoix(4): correct max MTU
Piotr Kubaj [Wed, 17 May 2023 10:16:22 +0000 (12:16 +0200)]
ix(4): correct max MTU

The max MTU for the ix(4) is 9710.

Differential revision: https://reviews.freebsd.org/D40003
Approved by: erj, bcr

13 months agoem: sync platform detection with Linux
Piotr Kubaj [Wed, 17 May 2023 10:14:02 +0000 (12:14 +0200)]
em: sync platform detection with Linux

Switch 16 and 23 adapters from tgp to adp.

PR: 270929
Differential revision: https://reviews.freebsd.org/D39977
Approved by: erj, kbowling

13 months agorouting: plug mbuf leak for the packets hitting IPv6 blackhole route
Alexander V. Chernikov [Wed, 17 May 2023 09:06:04 +0000 (09:06 +0000)]
routing: plug mbuf leak for the packets hitting IPv6 blackhole route

Reported by: Dmitriy Smirnov <fox@sage.su>
Tested by: Dmitriy Smirnov <fox@sage.su>
MFC after: 1 day

13 months agorouting: fix panic triggered by the 'gr_idx != 0' assert in nhg code
Alexander V. Chernikov [Wed, 17 May 2023 08:24:05 +0000 (08:24 +0000)]
routing: fix panic triggered by the 'gr_idx != 0' assert in nhg code

Nexthop groups can be referenced by the external code. The reference
 can be released after the VNET destruction. Furthermore, nexthop
 groups use a single per-rib lock, which is destroyed during the
 VNET desctruction. To eliminate use-after-free problem, each nhg
 is marked as "unlinked" during the VNET destruction stage, leaving
 nhg_idx intact. Normally there should not be such nexthops, but if
 there are any, the kernel will panic on 'gr_idx != 0' when the
 last nhg reference is released.

Address this by using the assert checks only when the nexthop group
 is destroyed during "valid" VNET lifetime.

MFC after: 3 days

13 months agonet/if_var.h: consistently use if_t over struct ifnet *
Konstantin Belousov [Wed, 17 May 2023 01:22:36 +0000 (04:22 +0300)]
net/if_var.h: consistently use if_t over struct ifnet *

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agonet/if.h: fix style of if_t definition
Konstantin Belousov [Wed, 17 May 2023 01:21:57 +0000 (04:21 +0300)]
net/if.h: fix style of if_t definition

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agopfsync: Remove deletion of states using the full pfsync_state struct
Kajetan Staszkiewicz [Mon, 15 May 2023 19:43:06 +0000 (21:43 +0200)]
pfsync: Remove deletion of states using the full pfsync_state struct

State deletions are sent over pfsync using struct pfsync_del_c.

Remove the code for receiving state deletions using struct pfsync_state
as such deletions are never sent. Rename functions and constants so that
only the "compressed" versions remain.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40004

14 months agoLinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()
Bjoern A. Zeeb [Tue, 16 May 2023 21:22:34 +0000 (21:22 +0000)]
LinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()

Add a dummy skb_hwtstamps() function for now, and implement
skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header().

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

14 months agoLinuxKPI: add ptp_clock_kernel.h
Bjoern A. Zeeb [Tue, 16 May 2023 21:24:08 +0000 (21:24 +0000)]
LinuxKPI: add ptp_clock_kernel.h

Add the new ptp_clock_kernel.h with structs and dummy functions for
kernel ptp support.  This is needed for the next iwlwifi update.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

14 months agoktrace: Simplify ae6ac587, drop the sa var declaration
Dmitry Chagin [Tue, 16 May 2023 19:46:26 +0000 (22:46 +0300)]
ktrace: Simplify ae6ac587, drop the sa var declaration

Suggested by: kib
MFC after: 5 days

14 months agoifconfig: make interface and address listing use Netlink as transport
Alexander V. Chernikov [Wed, 10 May 2023 13:58:21 +0000 (13:58 +0000)]
ifconfig: make interface and address listing use Netlink as transport

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

14 months agonetlink: add support for adding/deleting interface addresses
Alexander V. Chernikov [Mon, 15 May 2023 11:59:39 +0000 (11:59 +0000)]
netlink: add support for adding/deleting interface addresses

Differential Revision: https://reviews.freebsd.org/D40103
MFC after: 2 weeks

14 months agonet80211: Radiotap: update for newer standards (add EHT, U-SIG)
Bjoern A. Zeeb [Tue, 16 May 2023 16:03:17 +0000 (16:03 +0000)]
net80211: Radiotap: update for newer standards (add EHT, U-SIG)

iwlwifi already uses suggested EHT and U-SIG bits as well as some
more TLV bits.  Update radiotap to know of those even if they might
get updated again in the future in order to get newer versions of
the driver to compile.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

14 months agotesting: improve vnet support in pytest
Alexander V. Chernikov [Tue, 16 May 2023 15:00:45 +0000 (15:00 +0000)]
testing: improve vnet support in pytest
* Allow vnet object to be directly referenced
 (self.vnet1 vs self.vnet_map["vnet1"])
* Allow iface object to be directly reference
 (vnet.bridge vs vnet.iface_alias_map["bridge"])
* Allow arbitrary interface alias names insted of ifX
* Add wait_objects_any() method for waiting object from
 multiple vnets
* Add wait() method for indefinite sleep on vnet handlers

MFC after: 2 weeks

14 months agopasswd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79
Jose Luis Duran [Tue, 16 May 2023 11:17:16 +0000 (11:17 +0000)]
passwd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79

MFC After: 3 days

14 months agopasswd.5: Remove .Tn (Trade Name) macros
Jose Luis Duran [Tue, 16 May 2023 11:18:53 +0000 (11:18 +0000)]
passwd.5: Remove .Tn (Trade Name) macros

To appease mandoc -T lint, remove .Tn macros.

MFC After: 3 days

14 months agopw: The pw_checkname function has added ';' checking.
pbuff [Tue, 16 May 2023 03:05:30 +0000 (11:05 +0800)]
pw: The pw_checkname function has added ';' checking.

The pw_checkname function forgot to include a ';'
when checking usernames, causing shell commands
to be executed when a username with a ';' is deleted.

PR: 271427
MFC After: 3 days

14 months agotests: Don't recurse into sys/compat32
Jessica Clarke [Tue, 16 May 2023 01:06:34 +0000 (02:06 +0100)]
tests: Don't recurse into sys/compat32

Stubbing out the whole file means it has no targets, so recursive makes
fail with "don't know how to make X". We could fix that, but because the
level above is adding it to TESTS_SUBDIRS it'll generate an include line
for the subdirectory in its Kyuafile, which won't work (the problem that
was previously seen on non-aarch64 in CI). Thus we really need to not
even add it to TESTS_SUBDIRS in the first place.

Reported by: Dan Mack <mack@macktronics.com>
Fixes: 28f66935d400 ("tests: Disable sys/compat32 and sys/compat32/aarch64 tests")

14 months agotests: Disable sys/compat32 and sys/compat32/aarch64 tests
Jessica Clarke [Mon, 15 May 2023 22:16:40 +0000 (23:16 +0100)]
tests: Disable sys/compat32 and sys/compat32/aarch64 tests

The former has build system issues, with missing Kyuafiles, presumably
due to not using TESTS_SUBDIRS and bsd.test.mk (and possibly some issues
on top of that around TESTSDIR and related variables). The latter has
issues with GCC and cut-down LLVM builds.

Requested by: kevans
Fixes: ccb59683b983 ("arm64: add tests for swp/swpb emulation")

14 months agonvmecontrol: Fix power subcommand output.
Alexander Motin [Mon, 15 May 2023 20:48:50 +0000 (16:48 -0400)]
nvmecontrol: Fix power subcommand output.

The returned value consists of two fields.  Report them separately.

MFC after: 2 weeks

14 months agodirdeps.mk allow for TARGET_SPEC_VARS.host
Simon J. Gerraty [Mon, 15 May 2023 20:25:10 +0000 (13:25 -0700)]
dirdeps.mk allow for TARGET_SPEC_VARS.host

While *most* projects need only DEP_MACHINE for host, there is always
an exception.  So we allow for TARGET_SPEC_VARS.host to be a subset of
TARGET_SPEC_VARS.  The default will *just work* for most projects.

We set DEP_TARGET_SPEC_VARS and hence DEP_TARGET_SPEC based on
DEP_MACHINE.  Allow for M_dep_qual_fixes.host to be different too and
take care to apply the right set.

14 months agoFix size differences between architectures of the UFS/FFS CGSIZE macro value.
Kirk McKusick [Mon, 15 May 2023 19:56:27 +0000 (12:56 -0700)]
Fix size differences between architectures of the UFS/FFS CGSIZE macro value.

The cylinder group header structure ended with `u_int8_t cg_space[1]'
representing the beginning of the inode bitmap array. Some architectures
like the i386 rounded this up to a 4-byte boundry while other
architectures like the amd64 rounded it up to an 8-byte boundry.
Thus sizeof(struct cg) was four bytes bigger on an amd64 machine
than on an i386 machine. If a filesystem created on an i386 machine
was moved to an amd64 machine, the size of the cylinder group
calculated by the CGSIZE macro would appear to grow by four bytes.
Filesystems whose cylinder groups were exactly equal to the block
size on an i386 machine would appear to have a cylinder group that
was four bytes too big when moved to an amd64 machine. Note that
although the structure appears to be too big, it in fact is fine.
It is just the calaculation of its size that is in error.

The fix is to remove the cg_space element from the cylinder-group
structure so that the calculated size of the structure is the same
size on all architectures.

Reported by:  Tijl Coosemans
Tested by:    Tijl Coosemans and Peter Holm
MFC after:    1 week
Sponsored by: The FreeBSD Foundation

14 months agoarm64: simplify expression
Kyle Evans [Mon, 15 May 2023 15:54:15 +0000 (10:54 -0500)]
arm64: simplify expression

!a != !b -> a != b; this part was lifted from NetBSD, and I clearly did
not reconsider that these are bools (I'm guessing they were ints in an
earlier iteration of the NetBSD implementation).

while we're here, it should be easy to see that we've covered all of the
cases but let's add in an __assert_unreachable() to make it easier on
the eyes.

Reported by: jrtc27

14 months agoarm64: add tests for swp/swpb emulation
Kyle Evans [Mon, 15 May 2023 15:42:16 +0000 (10:42 -0500)]
arm64: add tests for swp/swpb emulation

One test is suitable to be hooked up to the build, so I've done this
here.  The other test lives in tools/regression because failure is a
bit more subjective -- generally, one runs it for some unbounded amount
of time and observe if it eventually exits because two threads acquired
the same mutex.

Reviewed by: imp, mmel
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39668

14 months agoarm64: emulate swp/swpb instructions
Kyle Evans [Mon, 15 May 2023 15:42:10 +0000 (10:42 -0500)]
arm64: emulate swp/swpb instructions

Add another undefined instruction handler for compat32 and watch out for
SWP/SWPB instructions.

SWP/SWPB were deprecated in ARMv6 and declared obsolete in ARMv7, but
this implementation is motivated by some proprietary software that still
uses SWP/SWPB. Because it's deprecated, emulation is pushed back behind
a sysctl that defaults to OFF in GENERIC so that it doesn't potentially
adversely affect package builds; it's unknown whether software may test
for a functional swp/swpb instruction with the desire of using it later,
so we err on the side of caution to ensure we don't end up with swp/swpb
use in freebsd/arm packages (which are built on aarch64).

The EMUL_SWP config option may be used to enable emulation by default in
environments where emulation is desired and won't really be turned off.

Reviewed by: andrew, mmel (both earlier version)
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39667

14 months agoifconfig: split printing functions into smaller per-type chunks.
Alexander V. Chernikov [Mon, 15 May 2023 12:17:54 +0000 (12:17 +0000)]
ifconfig: split printing functions into smaller per-type chunks.

This change is a prerequisite for netlink conversion.
No functional changes intended.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40033
MFC after: 2 weeks

14 months agotesting: rename IfattrType to IfaAttrType for consistency
Alexander V. Chernikov [Mon, 15 May 2023 11:47:07 +0000 (11:47 +0000)]
testing: rename IfattrType to IfaAttrType for consistency

All other attribute classes are named as 'type'AttrType and 'type'
 int this case is ifa (interface address).

MFC after: 2 weeks

14 months agonetlink: add an optional post-process hook to the message parsers.
Alexander V. Chernikov [Mon, 15 May 2023 11:33:10 +0000 (11:33 +0000)]
netlink: add an optional post-process hook to the message parsers.

It is primarily used for adding scopeid to the IPv6 link-local
 sockaddrs. Having proper sockaddrs after parsing minimises the
 possibility of human mistake when using the parsing.

MFC after: 2 weeks

14 months agotesting: add public method for requiring module presense in pytest
Alexander V. Chernikov [Mon, 15 May 2023 10:50:55 +0000 (10:50 +0000)]
testing: add public method for requiring module presense in pytest

MFC after: 2 weeks

14 months agotesting: add support for handling Netlink carp messages
Alexander V. Chernikov [Mon, 15 May 2023 10:48:45 +0000 (10:48 +0000)]
testing: add support for handling Netlink carp messages

MFC after: 2 weeks

14 months agotesting: add support for using custom interfaces in pytest framework.
Alexander V. Chernikov [Mon, 15 May 2023 10:44:20 +0000 (10:44 +0000)]
testing: add support for using custom interfaces in pytest framework.

MFC after: 2 weeks

14 months agogeli: fix typo
Mariusz Zaborski [Mon, 15 May 2023 08:44:17 +0000 (10:44 +0200)]
geli: fix typo

PR: 271396
Reported by: Tim Chase <freebsd@tim.thechases.com>
MFC after: 1 week

14 months agoperiodic: Use locale-agnostic (ISO 8601) timestamp format
Michael Osipov [Thu, 4 May 2023 12:35:59 +0000 (14:35 +0200)]
periodic: Use locale-agnostic (ISO 8601) timestamp format

Instead of reyling on locale-sensitive output which can be mangled when e-mailed
use consistently ISO 8601 format which contains the same information as '-T'.

PR: 271240
MFC After: 3 days

14 months agodma: install a simple example for the auth.conf file
Peter Wright [Mon, 15 May 2023 07:18:40 +0000 (09:18 +0200)]
dma: install a simple example for the auth.conf file

PR: 270088
MFC After: 3 days

14 months agopci_vendors: update to 2023-05-15
Baptiste Daroussin [Mon, 15 May 2023 07:09:29 +0000 (09:09 +0200)]
pci_vendors: update to 2023-05-15

MFC After: 3 days

14 months agopw: do not call system()
Baptiste Daroussin [Mon, 15 May 2023 06:55:08 +0000 (08:55 +0200)]
pw: do not call system()

Calling system makes pw(8) spawn a shell, which can then be abused.

MFC After: 3 days

14 months agoremove stale portsinfo script
Wolfram Schneider [Mon, 15 May 2023 06:34:20 +0000 (06:34 +0000)]
remove stale portsinfo script

14 months agoremove stale handbook scripts
Wolfram Schneider [Mon, 15 May 2023 06:30:34 +0000 (06:30 +0000)]
remove stale handbook scripts

14 months agoremove stale message-id scripts
Wolfram Schneider [Mon, 15 May 2023 06:29:39 +0000 (06:29 +0000)]
remove stale message-id scripts

14 months agoremove stale script epfe.pl
Wolfram Schneider [Mon, 15 May 2023 06:22:41 +0000 (06:22 +0000)]
remove stale script epfe.pl

tools/tools/epfe/epfe.pl was a perl script that formerly generated some
printing example files from content in a very old version of the handbook.

Reported by: wblock

14 months agolinux(4): Rework signal trampoline on Aarch64
Dmitry Chagin [Sun, 14 May 2023 21:27:31 +0000 (00:27 +0300)]
linux(4): Rework signal trampoline on Aarch64

To avoid clobbering of any registers by the trampoline code use Linux
way to call signal handlers. I.e., we are out from the kernel right into
the signal handler, put return address from the signal handler into the
link register.
The mysterious NOP is required for some unwinders (e.g. libc++) that
unconditionally subtract one from the result of _Unwind_GetIP() in order
to identify the calling function.

MFC after: 1 week

14 months agolinux(4): Get rid of linux_vdso_sigcode
Dmitry Chagin [Sun, 14 May 2023 21:26:24 +0000 (00:26 +0300)]
linux(4): Get rid of linux_vdso_sigcode

MFC after: 1 week

14 months agolinux(4): Fix stack unwinding on arm64 [2/2]
Dmitry Chagin [Sun, 14 May 2023 21:25:57 +0000 (00:25 +0300)]
linux(4): Fix stack unwinding on arm64 [2/2]

To allow unwinders to go througth a previous to sigreturn frame we should
properly emulate the trampoline frame record which should points to the
previous frame and set the trampoline frame pointer to the emulated frame
before calling signal handler.

MFC after: 1 week

14 months agolinux(4): Fix stack unwinding on arm64 [1/2]
Dmitry Chagin [Sun, 14 May 2023 21:24:57 +0000 (00:24 +0300)]
linux(4): Fix stack unwinding on arm64 [1/2]

An Aarch64 sigreturn trampoline frame can't currently be described in
a DWARF .eh_frame section, because Aarch64 does not define a register
number for PC and provide no direct way to encode PC of the previous
frame. Instead, unwinders (libgcc, gdb, libunwind) detect the sigreturn
frame by looking for the sigreturn instruction. If a sigreturn frame is
detected, unwinders restores all the gprs, SP and PC by assuming that
sp points to an rt_sigframe Linux kernel struct
When entering the kernel, the link register (lr) contains the return
address of the previous frame, the exception link register (elr) contains
the address of the next instruction after the one which generated the
exception, i.e., PC.

MFC after: 1 week

14 months agoktrace: Fix syscall number on a child return path from fork
Dmitry Chagin [Sun, 14 May 2023 21:23:50 +0000 (00:23 +0300)]
ktrace: Fix syscall number on a child return path from fork

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D40078
MFC after 1 week

14 months agosys.dirdeps.mk we do want to override OBJTOP
Simon J. Gerraty [Sun, 14 May 2023 16:50:03 +0000 (09:50 -0700)]
sys.dirdeps.mk we do want to override OBJTOP

Add more comments to explain what and why.
Ensure OBJROOT ends in / or - (/ preferred).
Export OBJTOP if level > 0
this avoids the issue with bmake/unit-tests.

Check if we have to override MAKEOBJDIR
and if so, put it into env correctly.

14 months agosrc.conf.5: regen
Ed Maste [Sun, 14 May 2023 14:17:59 +0000 (10:17 -0400)]
src.conf.5: regen

Fixes: df9974197e46 ("Add description of WITH_META_ERROR_TARGET")
Fixes: 2b519b170709 ("Update description of WITH_DIRDEPS_BUILD")
Fixes: 722cfce5f494 ("Fix typo and use .Fx in WITH_DIRDEPS_BUILD")
Sponsored by: The FreeBSD Foundation

14 months agoUpdate UPDATING
Graham Perrin [Sun, 14 May 2023 13:05:05 +0000 (07:05 -0600)]
Update UPDATING

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/712

14 months agoCONTRIBUTING.md: minor changes
Graham Perrin [Sun, 14 May 2023 12:49:00 +0000 (06:49 -0600)]
CONTRIBUTING.md: minor changes

Fix a singular/plural mistake, spelling error, a markup error, and a
handful of other minor changes.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/742

14 months agolocal.dirdeps.mk no qual for PSEUDO_MACHINE_LIST
Simon J. Gerraty [Sat, 13 May 2023 21:06:20 +0000 (14:06 -0700)]
local.dirdeps.mk no qual for PSEUDO_MACHINE_LIST

dirdeps.mk takes care of "host"
but we still need to deal with other PSEUDO_MACHINE_LIST members

14 months agoUpdate dirdeps.mk
Simon J. Gerraty [Sat, 13 May 2023 21:05:19 +0000 (14:05 -0700)]
Update dirdeps.mk

Ensure host build_dirs are not qualified.

14 months agosh: improve style
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 20:42:15 +0000 (22:42 +0200)]
sh: improve style

14 months agoGENERIC: remove a stray space character
Piotr Pawel Stefaniak [Sat, 13 May 2023 19:30:28 +0000 (21:30 +0200)]
GENERIC: remove a stray space character

14 months agosys.dirdeps.mk use ?= for OBJTOP
Simon J. Gerraty [Sat, 13 May 2023 17:46:24 +0000 (10:46 -0700)]
sys.dirdeps.mk use ?= for OBJTOP

This broke bmake's after-import step.

14 months agobmake forloop test was removed
Simon J. Gerraty [Sat, 13 May 2023 17:12:08 +0000 (10:12 -0700)]
bmake forloop test was removed

14 months agoMerge bmake-20230510
Simon J. Gerraty [Sat, 13 May 2023 17:05:48 +0000 (10:05 -0700)]
Merge bmake-20230510

Merge commit '945078deae448e0a13c34b3393d836087719fb16'

14 months agoImport bmake-20230510
Simon J. Gerraty [Sat, 13 May 2023 17:03:50 +0000 (10:03 -0700)]
Import bmake-20230510

Relevant/interesting changes:

o parse.c: don't print null filename in stack traces
o for.c: skip syntactically wrong .for loops
o var.c: allow for :gmtime=${mtime}
add :mtime[=timestamp] where timestamp is used if stat(2)
fails, if :mtime=error stat(2) failure causes error.
o make.1: fix documentation of .PREFIX to match reality and POSIX
o unit-tests: improved var-scope-local

14 months agoMove MACHINE/MACHINE_ARCH handling to sys.machine.mk
Simon J. Gerraty [Sat, 13 May 2023 15:15:49 +0000 (08:15 -0700)]
Move MACHINE/MACHINE_ARCH handling to sys.machine.mk

Rather than define the TARGETS and TARGET_ARCHES in src/Makefile
put them in sys.machine.mk so they can also be leveraged by
non-top-level builds.

We have TARGET_MACHINE_LIST as the list of MACHINES we build for.

For each MACHINE we have a MACHINE_ARCH_LIST_${MACHINE}
and the first entry of each list is used as default for
MACHINE_ARCH_${MACHINE}

We can now remove a bunch of MACHINE_ARCH.* handling from
local.sys.dirdeps*mk

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D40083

14 months agolibefi: add efi_devpath_next_instance()
Toomas Soome [Fri, 12 May 2023 15:41:14 +0000 (18:41 +0300)]
libefi: add efi_devpath_next_instance()

UEFI device path may be path to one device, or concatenated list of instances
to different devices (textually represented as comma separated list).

Provide generic function to get next instance from device path.
Returns next instance or end node.

The use case is like:

EFI_DEVICE_PATH *node = (EFI_DEVICE_PATH *)buf;
while (!IsDevicePathEnd(node)) {
process(node);
node = efi_devpath_next_instance(node);
}

Where buf is pointing to either single device path or
concatenated list of device paths (such as from ConIn or ConOut).

Reviewers: imp
Differential Revision: https://reviews.freebsd.org/D40081

14 months agorc.subr(8): delete debug cpuset helper
Enji Cooper [Thu, 11 May 2023 05:47:09 +0000 (22:47 -0700)]
rc.subr(8): delete debug cpuset helper

Summary:
The intention of the original author (I assume) was to add this logic
for testing. This removes the debug statement so it no longer shows up
in calls to `status`.

MFC after: 2 weeks
MFC with: 0661f9389

Reviewers: kevans

Subscribers: imp

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

14 months agoMove more DIRDEPS_BUILD settings
Simon J. Gerraty [Sat, 13 May 2023 00:40:37 +0000 (17:40 -0700)]
Move more DIRDEPS_BUILD settings

local.meta.sys.env.mk should now concern itself only with
META_MODE.

Move any DIRDEPS_BUILD settings to local.sys.dirdeps.env.mk

14 months agoMFV: xz 5.4.3.
Xin LI [Fri, 12 May 2023 22:49:34 +0000 (15:49 -0700)]
MFV: xz 5.4.3.

Relnotes: yes
MFC-after: 2 weeks

14 months agoloader: restore userboot help file
Ed Maste [Tue, 9 May 2023 13:19:42 +0000 (09:19 -0400)]
loader: restore userboot help file

Commit e32fecd0c2c3 intended to skip installing all but one copy of
each loader variant's help file, but accidentally skipped all copies for
the userboot help file.  (Other loaders install help files via the _simp
variant, but there is is no userboot_simp.)

PR: 271178
Fixes: e32fecd0c2c3 ("loader: install help files only once")
Sponsored by: The FreeBSD Foundation

14 months agoFix typo and use .Fx in WITH_DIRDEPS_BUILD
Simon J. Gerraty [Fri, 12 May 2023 16:49:03 +0000 (09:49 -0700)]
Fix typo and use .Fx in WITH_DIRDEPS_BUILD

14 months agospdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD

There never was a BSD-3-Clause-FreeBSD SPDX identifier. Replace it
with BSD-3-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

14 months agoSPDX: It's spelled 'SPDX-License-Identifier'
Warner Losh [Thu, 11 May 2023 16:03:59 +0000 (10:03 -0600)]
SPDX: It's spelled 'SPDX-License-Identifier'

Sponsored by: Netflix

14 months agospdx: Simplify BSD-2-Clause AND BSD-2-Clause
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: Simplify BSD-2-Clause AND BSD-2-Clause

After removing the -FreeBSD and -NetBSD, we're left with a nuber of
BSD-2-Clause AND BSD-2-Clause, so tidy that up.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

14 months agospdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD

The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

14 months agospdx: Remove duplicate lines
Warner Losh [Wed, 10 May 2023 22:42:54 +0000 (16:42 -0600)]
spdx: Remove duplicate lines

Remove duplicated SPDX lines.

Sponsored by: Netflix

14 months agospdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix