]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agokerneldump: Inline dump_savectx() into its callers
Mark Johnston [Mon, 20 Mar 2023 18:16:00 +0000 (14:16 -0400)]
kerneldump: Inline dump_savectx() into its callers

The callers of dump_savectx() (i.e., doadump() and livedump_start())
subsequently call dumpsys()/minidumpsys(), which dump the calling
thread's stack when writing the dump.  If dump_savectx() gets its own
stack frame, that frame might be clobbered when its caller later calls
dumpsys()/minidumpsys(), making it difficult for debuggers to unwind the
stack.

Fix this by making dump_savectx() a macro, so that savectx() is always
called directly by the function which subsequently calls
dumpsys()/minidumpsys().

This fixes stack unwinding for the panicking thread from arm64
minidumps.  The same happened to work on amd64, but kgdb reports the
dump_savectx() calls as coming from dumpsys(), so in that case it
appears to work by accident.

Fixes: c9114f9f86f9 ("Add new vnode dumper to support live minidumps")
Reviewed by: mhorne, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39151

(cherry picked from commit c3179891f897d840f578a5139839fcacb587c96d)

14 months agotcp_rack.4: Correct a link in the SEE ALSO section
Gordon Bergling [Sun, 19 Mar 2023 08:49:33 +0000 (09:49 +0100)]
tcp_rack.4: Correct a link in the SEE ALSO section

The PDF at arxiv.org is only accessible when
retrieving it via the website.

(cherry picked from commit d37cca6570e9b42fae46ed9ae3a5af5d065f4440)

14 months agoReserve u2f group for FIDO/U2F key support (SSH, etc.)
Ed Maste [Fri, 18 Feb 2022 18:13:20 +0000 (13:13 -0500)]
Reserve u2f group for FIDO/U2F key support (SSH, etc.)

We have FIDO/U2F support in the base system now, so reserve a group ID
for it (maching the security/u2f-devd port).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34341

(cherry picked from commit d0f1f38202c4176af277185a3b973098bb03fe6d)

14 months agomakefs: do not call brelse if bread returns an error
Ed Maste [Mon, 13 Mar 2023 20:51:51 +0000 (16:51 -0400)]
makefs: do not call brelse if bread returns an error

If bread returns an error there is no bp to brelse.  One of these
changes was taken from NetBSD commit 0a62dad69f62 ("This works well
enough to populate..."), the rest were found by looking for the same
pattern.

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

(cherry picked from commit bc33c99234a676c41cde63cce389dd6b8b70adfc)

14 months agoCI: update QEMU command line to avoid deprecated option format
Ed Maste [Tue, 7 Mar 2023 16:38:01 +0000 (11:38 -0500)]
CI: update QEMU command line to avoid deprecated option format

> warning: short-form boolean option 'readonly' deprecated
> Please use readonly=on instead

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a2de35e1a460126b99f63b6cdc3759157cc15860)

14 months agosmbfs.5: Us .An -nosplit for the AUTHORS section
Gordon Bergling [Sat, 18 Mar 2023 09:02:59 +0000 (10:02 +0100)]
smbfs.5: Us .An -nosplit for the AUTHORS section

Use .An -nosplit for the AUTHORS section, so that
it renders without an unnecessary newline.

No .Dd bump since it isn't a content change.

(cherry picked from commit ac6bc808f51654414cb7a72f6849b3e61b1fb172)

14 months agonetinet: Tighten checks for unspecified source addresses
Mark Johnston [Mon, 6 Mar 2023 20:06:00 +0000 (15:06 -0500)]
netinet: Tighten checks for unspecified source addresses

