]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
20 months agomktemp: don't double up on trailing slashes for -t paths
Kyle Evans [Wed, 2 Nov 2022 20:29:16 +0000 (15:29 -0500)]
mktemp: don't double up on trailing slashes for -t paths

This is a minor cosmetic change; re-organize slightly to set tmpdir to
_PATH_TMP if we didn't otherwise have a tmpdir candidate, then check the
trailing char before appending another slash.

While we're here, remove some bogus whitespace and add a test case for
this change.

Obtained from: https://github.com/apple-oss-distributions/shell_cmds
Sponsored by: Klara, Inc.

20 months agoMake SYNOPSIS match DESCRIPTION.
Pau Amma [Sun, 5 Jun 2022 18:05:25 +0000 (18:05 +0000)]
Make SYNOPSIS match DESCRIPTION.

While there, fix nits reported by igor and mandoc -T lint.

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

Reviewed by: debdrup, gbe, gjb

Approved by: gjb (mentor)

MFC after: 3 days

20 months agoarm64: Handle translation faults for thread structures
Mark Johnston [Wed, 2 Nov 2022 17:27:27 +0000 (13:27 -0400)]
arm64: Handle translation faults for thread structures

The break-before-make requirement poses a problem when promoting or
demoting mappings containing thread structures: a CPU may raise a
translation fault while accessing curthread, and data_abort() accesses
the thread again before pmap_fault() can translate the address and
return.

Normally this isn't a problem because we have a hack to ensure that
slabs used by the thread zone are always accessed via the direct map,
where promotions and demotions are rare.  However, this hack doesn't
work properly with UMA_MD_SMALL_ALLOC disabled, as is the case with
KASAN configured (since our KASAN implementation does not shadow the
direct map and so tries to force the use of the kernel map wherever
possible).

Fix the problem by modifying data_abort() to handle translation faults
in the kernel map without dereferencing "td", i.e., curthread, and
without enabling interrupts.  pmap_klookup() has special handling for
translation faults which makes it safe to call in this context.  Then,
revert the aforementioned hack.

Reviewed by: kevans, alc, kib, andrew
MFC after: 1 month
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37231

20 months agoddb: Don't flag breakpoint/watchpoint commands as MEMSAFE
Mark Johnston [Wed, 2 Nov 2022 17:20:11 +0000 (13:20 -0400)]
ddb: Don't flag breakpoint/watchpoint commands as MEMSAFE

They could potentially be abused to overwrite kernel memory, so
shouldn't be accessible when mac_ddb is loaded.

Reviewed by: mhorne
Fixes: bc4ea61d55cb ("ddb: tag core commands with DB_CMD_MEMSAFE")
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37105

20 months agoinpcb: Allow SO_REUSEPORT_LB to be used in jails
Mark Johnston [Wed, 2 Nov 2022 17:08:07 +0000 (13:08 -0400)]
inpcb: Allow SO_REUSEPORT_LB to be used in jails

Currently SO_REUSEPORT_LB silently does nothing when set by a jailed
process.  It is trivial to support this option in VNET jails, but it's
also useful in traditional jails.

This patch enables LB groups in jails with the following semantics:
- all PCBs in a group must belong to the same jail,
- PCB lookup prefers jailed groups to non-jailed groups

This is a straightforward extension of the semantics used for individual
listening sockets.  One pre-existing quirk of the lbgroup implementation
is that non-jailed lbgroups are searched before jailed listening
sockets; that is preserved with this change.

Discussed with: glebius
MFC after: 1 month
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37029

20 months agoin6: Consolidate IN6_ARE_ADDR_EQUAL definitions
Mark Johnston [Wed, 2 Nov 2022 17:06:54 +0000 (13:06 -0400)]
in6: Consolidate IN6_ARE_ADDR_EQUAL definitions

It is ok to use memcmp() in the kernel.  No functional change intended.

Reviewed by: glebius, melifaro
MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37028

20 months agoinpcb: Remove a PCB from its LB group upon a subsequent error
Mark Johnston [Wed, 2 Nov 2022 17:05:14 +0000 (13:05 -0400)]
inpcb: Remove a PCB from its LB group upon a subsequent error

If a memory allocation failure causes bind to fail, we should take the
inpcb back out of its LB group since it's not prepared to handle
connections.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37027

20 months agoinpcb: Remove NULL checks of credential references
Mark Johnston [Wed, 2 Nov 2022 17:03:41 +0000 (13:03 -0400)]
inpcb: Remove NULL checks of credential references

Some auditing of the code shows that "cred" is never non-NULL in these
functions, either because all callers pass a non-NULL reference or
because they unconditionally dereference "cred".  So, let's simplify the
code a bit and remove NULL checks.  No functional change intended.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37025

20 months agogetsockopt.2: Clarify the SO_REUSEPORT_LB text a bit
Mark Johnston [Wed, 2 Nov 2022 17:01:59 +0000 (13:01 -0400)]
getsockopt.2: Clarify the SO_REUSEPORT_LB text a bit

Refer to sockets rather than processes, since one can have multiple
sockets in a load-balancing group within the same process.

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

20 months agolibsysdecode: Match socket option names containing underscores
Mark Johnston [Wed, 2 Nov 2022 17:01:22 +0000 (13:01 -0400)]
libsysdecode: Match socket option names containing underscores

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

20 months agoktrace.2: Document KTRFAC_STRUCT_ARRAY.
John Baldwin [Wed, 2 Nov 2022 17:35:26 +0000 (10:35 -0700)]
ktrace.2: Document KTRFAC_STRUCT_ARRAY.

Sponsored by: DARPA

20 months agokerberos5: retire now-unused MIPS support
Ed Maste [Tue, 18 Oct 2022 14:27:49 +0000 (10:27 -0400)]
kerberos5: retire now-unused MIPS support

20 months ago[skip ci] Remove obsolete references in crypto_request(9)
Alan Somers [Wed, 2 Nov 2022 16:41:48 +0000 (10:41 -0600)]
[skip ci] Remove obsolete references in crypto_request(9)

They were missed by 68f6800ce05c3.

Sponsored by: Axcient
MFC with: 68f6800ce05c3
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37239

20 months agofetch: support EAI_ADDRFAMILY error, correct two error messages
Mike Karels [Wed, 2 Nov 2022 15:59:09 +0000 (10:59 -0500)]
fetch: support EAI_ADDRFAMILY error, correct two error messages

With the change to return EAI_ADDRFAMILY from getaddrinfo(), fetch
would print "Unknown resolver error" for that error.  Add that error
and its string to libfetch's table, using an #ifdef just in case.
Correct error strings for EAI_NODATA (although it is currently unused)
and EAI_NONAME.  Should maybe rework the code to use gai_strerror(3),
but that doesn't map directly, and the current strings are shortened.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz
MFC after:      1 month

20 months agogetaddrinfo: distinguish missing addrs from unresolvable names
Mike Karels [Wed, 2 Nov 2022 15:57:59 +0000 (10:57 -0500)]
getaddrinfo: distinguish missing addrs from unresolvable names

Rework getaddrinfo(3) to return different error values for unresolvable
names (same as before, EAI_NONAME) and those without a requested addr
(EAI_ADDRFAMILY) when using DNS.  This is implemented via an added
error in the nsswitch layer, NS_ADDRFAMILY, which is used only by
getaddrinfo().  The error is passed through nsdispatch(3), but that
routine has no changes to handle this error.  The error originates in
the getaddrinfo DNS layer called via nsdispatch(), and is processed
by the search layer that calls nsdispatch().

While here, add a little style to returns near those that were
modified.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz
MFC after:      1 month

20 months agogai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA
Mike Karels [Wed, 2 Nov 2022 15:55:32 +0000 (10:55 -0500)]
gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA

gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA,
but not the man page.  Re-add to the man page, and update comments
in the source.  Document the errors that are not in RFC 3493 or
POSIX.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz, pauamma
MFC after:      1 month

20 months agonetdb.h: re-enable EAI_ADDRFAMILY, EAI_NODATA
Mike Karels [Wed, 2 Nov 2022 15:43:04 +0000 (10:43 -0500)]
netdb.h: re-enable EAI_ADDRFAMILY, EAI_NODATA

EAI_ADDRFAMILY and EAI_NODATA are not in RFC 3493, but are available
and used in many other systems.  It is desirable to have at least one
of them in order to distinguish between names that do not resolve and
those that do not have the requested address type.  A change to
getaddrinfo() will use EAI_ADDRFAMILY.  Both were "#if 0"; re-enable,
conditioned on __BSD_VISIBLE, and update comments.  Also add comments
and __BSD_VISIBLE conditional for the last three EAI errors, which
are not in the RFC or POSIX.  Note, all of these are available in
NetBSD and OpenBSD, and EAI_ADDRFAMILY and EAI_NODATA are available
in Linux (glibc).

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by: bz
MFC after: 1 month

20 months agoAdd corvink to the src committers and manu as my mentor
Corvin Köhne [Wed, 2 Nov 2022 15:56:38 +0000 (16:56 +0100)]
Add corvink to the src committers and manu as my mentor

Approved by: manu (mentor)
Differential Revision: https://reviews.freebsd.org/D37237

20 months agolinux64: improve linux_support.s make rules
Ed Maste [Tue, 19 Jul 2022 20:42:27 +0000 (16:42 -0400)]
linux64: improve linux_support.s make rules

Previously we relied on the .s.o rule in share/mk/bsd.suffixes.mk to
tell make that linux_support.o is built from linux_support.s, even
though we do not use the .s.o rule to assemble it.

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

20 months agostand: Nuke double-semicolons
Elliott Mitchell [Mon, 16 Aug 2021 22:51:38 +0000 (15:51 -0700)]
stand: Nuke double-semicolons

A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31717

20 months agosys: Nuke double-semicolons
Elliott Mitchell [Mon, 16 Aug 2021 22:51:38 +0000 (15:51 -0700)]
sys: Nuke double-semicolons

A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, rrs
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31716

20 months agovmw_pvscsi: Expand vcpuHint to 16 bit to aliagn with host side change.
Wentao Wang [Wed, 2 Nov 2022 15:14:52 +0000 (09:14 -0600)]
vmw_pvscsi: Expand vcpuHint to 16 bit to aliagn with host side change.

vcpuHint has been expanded to 16 bit on host side to enable
interruptions to be routed to more CPUs. Guest side should align with
the change.