The assertions added in commit b0ccf53f2455 ("inpcb: Assert against
wildcard addrs in in_pcblookup_hash_locked()") revealed that protocol
layers may pass the unspecified address to in_pcblookup().

Add some checks to filter out such packets before we attempt an inpcb
lookup:
- Disallow the use of an unspecified source address in in_pcbladdr() and
  in6_pcbladdr().
- Disallow IP packets with an unspecified destination address.
- Disallow TCP packets with an unspecified source address, and add an
  assertion to verify the comment claiming that the case of an
  unspecified destination address is handled by the IP layer.

Reported by: syzbot+9ca890fb84e984e82df2@syzkaller.appspotmail.com
Reported by: syzbot+ae873c71d3c71d5f41cb@syzkaller.appspotmail.com
Reported by: syzbot+e3e689aba1d442905067@syzkaller.appspotmail.com
Reviewed by: glebius, melifaro
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38570

(cherry picked from commit 713264f6b8bc5f927dd52cf8ffcccfa397034fec)

14 months agosendfile tests: Mount filesystems under the test workdir
Mark Johnston [Sun, 12 Mar 2023 18:50:14 +0000 (14:50 -0400)]
sendfile tests: Mount filesystems under the test workdir

Otherwise they can't be run in parallel as they share a mount point.

MFC after: 1 week

(cherry picked from commit 683853a92477a18f19b29d6bd8dd71ebe5553f89)

14 months agosmr: Remove the return value from smr_wait()
Mark Johnston [Tue, 7 Feb 2023 21:38:07 +0000 (16:38 -0500)]
smr: Remove the return value from smr_wait()

This is supposed to be a blocking version of smr_poll(), so there's no
need for a return value.  No functional change intended.

MFC after: 1 week

(cherry picked from commit cd133525fad197ac8cbbd4bd68860a4dd51a561f)

14 months agoepair: Remove unneeded includes and sort some of the rest
Mark Johnston [Mon, 13 Mar 2023 13:27:47 +0000 (09:27 -0400)]
epair: Remove unneeded includes and sort some of the rest

No functional change intended.

MFC after: 1 week

(cherry picked from commit 29c9b1673305406dc64161aa7b565a296526fa67)

14 months agoreadelf: fix -wR option, memory leaks, and -wf minor bug
Christos Margiolis [Mon, 6 Mar 2023 17:50:13 +0000 (12:50 -0500)]
readelf: fix -wR option, memory leaks, and -wf minor bug

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38419

(cherry picked from commit cec2d0b1c7ac3196613813c0b07a2387916a8ccd)

14 months agoudp: Fix a memory leak in udp6_send()
Mark Johnston [Tue, 14 Mar 2023 14:26:29 +0000 (10:26 -0400)]
udp: Fix a memory leak in udp6_send()

Reviewed by: glebius
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38993

(cherry picked from commit e9ea690ae8486b74d6eeca62e316bf591d8aea4e)

14 months agonetbsd-tests: Remove some pointless sleeps from message queue tests
Mark Johnston [Fri, 10 Mar 2023 22:06:46 +0000 (17:06 -0500)]
netbsd-tests: Remove some pointless sleeps from message queue tests

- In the msgctl tests, there is no point in sleeping after a fork().
  Just block immediately in wait().
- In non-blocking send/recv tests, just wait for the child to exit once
  it's reached a message limit.  If a bug prevents the child from
  exiting promptly, the test will time out.

MFC after: 1 week

(cherry picked from commit 478de7f8e25849ce0b3a37b4baaf9c69e0b34072)

14 months agonetbsd-tests: Serialize message queue tests
Mark Johnston [Fri, 10 Mar 2023 22:07:06 +0000 (17:07 -0500)]
netbsd-tests: Serialize message queue tests

They can fail when run in parallel since they all share a global queue
key.

MFC after: 1 week

(cherry picked from commit e1ccf64b884a1a47c48a2fb7d71e7eb18347c6d6)

14 months agopf tests: test IPv6 fragmentation with link-local addresses
Kristof Provost [Sun, 12 Mar 2023 15:08:31 +0000 (16:08 +0100)]
pf tests: test IPv6 fragmentation with link-local addresses

We've observed a panic after pf_refragment6() with link-local addresses,
because pf_refragment6() calls ip6_forward() even for a simple output
case.
That results in us entering ip6_forward() with an mbuf with a NULL
m->m_pkthdr.rcvif, which can cause a NULL deref (but seemingly not for
GUAs.

Test sending fragmented link-local packets to pf.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39063

(cherry picked from commit 225e85513fd7a5e31f649e35f0b99454bb725776)

14 months agoacpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.
Konstantin Belousov [Sat, 18 Mar 2023 15:45:49 +0000 (17:45 +0200)]
acpi_wakeup.c: apply the reviewer' editorial corrections to the comment text.

(cherry picked from commit 2b4b3789f877918e9e89a217d3b25d854d1a2267)

14 months agoamd64: properly recalculate mitigations knobs after resume
Konstantin Belousov [Fri, 17 Mar 2023 13:02:03 +0000 (15:02 +0200)]
amd64: properly recalculate mitigations knobs after resume

(cherry picked from commit 02904a06c76be857307b78184863654b9e7b88ab)

14 months agoamd64 acpi_wakeup.c: fix typo
Konstantin Belousov [Fri, 17 Mar 2023 12:42:26 +0000 (14:42 +0200)]
amd64 acpi_wakeup.c: fix typo

(cherry picked from commit ff6d60946a0e9e0ade3045b734ed4bea08e20938)

14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Wed, 8 Mar 2023 06:02:07 +0000 (22:02 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Clarification of the size of the snapshot file.

Suggested by: Matteo Riondato
PR:           266358
Differential Revision: https://reviews.freebsd.org/D38817

(cherry picked from commit 129ea078cd16b768a1100b497282fd9359e8dfea)

14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Tue, 7 Mar 2023 05:43:32 +0000 (21:43 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Minor clarification.

(cherry picked from commit 7741a5c4dc5e318dcaabf5e336dfa9cf3f3b6805)

14 months agoFFS/UFS snapshots: improve documentation.
Kirk McKusick [Mon, 6 Mar 2023 05:37:23 +0000 (21:37 -0800)]
FFS/UFS snapshots: improve documentation.

This update provides a more detailed description of FFS/UFS snapshots
and adds links to useful man pages.

Requested by: Graham Perrin
Submitted by: darius-dons.net.au
Reviewed by:  Ravi Pokala
PR:           266358
Differential Revision: https://reviews.freebsd.org/D38817

(cherry picked from commit 528d8e55c8d338e78fa4e6c9f182e8975f75199a)

14 months agodaemon: set supervise_enabled during argument processing
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: set supervise_enabled during argument processing

Now when supervsion mode has it's own variable there is really no
reason to set it separately from the rest of the variables. Move
initialization of supervise_enabled var to the argument processing
switch loop, where it belongs.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit f907027b49d93170ed2e92cf0d183cd643b1f70e)

14 months agodaemon: decouple restart variable
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: decouple restart variable

The 'restart' variable was responsible for enablement of restart
behavior and for restart delay. While it may seem convenient it
leads to cluttering the exit/restart logic

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit e781739084e9cb120ef4b6657074d2b7336ee405)

14 months agodaemon: add braces to while loop
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: add braces to while loop

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit d6c398d882b61e02e6f061be81886b9675f3fb5c)

14 months agodaemon: simplify if/else chain
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: simplify if/else chain

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit cd1e6e70d001bea9e9e0220bdfdbd8b5dd9922de)

14 months agodaemon: change type of listen_child() to C99 bool
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: change type of listen_child() to C99 bool

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit bc43a9a7157a8249a492ee3efd8589369dd94228)

14 months agodaemon: flatten and simplify fork() logic
Ihor Antonov [Fri, 3 Mar 2023 05:17:02 +0000 (23:17 -0600)]
daemon: flatten and simplify fork() logic

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit 75f61ca92098941f73020f46674f0c40db7270fb)

14 months agodaemon: style changes
Ihor Antonov [Fri, 3 Mar 2023 05:17:01 +0000 (23:17 -0600)]
daemon: style changes