This change has been tested with hosts with 8-bit and 16-bit vcpuHint,
on both platforms host side can get correct value.

This driver is for ESXi product which only supports x86/x64. They are
little-endian. So there is no need to consider big-endian system.

PR: 264840
Reviewed by: imp@, Zhenlei Huang

20 months agopf tests: bridge-to test case
Kristof Provost [Fri, 28 Oct 2022 09:56:43 +0000 (11:56 +0200)]
pf tests: bridge-to test case

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37194

20 months agopf: bridge-to
Kristof Provost [Thu, 22 Sep 2022 17:00:11 +0000 (19:00 +0200)]
pf: bridge-to

Allow pf (l2) to be used to redirect ethernet packets to a different
interface.

The intended use case is to send 802.1x challenges out to a side
interface, to enable AT&T links to function with pfSense as a gateway,
rather than the AT&T provided hardware.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37193

20 months agosys: use .S for assembly language files that use the preprocessor
Elliott Mitchell [Sun, 24 Jul 2022 23:14:20 +0000 (16:14 -0700)]
sys: use .S for assembly language files that use the preprocessor

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D35908

20 months agoipsec tests: add test case for chacha20_poly1305
Kristof Provost [Tue, 18 Oct 2022 16:34:00 +0000 (18:34 +0200)]
ipsec tests: add test case for chacha20_poly1305

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37181

20 months agoipsec: add support for CHACHA20POLY1305
Kristof Provost [Tue, 18 Oct 2022 16:31:02 +0000 (18:31 +0200)]
ipsec: add support for CHACHA20POLY1305

Based on a patch by ae@.

Reviewed by: gbe (man page), pauamma (man page)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37180

20 months agobridge tests: re-enable span test
Kristof Provost [Wed, 2 Nov 2022 10:58:04 +0000 (11:58 +0100)]
bridge tests: re-enable span test

The root cause of the intermittent span test failures has been
identified as a race between sending the packet and starting the bpf
capture.
This is now resolved, so the test can be re-enabled.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agotests: make sniffer more robust
Kristof Provost [Wed, 2 Nov 2022 10:55:39 +0000 (11:55 +0100)]
tests: make sniffer more robust

The Sniffer class is often used by test tools such as pft_ping to verify
that packets actually get sent where they're expected.

It starts a background thread to capture packets, but this thread needs
some time to start, leading to intermittent test failures when the
capture doesn't start before the relevant packet is sent.

Add a semaphore to ensure the Sniffer constructor doesn't return until
the capture is actually running.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agoAdd myself (zlei) as a src committer and kp / melifaro as my mentors
Zhenlei Huang [Wed, 2 Nov 2022 03:53:24 +0000 (11:53 +0800)]
Add myself (zlei) as a src committer and kp / melifaro as my mentors

Follow step 7.1.5 in the Committer's Guide.

Reviewed by: kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37233

20 months agoOpenSSL: Regen manual pages for OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 23:38:40 +0000 (19:38 -0400)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1s

20 months agoOpenSSL: Regen assembly file for OpenSSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 23:12:09 +0000 (19:12 -0400)]
OpenSSL: Regen assembly file for OpenSSSL 1.1.1s

20 months agoOpenSSL: Merge OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 22:58:59 +0000 (18:58 -0400)]
OpenSSL: Merge OpenSSL 1.1.1s

Merge commit 'b6b67f23b82101d4c04c89f81d726b902ab77106'

20 months agotools/build/make.py: fix cross build on Fedora Linux
Alfredo Dal'Ava Junior [Tue, 1 Nov 2022 23:59:58 +0000 (20:59 -0300)]
tools/build/make.py: fix cross build on Fedora Linux

Fedora defines shell functions for some commands used by FreeBSD build
scripts. Unortunatelly it makes them behave incorrectly for our purposes.

For instance 'which which' returns something like:

which ()
{
    ( alias;
    eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias ...
}

instead of

/usr/bin/which

This patch unsets those functions to restore original/expected behavior

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

20 months agoImport OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 22:43:36 +0000 (18:43 -0400)]
Import OpenSSL 1.1.1s

20 months agovmm: do not leak halted_cpus bit after suspension
Konstantin Belousov [Mon, 31 Oct 2022 23:30:55 +0000 (01:30 +0200)]
vmm: do not leak halted_cpus bit after suspension

Reported by: bz
PR: 267468
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37227

20 months agogrep: correct argument name in man page
Elvin Aslanov [Tue, 1 Nov 2022 14:07:56 +0000 (18:07 +0400)]
grep: correct argument name in man page

MFC after: 1 week
Fixes: 4dc88ebedf94 ("Add BSD grep to the base system...")
Pull Request: https://github.com/freebsd/freebsd-src/pull/622

20 months agong_hci: handle NG_HCI_M_PULLUP failure in le_advertizing_report
Ed Maste [Tue, 1 Nov 2022 13:55:22 +0000 (09:55 -0400)]
ng_hci: handle NG_HCI_M_PULLUP failure in le_advertizing_report

PR: 267396
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: takawata
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37228

20 months agoipmi: use a queue for kcs driver requests when possible
Chuck Silvers [Tue, 1 Nov 2022 17:55:14 +0000 (10:55 -0700)]
ipmi: use a queue for kcs driver requests when possible