This is not a functional change.
- Clean up whitespace (spaces where there should be tabs)
- Break up lines that are longer than 80

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/672

(cherry picked from commit 39ea4280e4c5e41f237e55770f4f62b04b24d899)

14 months agodaemon: more human-friendly variable names
Ihor Antonov [Thu, 2 Mar 2023 03:00:43 +0000 (21:00 -0600)]
daemon: more human-friendly variable names

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 129ec8f4805ec3f33480873dc9cf3b8404c9ece8)

14 months agodaemon: move syslog facility and syslog tag into log_params
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: move syslog facility and syslog tag into log_params

Since struct log_params already contains logging-related
varaiables, including syslog-related, move remaining
syslog-related variables into struct log_params as well

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 6f0636728b53c74d3327a8da8c51efee810fbff0)

14 months agodaemon: deduplicate log_params varaibles
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: deduplicate log_params varaibles

While we're here, sort log_params by size.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit e70444c622a97e02fb5a76c06f9a48b4a07aa963)

14 months agodaemon: make log_reopen variable a bool
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: make log_reopen variable a bool

Following style(9) and C99 recommendation use bool instead of
int for boolean operations.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 97022e90c3693ad1180bd26ebc909ce27893b227)

14 months agodaemon: make dosyslog variable a bool and give it a better name
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: make dosyslog variable a bool and give it a better name

Following style(9) and C99 recommendation use bool instead of
int for boolean operations. Also give the variable a more descriptive
name that follows boolean naming convention.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit f2f9d31d9f9f7f319edb95874b41af0733a26624)

14 months agodaemon: add supervision_enabled var
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: add supervision_enabled var

explicitly name a bunch of boolean checks that enable
supervison mode and improve comments

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 203df05b692b5e2b92c990d8971f5797e3a7a139)

14 months agodaemon: initialize struct sigaction at declaration site
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: initialize struct sigaction at declaration site

This improves readability by uncluttering the code

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 259ed21d21f81b656f06447716d41c190576477e)

14 months agodaemon: fix double init of pid variable
Ihor Antonov [Thu, 2 Mar 2023 03:00:42 +0000 (21:00 -0600)]
daemon: fix double init of pid variable

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 91b921c7d4684599d1d983f77dcc3df90900adc0)

14 months agodaemon: initialize mask_orig with sigemptyset()
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: initialize mask_orig with sigemptyset()

consolidation of variable declarations and initializations in previous
commit allowed me to detect that one of the signal masks is not properly
initialized with sigemptyset (as man 3 sigsetops demands)

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 84866cefdfb78488543056173aea78748b77159b)

14 months agodaemon: consolidate variable declarations and initializaions
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: consolidate variable declarations and initializaions

- improve readability by breaking apart single-line multi-variable declarations
- initialize simple variables at declaration site
- move other top-level variable initializations closer declarations
  to avoid potential UB and unclutter the use-site.

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit e745dc2287ac4844c1a21aaa31d0bc3dad6b1b06)

14 months agodaemon: use braces with 'if' consistently
Ihor Antonov [Thu, 2 Mar 2023 03:00:41 +0000 (21:00 -0600)]
daemon: use braces with 'if' consistently

Reviewed by: kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/669

(cherry picked from commit 6b4ef4b16a6930d91d0d99c4ceb75cd43a7526c1)

14 months agodaemon: add long_opts
Ihor Antonov [Fri, 10 Feb 2023 04:36:07 +0000 (22:36 -0600)]
daemon: add long_opts

Long options improve readability of scripts, makes code comprehension
easier.  This patch adds long options while preserving the existing CLI
interface.

Also --help/-h option is added.

Reviewed by: allanjude, pauamma (both earlier versions), kevans
Differential Revision: https://reviews.freebsd.org/D38244

(cherry picked from commit 0a402ad2e6d6014ed8c622a90153f53b99c1b482)

14 months agointrng: track counter allocation with a bitmap
Mitchell Horne [Tue, 14 Feb 2023 18:02:12 +0000 (14:02 -0400)]
intrng: track counter allocation with a bitmap

Crucially, this allows releasing counters, and interrupt sources by
extension. Where before we were incrementing intrcnt_index with atomics,
now we protect the bitmap using the existing isrc_table_lock mutex.

Reviewed by: mmel
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38437

(cherry picked from commit 28137bdb19aa34b8351108de4257795a93c0ba09)

14 months agointrng: sort includes
Mitchell Horne [Sat, 4 Feb 2023 17:04:30 +0000 (13:04 -0400)]
intrng: sort includes

MFC after: 3 days

(cherry picked from commit 82e846df5bc20418b792f948fa5b558e523f0746)

14 months agobhyvectl: don't permit using --suspend and --checkpoint at same time
Vitaliy Gusev [Mon, 6 Mar 2023 12:42:15 +0000 (13:42 +0100)]
bhyvectl: don't permit using --suspend and --checkpoint at same time

When using the --suspend and --checkpoint parameter, bhyvectl will
produce two checkpoint images and the exits. This is slightly ambiguous.
So, permit only one of theses parameters at the same time.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38887

(cherry picked from commit 062f2818c1ad35bdc3d520c7572e3cefda657770)

14 months agobhyve: init checkput before caph_enter
Vitaliy Gusev [Mon, 6 Mar 2023 12:35:21 +0000 (13:35 +0100)]
bhyve: init checkput before caph_enter

init_checkpoint_thread binds to a socket. Bhyve isn't allowed to do that
after caph_enter.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38857

(cherry picked from commit 9a9a248964696f45260ea026aa5f9174cc86b137)

14 months agobhyve: exit with EX_OSERR if init checkpoint or restore time failed
Vitaliy Gusev [Mon, 6 Mar 2023 12:30:54 +0000 (13:30 +0100)]
bhyve: exit with EX_OSERR if init checkpoint or restore time failed

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38872

(cherry picked from commit d213429e42d48c7de56baf60befd5d953654d337)

14 months agobhyve: add cap limits for ipc socket
Vitaliy Gusev [Mon, 6 Mar 2023 11:36:40 +0000 (12:36 +0100)]
bhyve: add cap limits for ipc socket

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38856

(cherry picked from commit 577ddca90877e377e5b40c8baa15fa5b7a3c9965)

14 months agobhyve: don't flush readonly device at blockif_pause
Vitaliy Gusev [Mon, 6 Mar 2023 11:35:17 +0000 (12:35 +0100)]
bhyve: don't flush readonly device at blockif_pause

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38855

(cherry picked from commit 5c0a03125988b89610f61a1bb2137b0e29d7cf31)

14 months agolibvmm: add missing ioctl's to vm_ioctl_cmds
Vitaliy Gusev [Mon, 6 Mar 2023 11:33:58 +0000 (12:33 +0100)]
libvmm: add missing ioctl's to vm_ioctl_cmds

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38866

(cherry picked from commit 755dcd5e49133e18b735de3e53f3bc79a8377082)

14 months agobhyvectl: don't leak nvlist in send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:32:17 +0000 (12:32 +0100)]
bhyvectl: don't leak nvlist in send_message

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38900

(cherry picked from commit 942525ab47e9cd9277ac426e082366d58d7bbe41)

14 months agobhyvectl: correct socket_fd closing in send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:30:44 +0000 (12:30 +0100)]
bhyvectl: correct socket_fd closing in send_message

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38889

(cherry picked from commit b64ba2426441ed33120ef0d3057417b7c0be6972)

14 months agobhyvectl: do not return garbage from send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:27:10 +0000 (12:27 +0100)]
bhyvectl: do not return garbage from send_message

err is used uninitialized in some cases.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38886

(cherry picked from commit 89fe7b98fe45cf56d60d0d4dfa1bfad3ba6908ec)

14 months agobhyve: fix resume for vms with guest_ncpus > 1
Vitaliy Gusev [Tue, 28 Feb 2023 10:28:40 +0000 (11:28 +0100)]
bhyve: fix resume for vms with guest_ncpus > 1

This error occurs because vm->vcpu[1] has not been allocated yet when
vm_snapshot_vm() is called.

To fix this, move spinup_vcpu() before restore code.

Reviewed by: corvink, markj
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38477

(cherry picked from commit 9ff3e8b7f09034202ad1f24f4fbbe52cf7f56117)

14 months agobhyve: fix restore of kernel structs
Vitaliy Gusev [Tue, 28 Feb 2023 10:32:49 +0000 (11:32 +0100)]
bhyve: fix restore of kernel structs

vmx_snapshot() and svm_snapshot() do not save any data and error occurs at
resume:

Restoring kernel structs...
vm_restore_kern_struct: Kernel struct size was 0 for: vmx
Failed to restore kernel structs.

Reviewed by: corvink, markj
Fixes: 39ec056e6dbd89e26ee21d2928dbd37335de0ebc ("vmm: Rework snapshotting of CPU-specific per-vCPU data.")
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38476

(cherry picked from commit 8104fc31a234bad1ba68910f66876395fc58ebdc)

14 months agovmm: fix restore of TSC offset
Vitaliy Gusev [Tue, 28 Feb 2023 11:16:35 +0000 (12:16 +0100)]
vmm: fix restore of TSC offset

After suspend/resume Ubuntu 20.04 and 22.04 installer can hang if
tsc-early clocksource has a big skew.

Reviewed by: corvink, jhb
Fixes: a7db532e3a6f83067b342f569b56076d011f8a1e ("vmm: Simplify saving of absolute TSC values in snapshots.")
MFC after: 2 weeks
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38474

(cherry picked from commit 281b496f22d1d666b2ef1e54985432627ec434a4)

14 months agobhyve: add common fwcfg items
Corvin Köhne [Wed, 11 Aug 2021 08:02:57 +0000 (10:02 +0200)]
bhyve: add common fwcfg items

Qemu defines some common fwcfg items. We don't need to support all of
them. Only a subset needs to be present for fwcfg to work properly.

- signature
  The signature is used by the guest to check if qemu's fwcfg is
  available or not.
- id
  The id is used by the guest to check which features are supported by
  the fwcfg implementation of the hypervisor.
- file_dir
  The file dir reports all fwcfg items which don't have a fixed index.
  These are mostly user defined fwcfg items.

Reviewed by: <If someone else reviewed your modification.>
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38335

(cherry picked from commit 34f804e547e7c3b10b12f5450ff2e0a771000daf)

14 months agobhyve: add helper to add fwcfg items
Corvin Köhne [Wed, 11 Aug 2021 08:01:19 +0000 (10:01 +0200)]
bhyve: add helper to add fwcfg items

This helper makes it easier to add multiple fwcfg items. You can pass an
index and some data to the helper. The helper adds these information to
the fwcfg emulation so that the guest reads the given data on the
specified index.

Reviewed by: <If someone else reviewed your modification.>
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38334

(cherry picked from commit 3ef46195ac37111ab247cfabed735d3ee5e7f5b5)

14 months agocarp: carp_master_down_locked() requires net epoch
Zhenlei Huang [Thu, 16 Mar 2023 10:00:13 +0000 (18:00 +0800)]
carp: carp_master_down_locked() requires net epoch

Reviewed by: kp
Fixes: 1d126e9b9474 carp: Widen epoch coverage
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D39113

(cherry picked from commit 49cad3daf2a3abe8270f71ee5b15b8990a19529d)

14 months agoroute.8: Don't reference an external command in EXAMPLES
Gordon Bergling [Tue, 14 Mar 2023 13:55:28 +0000 (14:55 +0100)]
route.8: Don't reference an external command in EXAMPLES

It is better to mention the externel command for showing
the routing table as using an explicit command.