The ipmi watchdog pretimeout action can trigger unintentionally in
certain rare, complicated situations.  What we have seen at Netflix
is that the BMC can sometimes be sent a continuous stream of
writes to port 0x80, and due to what is a bug or misconfiguration
in the BMC software, this results in the BMC running out of memory,
becoming very slow to respond to KCS requests, and eventually being
rebooted by its own internal watchdog.  While that is going on in
the BMC, back in the host OS, a number of requests are pending in
the ipmi request queue, and the kcs_loop thread is working on
processing these requests.  All of the KCS accesses to process
those requests are timing out and eventually failing because the
BMC is responding very slowly or not at all, and the kcs_loop thread
is holding the IPMI_IO_LOCK the whole time that is going on.
Meanwhile the watchdogd process in the host is trying to pat the
BMC watchdog, and this process is sleeping waiting to get the
IPMI_IO_LOCK.  It's not entirely clear why the watchdogd process
is sleeping for this lock, because the intention is that a thread
holding the IPMI_IO_LOCK should not sleep and thus any thread
that wants the lock should just spin to wait for it.  My best guess
is that the kcs_loop thread is spinning waiting for the BMC to
respond for so long that it is eventually preempted, and during
the brief interval when the kcs_loop thread is not running,
the watchdogd thread notices that the lock holder is not running
and sleeps.  When the kcs_loop thread eventually finishes processing
one request, it drops the IPMI_IO_LOCK and then immediately takes the
lock again so it can process the next request in the queue.
Because the watchdogd thread is sleeping at this point, the kcs_loop
always wins the race to acquire the IPMI_IO_LOCK, thus starving
the watchdogd thread.  The callout for the watchdog pretimeout
would be reset by the watchdogd thread after its request to the BMC
watchdog completes, but since that request never processed, the
pretimeout callout eventually fires, even though there is nothing
actually wrong with the host.

To prevent this saga from unfolding:

 - when kcs_driver_request() is called in a context where it can sleep,
   queue the request and let the worker thread process it rather than
   trying to process in the original thread.
 - add a new high-priority queue for driver requests, so that the
   watchdog patting requests will be processed as quickly as possible
   even if lots of application requests have already been queued.

With these two changes, the watchdog pretimeout action does not trigger
even if the BMC is completely out to lunch for long periods of time
(as long as the watchdogd check command does not also get stuck).

Sponsored by: Netflix
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36555

20 months agopf tests: make killstate tests more robust
Kristof Provost [Tue, 1 Nov 2022 17:03:50 +0000 (18:03 +0100)]
pf tests: make killstate tests more robust

Rather than using a Scapy-based Python script only check if the state
still exists. Scapy tends to be slow to start, it appears because it
lists all interfaces and gets their (IPv6) addresses a couple of times
at startup. This can be sufficient for the ICMP state to time out and
the test to fail.

We now only check if the state exists or is removed as expected, which
makes things faster, and should mean the test is more robust on slower
machines (such as CI VMs).

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

20 months agoFix a panic on boot introduced by 555a861d6826
Andrew Gallatin [Tue, 1 Nov 2022 17:44:39 +0000 (13:44 -0400)]
Fix a panic on boot introduced by 555a861d6826

First, an sbuf_new() in device_get_path() shadows the sb
passed in by dev_wired_cache_add(), leaving its sb in an
unfinished state, leading to a failed KASSERT().  Fixing this
is as simple as removing the sbuf_new() from device_get_path()

Second, we cannot simply take a pointer to the sbuf memory and
store it in the device location cache, because that sbuf
is freed immediately after we add data to the cache, leading
to a use-after-free and eventually a double-free.  Fixing this
requires allocating memory for the path.

After a discussion with jhb, we decided that one malloc was
better than two in dev_wired_cache_add, which is why it changed
so much.

Reviewed by: jhb
Sponsored by: Netflix
MFC after: 14 days

20 months agonetlink: add netlink user documentation.
Alexander V. Chernikov [Tue, 1 Nov 2022 12:20:13 +0000 (12:20 +0000)]
netlink: add netlink user documentation.

Add netlink(4) as a "frontend" manpage describing netlink in general.
Add rtnelink(4) describing supported commands and attributes in
NETLINK_ROUTE family.
Add genetlink(4) describing generic netlink API.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D37011

20 months agoREADME.md: link to the list of supported platforms
Mitchell Horne [Tue, 1 Nov 2022 15:20:01 +0000 (12:20 -0300)]
README.md: link to the list of supported platforms

It answers a question that someone might have when faced with the source
tree for the first time, and improves discoverability of the platforms
page.

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

20 months agodevelopment(7): redirect users from hier(7)
Mitchell Horne [Tue, 1 Nov 2022 15:18:53 +0000 (12:18 -0300)]
development(7): redirect users from hier(7)

The layout of the source tree is now only described in README.md. Retain
the cross-reference to hier(7) in SEE ALSO; it is still useful to
readers.

Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37136

20 months agohier(7): remove text describing /usr/src layout
Mitchell Horne [Tue, 1 Nov 2022 15:15:18 +0000 (12:15 -0300)]
hier(7): remove text describing /usr/src layout