PR: 231579
Suggested by: karels
Reviewed by: karles, gbe
Differential Revision: https://reviews.freebsd.org/D39075

(cherry picked from commit 21f268182838f072f96234c727778d5603a580e3)

14 months agokern: physmem: don't create a new exregion for different flags...
Kyle Evans [Fri, 10 Mar 2023 05:27:39 +0000 (23:27 -0600)]
kern: physmem: don't create a new exregion for different flags...

... if the region we're adding is an exact match to one that we already
have.  Simply extend the flags of the existing entry as needed so that
we don't end up with duplicate regions.

It could be that we got the exclusion through two different means, e.g.,
FDT memreserve and the EFI memory map, and we may derive different
characteristics from each.  Apply the most restrictive set to the
region.

Reported by: Mark Millard <marklmi yahoo com>
Reviewed by: mhorne

(cherry picked from commit cc0fe048ec39636216ed59fa47eb311b2537cfc5)

14 months agogrep: remove tautological condition
Kyle Evans [Thu, 9 Mar 2023 05:29:30 +0000 (23:29 -0600)]
grep: remove tautological condition

st_size is an off_t, it cannot hold values larger than OFF_MAX.

CID: 1008931
(cherry picked from commit f6d6c66889001208aee7b0c46efe1c8ddffda57c)
(cherry picked from commit c816aea7abcf7a6e9471907dcb7ee3d7969a0ab3)
(cherry picked from commit b61758494286db075d5c6b68a5f2e7522e7be394)

14 months agoefifb: add a tunable to select the framebuffer cache attribute
Kyle Evans [Wed, 1 Mar 2023 06:04:49 +0000 (00:04 -0600)]
efifb: add a tunable to select the framebuffer cache attribute

Mapping the framebuffer with WC (Write Combined) memory type can, in
practice, cause some memory transactions to be rate-limited at a
fraction of the fb write rate.  WC allows one core to queue up many
globally visible write transactions, and in the process some unrelated
transactions may end up having to wait for all of the queued up PCI
writes to be flushed.

Add an hw.efifb.cache_attr tunable to allow mapping the framebuffer as
uncacheable instead.  We should likely be taking a more careful approach
of checking the memory map to determine which cacheability attributes
are feasible, but the knob lets us use our historically functional
behavior while offering a convenient way to switch on a stock kernel.

The only valid values for hw.efifb.cache_attr at this time are "uc" and
"wc".

Original patch by Marc De La Gueronniere <mdelagueronniere@verisign.com>
along with previous testing.

Reviewed by: imp
Sponsored by: Verisign, Inc.
Sponsored by: Klara, Inc.

(cherry picked from commit 8dff0b6761407357c5bb42ee799c5c9f465557a3)

14 months agoi18n: csmapper: hook up the top-level .src files to the build
Kyle Evans [Wed, 1 Mar 2023 04:24:54 +0000 (22:24 -0600)]
i18n: csmapper: hook up the top-level .src files to the build

The top-level charset.pivot.src may be empty, but the top-level
mapper.dir.src is not -- it contains some definitions for supplementary
UCS planes.  The SMP/SSP definitions aren't actually used at the moment,
but the inclusion of the SIP definitions fixes conversions involving
JISX0213-1/JISX0213-2 to be possible.

Sponsored by: Klara, Inc.

(cherry picked from commit dc6df546be29a468ae21b1b7604e85b703ad6779)

14 months agoiconvlist(3): fix count argument type
Kyle Evans [Thu, 23 Feb 2023 21:22:12 +0000 (15:22 -0600)]
iconvlist(3): fix count argument type

count is just an unsigned int, not a pointer.

Sponsored by: Klara, Inc.

(cherry picked from commit 4e696aff69090da046817a6339d01f4675728b95)

14 months agokern: physmem: don't truncate addresses in DEBUG output
Kyle Evans [Mon, 20 Feb 2023 18:54:00 +0000 (12:54 -0600)]
kern: physmem: don't truncate addresses in DEBUG output

Make it consistent with the above region printing, otherwise it appears
to be somewhat confusing.

(cherry picked from commit cd73914b01a1f2300e587f802383cc563f2e7103)
(cherry picked from commit 7b5cb32fca26428b8c0df98f9c58444557f808ae)
(cherry picked from commit c32946d8bee0d82042165c5d78b4d339d1268a2a)

14 months agossh: Update to OpenSSH 9.3p1
Ed Maste [Thu, 16 Mar 2023 14:29:55 +0000 (10:29 -0400)]
ssh: Update to OpenSSH 9.3p1

This release fixes a number of security bugs and has minor new
features and bug fixes.  Security fixes, from the release notes
(https://www.openssh.com/txt/release-9.3):

This release contains fixes for a security problem and a memory
safety problem. The memory safety problem is not believed to be
exploitable, but we report most network-reachable memory faults as
security bugs.

 * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the
   per-hop destination constraints (ssh-add -h ...) added in OpenSSH
   8.9, a logic error prevented the constraints from being
   communicated to the agent. This resulted in the keys being added
   without constraints. The common cases of non-smartcard keys and
   keys without destination constraints are unaffected. This problem
   was reported by Luci Stanescu.

 * ssh(1): Portable OpenSSH provides an implementation of the
   getrrsetbyname(3) function if the standard library does not
   provide it, for use by the VerifyHostKeyDNS feature. A
   specifically crafted DNS response could cause this function to
   perform an out-of-bounds read of adjacent stack data, but this
   condition does not appear to be exploitable beyond denial-of-
   service to the ssh(1) client.

   The getrrsetbyname(3) replacement is only included if the system's
   standard library lacks this function and portable OpenSSH was not
   compiled with the ldns library (--with-ldns). getrrsetbyname(3) is
   only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This
   problem was found by the Coverity static analyzer.

Accelerated MFC to prepare for inclusion in 13.2-RELEASE.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4d3fc8b0570b29fb0d6ee9525f104d52176ff0d4)

14 months agonetmap: Remove obsolete compatibility defines
Mark Johnston [Thu, 9 Mar 2023 23:16:53 +0000 (18:16 -0500)]
netmap: Remove obsolete compatibility defines

No functional change intended.

Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39001

(cherry picked from commit 626d1e4a82e25d274cdadfebfd81a28e968efb5b)

14 months agofusefs: add some more test cases for bad fuse servers
Alan Somers [Tue, 21 Feb 2023 23:26:37 +0000 (16:26 -0700)]
fusefs: add some more test cases for bad fuse servers

Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38719

(cherry picked from commit 5f51c9c328a63d7290f634b1742f03545eaa2c1c)

14 months agofusefs: fix a buffer overflow in the tests
Alan Somers [Wed, 22 Feb 2023 00:13:56 +0000 (17:13 -0700)]
fusefs: fix a buffer overflow in the tests

The actual overflow occured in the ReadAhead.readahead test.
Surprisingly it has never segfaulted or resulted in any bad behavior.

Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38718

(cherry picked from commit 0c9df4afc239ee52961443e95bca8be81f0dea9e)

14 months agosesutil: don't malloc in a tight loop
Alan Somers [Thu, 9 Feb 2023 22:23:51 +0000 (15:23 -0700)]
sesutil: don't malloc in a tight loop

Reported by: mav
Sponsored by: Axcient
Reviwed by: mav
Differential Revision: https://reviews.freebsd.org/D38473

(cherry picked from commit 4bd4e4b45e8bfbe855406098f393bdf4eda7104d)

14 months agopowerpc/pmap: Add pmap_sync_icache() for radix pmap
Justin Hibbits [Sun, 12 Mar 2023 15:46:57 +0000 (11:46 -0400)]
powerpc/pmap: Add pmap_sync_icache() for radix pmap

DTrace pid provider writes to user space to set breakpoints.  Failing to
sync the icache can lead to SIGTRAP.  Radix pmap is the only one missing
a pmap_sync_icache() method, so the pid provider would only potentially
crash a process on a POWER9 or later system.

(cherry picked from commit 6f0b2a235a133a381634ba9a7f5f477c64db9873)

14 months agodtrace/powerpc: Adjust AFRAMES for fbt and profile
Justin Hibbits [Sat, 11 Mar 2023 16:23:38 +0000 (11:23 -0500)]
dtrace/powerpc: Adjust AFRAMES for fbt and profile

FBT_AFRAMES was skipping over too many frames, while PROFILE_AFRAMES was
skipping over too few.  Adjust them empirically.

(cherry picked from commit 635ecbf47015c259226cb47a3de8fc00c9ed5924)

14 months agodtrace/powerpc: "Fix" stack traces across trap frames
Justin Hibbits [Sat, 11 Mar 2023 16:30:00 +0000 (11:30 -0500)]
dtrace/powerpc: "Fix" stack traces across trap frames

In function boundary tracing the link register is not yet saved to the
save stack location, so the save point contains whatever the previous
'lr' save was, or even garbage, at the time the trap is taken.  Address
this by explicitly loading the link register from the trap frame instead
of the stack, and propagate that out.

(cherry picked from commit 3e1155ade1baab51458374efd0295bdf6db455fc)
(cherry picked from commit e620e088cbd1c062655eee825aaf4f80bd255e1f)

14 months agosqlite3: Vendor import of sqlite3 3.41.0
Cy Schubert [Tue, 28 Feb 2023 13:28:07 +0000 (05:28 -0800)]
sqlite3: Vendor import of sqlite3 3.41.0

Release notes at https://www.sqlite.org/releaselog/3_41_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3410000.tar.gz
MFC after: 2 weeks

Merge commit '615bd3eb2a2225e83e14d5b2a82649430889483c' into temp_merge

(cherry picked from commit 7bba9d9473c00cec825495543198768fe387ebf4)

14 months agonetmap: pkt-gen: init all slots of every tx ring
Vincenzo Maffione [Mon, 6 Mar 2023 17:22:09 +0000 (17:22 +0000)]
netmap: pkt-gen: init all slots of every tx ring

sender_body() uses OPT_COPY to copy the frame into the destination slot
for the first 100,000 packets. Then it removes OPT_COPY to improve
performance. The function always starts with the first tx ring.

If multiple tx rings are in use, it is possible that the initial 100k
packets will only use the first ring. After OPT_COPY is removed, there
may come a time when the first ring is full and sender_body() will move
to the next ring which was never initialized. As a result it will send
all zero packets. (This was discovered when the receiving NIC reported
rx errors.)

Before any transmissions, step through every tx ring and set
NS_BUF_CHANGED on every slot. That will force send_packets() to
initialize the slot when first used. Since it only copies when
necessary, it performs better than always setting OPT_COPY. With this
change, there is no reason for the "drop copy" code.

Submitted by: Brian Poole <brian90013@gmail.com>
MFC after: 7 days

(cherry picked from commit 506336f2cd1fa0a3ba94bc247d7fad1a71d43ac2)

14 months agomakefs: make msdos creation go fast
Warner Losh [Mon, 13 Mar 2023 20:28:51 +0000 (14:28 -0600)]
makefs: make msdos creation go fast

Add missing brelse(bp). Without it the cache grows and we have a n^2
lookup.  I'm not entirely sure why we read the block before we write it
back out, since the only side effect of that is to allocate memory,
clear the memory, read it in from disk, throw it away with the contents
of the file being written out. We likely should just do a getblk() here
instead, but even with all that, this takes the time it takes to create
a 150MB msdos fs image down from 5 minutes to 30 seconds.

Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w
New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w

See code review for how we got this. tl;dr: netbsd move brelse
into bwrite and we picked up msdos code after that, but not the
move. That change should be picked up later.

Sponsored by: Netflix
Reviewed by: emaste
MFC After: 1 day (13.2 is coming fast)
Differential Revision: https://reviews.freebsd.org/D39025