It poses a maintenance burden, since much of the information is
duplicated in the src tree's README.md file. Readers who are interested
enough in learning about the structure of the src tree can download it,
or browse the README online. Have hier(7) just point them there instead.

PR: 261349
Discussed with: freebsd-arch@, freebsd-doc@ lists
Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37135

20 months agoREADME.md: shift description of kernel config files
Mitchell Horne [Tue, 1 Nov 2022 15:14:41 +0000 (12:14 -0300)]
README.md: shift description of kernel config files

Document it in sys/README.md instead. Describe the purpose of LINT
config files as well.

Reviewed by: imp
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37134

20 months agosys/README.md: source roadmap improvements
Mitchell Horne [Tue, 1 Nov 2022 15:13:31 +0000 (12:13 -0300)]
sys/README.md: source roadmap improvements

Tweak the existing descriptions slightly. Add entries for several
directories which are not yet documented, but not exhaustively.

Reviewed by: imp (previous version), emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37133

20 months agoCreate sys/README.md
Mitchell Horne [Tue, 1 Nov 2022 15:12:14 +0000 (12:12 -0300)]
Create sys/README.md

Add this primarily to document the sys/ subdirectories of the source tree.

This is a straight copy from the contents of hier(7). Improvements will
follow in other changes.

Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37132

20 months agoarm64: Hyper-V: fixing hung issue during Hyper-V initialization
Souradeep Chakrabarti [Tue, 1 Nov 2022 14:06:01 +0000 (14:06 +0000)]
arm64: Hyper-V: fixing hung issue during Hyper-V initialization

In non-Hyper-V systems during Hyper-V initialization, system
initialization was getting hung, as hyperv_identify(),
was returning successful irrespective of the type of the platform.

Reviewed by: andrew, whu
Fixes: 9729f076e4d
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D37219

20 months agolibc_nonshared: Move to clibs package
Doug Rabson [Tue, 1 Nov 2022 10:14:29 +0000 (10:14 +0000)]
libc_nonshared: Move to clibs package

Its needed by libc.a which lives in clibs.

PR: 254173

20 months agobsd.sanitizer.mk: Fix a typo in a comment
Gordon Bergling [Tue, 1 Nov 2022 08:18:34 +0000 (09:18 +0100)]
bsd.sanitizer.mk: Fix a typo in a comment

- s/santizers/sanitizers/

MFC after: 3 days

20 months agoisci(4): Fix common typos in source code comments
Gordon Bergling [Tue, 1 Nov 2022 07:34:11 +0000 (08:34 +0100)]
isci(4): Fix common typos in source code comments

- s/assinged/assigned/

MFC after: 3 days

20 months agoxilinx: Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 07:00:53 +0000 (08:00 +0100)]
xilinx: Fix a typo in a source code comment

- s/interrut/interrupt/

MFC after: 3 days

20 months agoisci(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:58:26 +0000 (07:58 +0100)]
isci(4): Fix a typo in a source code comment

- s/interrutp/interrupt/

MFC after:3 days

20 months agobxe(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:55:55 +0000 (07:55 +0100)]
bxe(4): Fix a typo in a source code comment

- s/interrutps/interrupts/

MFC after: 3 days

20 months agodtrace: Fix the i386 FBT build
Mark Johnston [Tue, 1 Nov 2022 04:14:30 +0000 (00:14 -0400)]
dtrace: Fix the i386 FBT build

Reported by: Jenkins
Fixes: 0e69c959150c ("dtrace: Fix up %rip for invop probes on x86")

20 months agoLinuxKPI: 802.11: pass internal variable to lkpi_80211_mo_sta_state()
Bjoern A. Zeeb [Mon, 31 Oct 2022 23:53:26 +0000 (23:53 +0000)]
LinuxKPI: 802.11: pass internal variable to lkpi_80211_mo_sta_state()

With mac80211 operations (MO) tracing on we have seen some ill-ordered
executions of MO functions.  In order to limit visibility of the mac80211
sta, pass the internal version into lkpi_80211_mo_sta_state() and only
there convert to the argument needed.  This mostly eases tracing and
debugging.

Sposnored by: The FreeBSD Foundation
MFC after: 3 days

20 months agodtrace: Fix up %rip for invop probes on x86
Mark Johnston [Mon, 31 Oct 2022 23:11:36 +0000 (19:11 -0400)]
dtrace: Fix up %rip for invop probes on x86

When a breakpoint exception is raised, the saved value of %rip points to
the instruction following the breakpoint.  However, when fetching the
value of %rip using regs[], it's more natural to provide the address of
the breakpoint itself, so modify the kinst and fbt providers accordingly.

Reported by: khng
Reviewed by: christos, khng
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D37218

20 months agoLinuxKPI: 802.11: update struct member types
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:24:08 +0000 (22:24 +0000)]
LinuxKPI: 802.11: update struct member types

Update struct member types for ongoing work towards HT support.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

20 months agoLinuxKPI: 802.11 update header files
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:09:25 +0000 (22:09 +0000)]
LinuxKPI: 802.11 update header files

Adjust struct members, add more (for HE dummy) defines, add more
(wrapper) functions in order to acoomodate another driver.

MFC after: 3 days

20 months agomount_unionfs: remove jokey cautions from man page
Ed Maste [Mon, 31 Oct 2022 20:38:46 +0000 (16:38 -0400)]
mount_unionfs: remove jokey cautions from man page