(cherry picked from commit 370e009188ba90c3290b1479aa06ec98b66e140a)

14 months agoepair: Fix the RSS build
Mark Johnston [Tue, 14 Mar 2023 14:57:33 +0000 (10:57 -0400)]
epair: Fix the RSS build

This is a direct commit to stable/13.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Fixes: c3bd32f225ec ("epair: Avoid loading m_flags into a short")

14 months agoepair: Simplify the transmit path and address lost wakeups
Mark Johnston [Wed, 1 Mar 2023 20:21:30 +0000 (15:21 -0500)]
epair: Simplify the transmit path and address lost wakeups

epairs currently shuttle all transmitted packets through a single global
taskqueue thread.  To hand packets over to the taskqueue thread, each
epair maintains a pair of ring buffers and a lockless scheme for
notifying the thread of pending work.  The implementation can lead to
lost wakeups, causing to-be-transmitted packets to end up stuck in the
queue.

Rather than extending the existing scheme, simply replace it with a
linked list protected by a mutex, and use the mutex to synchronize
wakeups of the taskqueue thread.  This appears to give equivalent or
better throughput with >= 16 producer threads and eliminates the lost
wakeups.

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

(cherry picked from commit df7bbd8c354a907d2c2f85a6e18f356f76458f57)

14 months agoepair: Avoid loading m_flags into a short
Mark Johnston [Mon, 6 Mar 2023 14:39:17 +0000 (09:39 -0500)]
epair: Avoid loading m_flags into a short

The m_flags field of struct mbuf is 24 bits wide and so gets truncated
in a couple of places in the epair code.  Instead of preserving the
entire flag set, just remember whether M_BCAST or M_MCAST is set.

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

(cherry picked from commit 48227d1c6db8fceaceebbf8578612302d64ca170)

14 months agonetmap: Fix compiler warnings in tools
Mark Johnston [Mon, 27 Feb 2023 18:41:58 +0000 (13:41 -0500)]
netmap: Fix compiler warnings in tools

- Remove write-only variables, or hide them in cases where their use is
  conditional or commented out.
- Check for errors from cmd_apply() in nmreplay.
- Use ANSI C definitions.

Reviewed by: vmaffione
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38752

(cherry picked from commit 538c66eabda55afccebc25fb66548115e5ed8151)

14 months agobhyvectl: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:32:48 +0000 (09:32 -0500)]
bhyvectl: Address compiler warnings and bump WARNS

Avoid unaligned accesses in cpu_vendor_intel() and address a few other
nits.  No functional change intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38839

(cherry picked from commit 3f5d875a27318a909f23a2b7463c4b2d963085df)

14 months agodeadlkres: Make parameters settable with tunables
Mark Johnston [Fri, 3 Mar 2023 16:16:16 +0000 (11:16 -0500)]
deadlkres: Make parameters settable with tunables

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

(cherry picked from commit 831601773e5ab58b9485c1b111eb8c7c7343abf6)

14 months agobhyveload: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:52:17 +0000 (09:52 -0500)]
bhyveload: Address compiler warnings and bump WARNS

Mostly sprinkle __unused.  Also duplicate strings passed to addenv() so
that constant string literals can be passed.  No functional change
intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38840

(cherry picked from commit ad43dd69cec7b568846b45ff990da6dc86e58467)

14 months agoposixshm tests: Correct page size index checks
Mark Johnston [Fri, 3 Mar 2023 16:16:21 +0000 (11:16 -0500)]
posixshm tests: Correct page size index checks

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

(cherry picked from commit 560f9cd5e1e36ba725f3c677d7b8e514af9f3a85)

14 months agobuf: Make buf_daemon_shutdown() a no-op after a panic
Mark Johnston [Wed, 1 Mar 2023 15:07:56 +0000 (10:07 -0500)]
buf: Make buf_daemon_shutdown() a no-op after a panic

As in commit 9d7cc536e261a7, there is no need to do anything in this
context.

MFC after: 1 week

(cherry picked from commit bcd8cd859e694bc4a4dfb6fdb8f55de3a96833b4)

14 months agonvmecontrol: Fix default ns create parameters.
Alexander Motin [Thu, 9 Mar 2023 15:19:00 +0000 (10:19 -0500)]
nvmecontrol: Fix default ns create parameters.

Instead of passing 0xff's for all unset parameters, prefer reasonable
defaults.  It is much easier to use it this was without specs in hand.

PR: 269912
(cherry picked from commit 20dc2c4d11ddaa980c491116b65c51ab522028e9)

14 months agoAdd NAMESPACE MANAGEMENT into admin_opcode[].
Alexander Motin [Wed, 8 Mar 2023 20:42:31 +0000 (15:42 -0500)]
Add NAMESPACE MANAGEMENT into admin_opcode[].

MFC after: 1 week

(cherry picked from commit 49ebbdb264fe185a685dce846985b95f28320e3f)

14 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

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

(cherry picked from commit 6dbfbe6e11a04f6e2ae893dbf46b059ab49eb517)

14 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
Differential Revision: https://reviews.freebsd.org/D38783

(cherry picked from commit b06338167d64507e79e003500002e22fbe583832)

14 months agoroute(8): Remove obsolete information
Warner Losh [Wed, 15 Dec 2021 23:06:19 +0000 (16:06 -0700)]
route(8): Remove obsolete information

xns and osi are no longer relevant (or supported) so remove their
vestiges.

Noticed by: phk
Sponsored by: Netflix

(cherry picked from commit c6b2efb64e279b4d543aaa10073c63765bf6e790)

14 months agoroute(8): Add an example how to print the routing tables
Gordon Bergling [Tue, 13 Apr 2021 04:44:04 +0000 (06:44 +0200)]
route(8): Add an example how to print the routing tables

The manual page currently doesn't show an example how to print
the routing table, so add one and .Xr netstat while here.

PR: 231579
Reported by: Pekka Järvinen <pekka dot jarvinen at gmail dot com>
Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D29702

(cherry picked from commit bc54f5f1cd5c01aa5f941234034839fb0b8f54ed)

14 months agorc.d: Generate machine-id from hostid_save
Tijl Coosemans [Wed, 15 Feb 2023 20:09:51 +0000 (21:09 +0100)]
rc.d: Generate machine-id from hostid_save

rc.d/hostid_save saves a UUID generated by rc.d/hostid in /etc/hostid.
Store the same UUID, without hyphens, in /etc/machine-id.  The hypĥens
are removed with a shell function because hostid_save runs before file
systems are mounted so other tools may not be available yet.

This eliminates some duplication between hostid and machine-id and for
virtual machines machine-id now contains the UUID configured in the
hypervisor like it does on Linux.

Reviewed by: delphij
Discussed with: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38811

(cherry picked from commit ecad3f5c4d922f93ceba455f8bff1c54e1ed4174)

14 months agohostid: Generate random UUID by default
Tijl Coosemans [Thu, 9 Mar 2023 09:02:45 +0000 (10:02 +0100)]
hostid: Generate random UUID by default

This way MAC addresses are no longer exposed.

Discussed with: bapt
MFC after: 3 days

(cherry picked from commit 862aab6281a5e6b5dad89761ac17ca2a0e83ab32)

14 months agoheimdal: Fix CVE-2022-4152, signature validation error
Cy Schubert [Fri, 10 Mar 2023 01:03:52 +0000 (17:03 -0800)]
heimdal: Fix CVE-2022-4152, signature validation error

When CVE-2022-3437 was fixed by changing memcmp to be a constant
time and the workaround for th e compiler was to add "!=0". However
the logic implmented was inverted resulting in CVE-2022-4152.

Reported by: Timothy E Zingelman <zingelman _AT_ fnal.gov>
Security: CVE-2022-4152
Security: https://www.cve.org/CVERecord?id=CVE-2022-45142
Security: https://nvd.nist.gov/vuln/detail/CVE-2022-45142
Security: https://security-tracker.debian.org/tracker/CVE-2022-45142
Security: https://bugs.gentoo.org/show_bug.cgi?id=CVE-2022-45142
Security: https://bugzilla.samba.org/show_bug.cgi?id=15296
Security: https://www.openwall.com/lists/oss-security/2023/02/08/1

(cherry picked from commit 5abaf0866445a61c11665fffc148ecd13a7bb9ac)

14 months agousb: Add HID_IGNORE quirk for APC Smart-UPS1000
Cy Schubert [Wed, 22 Feb 2023 02:38:16 +0000 (18:38 -0800)]
usb: Add HID_IGNORE quirk for APC Smart-UPS1000

Without the HID_IGNORE quirk enabled it will appear to be a uhid device.

PR: 269729

(cherry picked from commit 8866ea619a1f91616ba7e002a3ad10dfb10148c9)

14 months agousbdevs: Add APC Smart-UPS1000
Cy Schubert [Tue, 21 Feb 2023 21:10:35 +0000 (13:10 -0800)]
usbdevs: Add APC Smart-UPS1000

(cherry picked from commit 6f295aab8093e291d2166325e4627321953268c8)

14 months agousbdevs: Remove duplicate APC entries
Cy Schubert [Tue, 21 Feb 2023 21:08:08 +0000 (13:08 -0800)]
usbdevs: Remove duplicate APC entries

(cherry picked from commit b1723f48d8cdc9ac6fc3fc256b779b3c07827c0b)

14 months agolinux_80211: Don't dequeue lsta if not queued
Colin Percival [Sun, 5 Mar 2023 20:10:57 +0000 (12:10 -0800)]
linux_80211: Don't dequeue lsta if not queued

This fixes an instapanic when restarting wpa_supplicant on my laptop's
iwlwifi device.  After this change, iwlwifi enters a nonfunctional
state if wpa_supplicant is restarted, but "service netif restart wlan0"
is enough to get it working again.

releng/13.2 candidate.

Reviewed by: bz
MFC after: 3 days

(cherry picked from commit 3689f8aeab82150da6789be87b6c2f9385810c23)

14 months agobcm_dma: don't dereference NULL softc
Mitchell Horne [Fri, 24 Feb 2023 17:19:54 +0000 (13:19 -0400)]
bcm_dma: don't dereference NULL softc

This file defines a small API to be used by other drivers. If any of
these functions are called before the bcm_dma device has attached we
should handle the error gracefully. Fix a formatting quirk while here.

Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38756

(cherry picked from commit 07ccf71451d7377b1a6f3367f738ce7ddb1f2a24)

14 months agobcm_dma: attach at an earlier bus pass
Mark Millard [Fri, 17 Feb 2023 20:30:35 +0000 (16:30 -0400)]
bcm_dma: attach at an earlier bus pass

The sdhci_bcm driver attach routine relies on bcm_dma already being
attached, in order to allocate a DMA channel. However, both drivers
attached at the default pass so this is not guaranteed. Newer RPI
firmware exposes this assumption, and the result is a NULL-dereference
in bcm_dma_allocate().

To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma.

PR: 268835
Reviewed by: mhorne
MFC after: 1 week

(cherry picked from commit 9873b171697033f9f19608d98bcd1c16cacb92af)

14 months agolockmgr: upgrade panic return checks
Mitchell Horne [Wed, 22 Feb 2023 15:11:15 +0000 (11:11 -0400)]
lockmgr: upgrade panic return checks

We short-circuit lockmgr functions in the face of a kernel panic. Other
lock implementations do this with a SCHEDULER_STOPPED() check, which
covers the additional case where the debugger is active but the system
has not panicked. Update this code to match that behaviour.

Reviewed by: mjg, kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38655

(cherry picked from commit 9a7f7c26c5b280924072e2d9947ad39ef4cc022c)