There are known issues with unionfs, and the mount_unionfs man page has
a cautionary statement about its use.  The caution had additional
"humourous" statements like "BEWARE OF DOG" but they served only to
confuse the situation.  Remove them.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

20 months agopf tests: verify syncookie status report
Kristof Provost [Mon, 31 Oct 2022 11:15:58 +0000 (12:15 +0100)]
pf tests: verify syncookie status report

Verify that pfctl -si -v correctly shows syncookies to be
active/inactive.

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

20 months agopf: expose syncookie active/inactive status
Kristof Provost [Sat, 24 Sep 2022 12:47:17 +0000 (14:47 +0200)]
pf: expose syncookie active/inactive status

When syncookies are in adaptive mode they may be active or inactive.
Expose this status to users.

Suggested by: Guido van Rooij
Sponsored by: Rubicon Communications, LLC ("Netgate")

20 months agonetlink: fix CTRL_CMD_GETFAMILY lookup/dumps.
Alexander V. Chernikov [Mon, 31 Oct 2022 17:11:53 +0000 (17:11 +0000)]
netlink: fix CTRL_CMD_GETFAMILY lookup/dumps.

Reported by: bapt

20 months agotcp.4: undocument compressed TIME_WAIT
Gleb Smirnoff [Mon, 31 Oct 2022 16:02:33 +0000 (09:02 -0700)]
tcp.4: undocument compressed TIME_WAIT

20 months agotcp: make tcp_handle_wakeup() static and robust
Gleb Smirnoff [Mon, 31 Oct 2022 15:57:15 +0000 (08:57 -0700)]
tcp: make tcp_handle_wakeup() static and robust

It is called only from tcp_input() and always has valid parameter.

Reviewed by: rscheff, tuexen
Differential revision: https://reviews.freebsd.org/D37115

20 months agoinpcb: retire suppresion of randomization of ephemeral ports
Gleb Smirnoff [Mon, 31 Oct 2022 15:57:11 +0000 (08:57 -0700)]
inpcb: retire suppresion of randomization of ephemeral ports

The suppresion was added in 5f311da2ccb with no explanation in the
commit message of the exact problem that was fixed. In the BSDCan
2006 talk [1], slides 12 to 14, we can find that it seems that there
was some problem with the TIME_WAIT state not properly being handled
on the remote side (also FreeBSD!), and this switching off the
suppression had hidden the problem.  The rationale of the change was
that other stacks may also be buggy wrt the TIME_WAIT.

I did not find the actual problem in TIME_WAIT that the suppression
has hidden, neither a commit that would fix it.  However, since that
time we started to handle SYNs with RFC5961 instead of RFC793, see
3220a2121cc.  We also now have the tcp-testsuite [2], that has full
coverage of all possible scenarios of receiving SYN in TIME_WAIT.

This effectively reverts 5f311da2ccb6c216b79049172be840af4778129a
and 6ee79c59d2c081f837a11cc78908be54a6dbe09d.

[1] https://www.bsdcan.org/2006/papers/ImprovingTCPIP.pdf
[2] https://github.com/freebsd-net/tcp-testsuite

Reviewed by: rscheff
Discussed with: rscheff, rrs, tuexen
Differential revision: https://reviews.freebsd.org/D37042

20 months agoicmp: doesn't need tcp_var.h
Gleb Smirnoff [Mon, 31 Oct 2022 15:44:55 +0000 (08:44 -0700)]
icmp: doesn't need tcp_var.h

20 months agorack/bbr: put back assertion that connection is not in TIME-WAIT
Gleb Smirnoff [Mon, 31 Oct 2022 15:30:59 +0000 (08:30 -0700)]
rack/bbr: put back assertion that connection is not in TIME-WAIT

The assertion was incorrectly removed in 0d7445193ab.  The leak of
a TIME-WAIT state into tfb_do_segment_nounlock method was fixed in
31bc602ff81.  The TIME-WAIT connections are processed by the main
tcp_input() always.

20 months agonetlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define.
Alexander V. Chernikov [Mon, 31 Oct 2022 15:03:27 +0000 (15:03 +0000)]
netlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define.

Reported by: harti

20 months agonetlink: fix NLMSG_SPACE() macro.
Alexander V. Chernikov [Mon, 31 Oct 2022 15:02:12 +0000 (15:02 +0000)]
netlink: fix NLMSG_SPACE() macro.

Reported by: bapt

20 months agonetlink: fix generic netlink privilege check.
Alexander V. Chernikov [Mon, 31 Oct 2022 13:40:25 +0000 (13:40 +0000)]
netlink: fix generic netlink privilege check.

Reported by: bapt

20 months agoRemove wg.4 from ObsoleteFiles.inc
Gordon Bergling [Mon, 31 Oct 2022 09:38:38 +0000 (10:38 +0100)]
Remove wg.4 from ObsoleteFiles.inc

wg.4 is still included which is obsolete
since 744bfb213144. So remove the entry.

PR: 267455
Reported by: Larry Rosenman <ler at FreeBSD dot org>

20 months agonetgraph/ng_bridge: add missing array terminator
Kristof Provost [Mon, 31 Oct 2022 08:47:01 +0000 (09:47 +0100)]
netgraph/ng_bridge: add missing array terminator

PR: 267457
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week

20 months agomktemp: add -p/--tmpdir argument
Kyle Evans [Mon, 31 Oct 2022 03:55:46 +0000 (22:55 -0500)]
mktemp: add -p/--tmpdir argument

This matches other mktemp implementations, including OpenBSD and GNU.
The -p option can be used to provide a tmpdir prefix for specified
templates.  Precedence works out like so:

-t flag:
- $TMPDIR
- -p directory
- /tmp

Implied -t flag (no arguments or only -d flag):
- -p directory
- $TMPDIR
- /tmp

Some tests have been added for mktemp(1) in the process.

Reviewed by: imp (earlier version), wosch
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37121

20 months agomktemp: add some GNU-compatible long options
Kyle Evans [Mon, 31 Oct 2022 03:55:46 +0000 (22:55 -0500)]
mktemp: add some GNU-compatible long options

GNU maketemp has long options for -d, -q, and -u, so let's add these
now for compatibility.

Reviewed by: emaste, imp, wosch
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37120

20 months agols(1): add a -v flag to sort naturally
Aymeric Wibo [Sun, 23 Oct 2022 07:46:27 +0000 (09:46 +0200)]
ls(1): add a -v flag to sort naturally

Add a -v flag for ls which sorts entries following a natural ordering
using strverscmp(3) (e.g. "bloem1 bloem9 bloem10" as opposed to
"bloem1 bloem10 bloem9").

Update the manual page and add a test case.

Reviewed by: pauamma, bcr
Tested by: pstef
Differential Revision: https://reviews.freebsd.org/D36407

20 months agoAdditional diagnostic output when running fsck_ffs with debugging flag (-d)
Kirk McKusick [Sun, 30 Oct 2022 21:59:44 +0000 (14:59 -0700)]
Additional diagnostic output when running fsck_ffs with debugging flag (-d)

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

20 months agodtrace: Load fasttrap on powerpc with dtraceall
Justin Hibbits [Sun, 30 Oct 2022 19:56:12 +0000 (15:56 -0400)]
dtrace: Load fasttrap on powerpc with dtraceall

This was missing from the original port of DTrace to powerpc 10 years
ago.

MFC after: 3 weeks

20 months agodtrace: Add pid provider to the build for powerpc
Justin Hibbits [Sun, 30 Oct 2022 19:40:05 +0000 (15:40 -0400)]
dtrace: Add pid provider to the build for powerpc

The fasttrap pid provider has been in place for a long time, but stopped
getting built by efe88d92da in preparation for 64-bit atomics.  32-bit
emulation of 64-bit atomics was added in 9aafc7c05.

MFC after: 3 weeks

20 months agodtrace: Make pid provider work on trivial tests
Justin Hibbits [Sun, 30 Oct 2022 19:33:06 +0000 (15:33 -0400)]
dtrace: Make pid provider work on trivial tests

'newpc' needs set in the "common" case.  With this, the trivial test

 $ dtrace -n 'pid$target:libc:strlen:entry { trace(timestamp); }' -p
 <pid>

now works.

MFC after: 3 weeks

20 months agoofed: allow using IPv6 address in rc_pingpong server
Piotr Kubaj [Fri, 28 Oct 2022 09:59:05 +0000 (11:59 +0200)]
ofed: allow using IPv6 address in rc_pingpong server

Summary:
The current OFED code allows binding server to IPv6 address. It was added back in https://github.com/linux-rdma/rdma-core/commit/91fc39561d04903cd5b1665d9215a184baa66ba9

Sponsored by: Intel Corporation
MFC after: 3 days

Reviewers: hselasky

Subscribers: imp

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

20 months agowg.4: Update the SPDX License Identifier
Gordon Bergling [Sun, 30 Oct 2022 18:05:30 +0000 (19:05 +0100)]
wg.4: Update the SPDX License Identifier

The following License Identifier
'BSD-2-Clause-FreeBSD' is not allowed
for new code so use the correct on.

Reported by: imp

20 months agoLinuxKPI: add timekeeping.h, another dummy (empty) header file
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:21:26 +0000 (17:21 +0000)]
LinuxKPI: add timekeeping.h, another dummy (empty) header file

The file is included by a driver but it seems we don't need to implement
anything here.

MFC after: 3 days

20 months agointr_event(9): document intr_event_handle()
Mitchell Horne [Sun, 30 Oct 2022 14:02:20 +0000 (11:02 -0300)]
intr_event(9): document intr_event_handle()

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

20 months agowg.4: Add some enhancements
Gordon Bergling [Sun, 30 Oct 2022 12:59:37 +0000 (13:59 +0100)]
wg.4: Add some enhancements

- add a SPDX-License-Identifier
- rename the title of the man page
- use better grammar in some places
- reword 'IPs' to 'IP addresses'
- add a missing word in the AUTHORS section
- use '.An -nosplit' in the AUTHORS section
- Xr ipsec and ovpn

Reviewed by: pauamma, mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37205

20 months agotee.1: Add a HISTORY section
Gordon Bergling [Sun, 30 Oct 2022 10:29:59 +0000 (11:29 +0100)]
tee.1: Add a HISTORY section

The most accurate information I have found is that
tee(1) first appeared in Version 7 AT&T UNIX.

Reviewed by: pauamma
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37206

20 months agostrfmon: Remove XXX marks
Jose Luis Duran [Fri, 28 Oct 2022 09:20:33 +0000 (06:20 -0300)]
strfmon: Remove XXX marks

phantom@'s HDD crashed with the final version of strfmon.c, as explained
in 9d430a5991d3f64a75fee951a1efab3593207832.

Now there are tests in place that cover these code paths.

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_l: Use specified locale for number formatting
Jose Luis Duran [Fri, 28 Oct 2022 01:24:48 +0000 (22:24 -0300)]
strfmon_l: Use specified locale for number formatting

strfmon_l does not take fully into consideration the explicitly passed
locale to perform the formatting.

Parallel universe bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=19633

Obtained from: Darwin
Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_test: Add a test for strfmon_l
Jose Luis Duran [Fri, 28 Oct 2022 02:53:43 +0000 (23:53 -0300)]
strfmon_test: Add a test for strfmon_l

Attempt to test the correctness of strfmon_l(3).

Items marked with XXX represent an invalid output.

Obtained from: https://github.com/NetBSD/src/commit/e7eba0044fe6128291cbb7e5923c7cf7d87318cc

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_test: Reserve space for the null terminator
Jose Luis Duran [Thu, 27 Oct 2022 10:01:24 +0000 (07:01 -0300)]
strfmon_test: Reserve space for the null terminator

Otherwise strfmon(3) could overflow the buffer.

Here is mostly done for correctness and illustrative purposes, as there
is no chance it could actually happen.

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_l(3): Add name to the man page
Jose Luis Duran [Fri, 28 Oct 2022 08:29:16 +0000 (05:29 -0300)]
strfmon_l(3): Add name to the man page

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agoiommu_gas: drop fini cleanup loop
Doug Moore [Sat, 29 Oct 2022 17:56:06 +0000 (12:56 -0500)]
iommu_gas: drop fini cleanup loop

Assertions suggest that the loop in iommu_gas_fini_domain is executed
zero times, so remove it.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D37204

20 months agomodules: Add missing opt_*.h files for stand-alone compile
Warner Losh [Sat, 29 Oct 2022 14:49:20 +0000 (08:49 -0600)]
modules: Add missing opt_*.h files for stand-alone compile

Standalone compile that we at least create these opt_*.h files.

Sponsored by: Netflix

20 months agomodules: Remove duplicate opt_global.h target
Warner Losh [Sat, 29 Oct 2022 14:52:28 +0000 (08:52 -0600)]
modules: Remove duplicate opt_global.h target

The default one does the right thing these days.

Sponsored by: Netflix

20 months agosys/modules: MODULES_OVERRIDE takes precedence over EXTRA_MODULES and WITHOUT_MODULES
Warner Losh [Sat, 29 Oct 2022 14:34:16 +0000 (08:34 -0600)]
sys/modules: MODULES_OVERRIDE takes precedence over EXTRA_MODULES and WITHOUT_MODULES

MODULES_OVERRIDE has traditionally taken precedence over EXTRA_MODULES
and WITHOUT_MODULES as the exact list of modules to build. Over time,
things have been added that has broken this. Move the .endif that makes
this the case to the right place. The so called 'ALL_MODULES' option is
the only thing with higher precedence, but it's not quite all the
options anymore (though it is much more of them, and doesn't quite
work on !x86).

Sponsored by: Netflix

20 months agodtb: Be much less verbose in the building of dtb
Warner Losh [Fri, 28 Oct 2022 21:42:58 +0000 (15:42 -0600)]
dtb: Be much less verbose in the building of dtb

Make the dtb/dtbo files with less noise. Remove echo statements, but add
back the call for the non-meta builds to replace the removed noise.

Suggetions by: jrtc27
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37073

20 months agomake: Don't print as many ==> and -- xxx -- lines in meta mode
Warner Losh [Fri, 28 Oct 2022 21:42:49 +0000 (15:42 -0600)]
make: Don't print as many ==> and -- xxx -- lines in meta mode

Since metamode just announces what it's doing, the extra -- xxx -- lines
aren't needed for recursive descent, nor are the ==> lines needed. This
speeds up rebuilding kernels a lot...

Sponsored by: Netflix
Reviewed by: sjg, bdrewery
Differential Revision: https://reviews.freebsd.org/D37071

20 months agolinux, linux64: fix module load
Mitchell Horne [Sat, 29 Oct 2022 15:30:32 +0000 (12:30 -0300)]
linux, linux64: fix module load

The previous commit added references to to the syscallnames arrays, but
failed to add the relevant source files to the module build. Thus, the
modules failed to load due to missing symbols.

Reported by: cy
Fixes: 1da65dcb1c57 ("linux: populate sv_syscallnames in each sysentvec")
Sponsored by: The FreeBSD Foundation

20 months agolinux, linux64: improve SRCS formatting
Mitchell Horne [Sat, 29 Oct 2022 15:28:16 +0000 (12:28 -0300)]
linux, linux64: improve SRCS formatting

Sort the entries alphabetically, and list them with one entry per line.
This makes the diffs much cleaner when adding or removing a new entry,
as I will do in the next commit.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation