Commit Graph

296682 Commits

Author SHA1 Message Date
John Baldwin 3ddaf8200b Use bus_generic_detach instead of device_delete_children in detach
While here, check for errors from bus_generic_detach and move it to
the start of detach if necessary.

Differential Revision:	https://reviews.freebsd.org/D47969
2025-01-02 13:24:28 -05:00
John Baldwin 20f932af29 bhnd bcma/siba: Remove duplicate call to device_delete_children
bcma/siba_add_children already call device_delete_children if an error
occurs.

Differential Revision:	https://reviews.freebsd.org/D47968
2025-01-02 13:24:13 -05:00
John Baldwin 919f911ea4 siba: Use device_delete_children in siba_add_children
Differential Revision:	https://reviews.freebsd.org/D47967
2025-01-02 13:23:54 -05:00
John Baldwin 64d1a02e4e Check for errors from bus_generic_detach in various drivers
In some cases, move the call to bus_generic_detach earlier so that any
detach failures from child devices do not leave the parent device
partially detached.

Differential Revision:	https://reviews.freebsd.org/D47966
2025-01-02 13:23:41 -05:00
John Baldwin 6da28bb2a3 csa/emu10kx: Simplify deleting child devices
Use bus_generic_detach to detach and delete all child devices instead
of several explicit calls to device_delete_child.

Differential Revision:	https://reviews.freebsd.org/D47965
2025-01-02 13:23:28 -05:00
John Baldwin faf0bf43df cgem: Cleanup detaching of child miibus device
Move bus_generic_detach earlier in place of the existing
device_delete_child.

Differential Revision:	https://reviews.freebsd.org/D47964
2025-01-02 13:23:16 -05:00
John Baldwin e74465f177 cpsw: Remove duplicate call to bus_generic_detach
Differential Revision:	https://reviews.freebsd.org/D47963
2025-01-02 13:23:02 -05:00
John Baldwin 160179ea3e Remove now-redundant calls to device_delete_children
Earlier calls to bus_generic_detach now take care of deleting
children.

Differential Revision:	https://reviews.freebsd.org/D47962
2025-01-02 13:22:50 -05:00
John Baldwin 4e62c3cafa Remove now-redundant calls to device_delete_child
Deleting a child explicitly before calling bus_generic_detach is now
redundant, so remove those calls and rely on bus_generic_detach to
delete children instead.

Differential Revision:	https://reviews.freebsd.org/D47961
2025-01-02 13:22:35 -05:00
John Baldwin cf416f56eb Use the new bus_generic_detach directly in place of home-grown versions
Differential Revision:	https://reviews.freebsd.org/D47960
2025-01-02 13:22:20 -05:00
John Baldwin b196276c20 bus_generic_detach: Delete children after detaching them
This provides better semantics as a standalone DEVMETHOD for
device_attach as bus drivers should remove child devices they created
as part of detach cleanup.  The implementation calls
bus_detach_children() first to permit child devices an opportunity to
veto the detach operation.  If that succeeds, device_delete_children()
is used to delete the child devices.

This requires fixing various drivers that were deleting devices
explicitly (via a device_t pointer cached in the softc) after calling
bus_generic_detach to stop doing that and just rely on
bus_generic_detach to remove child devices.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47959
2025-01-02 13:21:30 -05:00
John Baldwin 28f5e880e8 Use device_delete_children instead of explicit calls to device_delete_child
This is simpler and more robust in the face of potential double-frees
(e.g. if called after bus_generic_detach which will delete devices in
a future commit).

Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D47958
2025-01-02 13:20:21 -05:00
John Baldwin e9d3857040 Use bus_detach_children instead of bus_generic_detach
These drivers perform additional teardown steps in between detaching
child devices and deleting child devices.

Differential Revision:	https://reviews.freebsd.org/D47957
2025-01-02 13:19:39 -05:00
Ruslan Bukin 9be0058ea0 riscv vmm: virtual timer support.
Add a virtual timer implementation based on SBI Time extension.
This is needed for Eswin EIC7700 SoC which does not include the newer SSTC
extension.

Timer interrupt pending bit (STIP) could not be cleared in the guest system,
so rework interrupts handling: add new "interrupts_pending" field. Use it
for timer interrupt only for now, but later we can extend to store all
pending interrupts (Timer, IPI and External).

With this I'm able to boot FreeBSD (SMP) guest on HiFive Premier P550,
which is the first real hardware with RISC-V 'H'-spec included.

Differential Revision: https://reviews.freebsd.org/D48133
2025-01-02 16:02:39 +00:00
Michael Tuexen 8471791eb6 TCP RACK: simplify condition
It is already known that rsm != NULL, so no need to check for it.

Reviewed by:		rrs
CID:			1523815
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48282
2025-01-02 16:19:30 +01:00
Michael Tuexen c7e81cc043 TCP BBR: do not log an uninitialized value
Reviewed by:		rrs
CID:			1523789
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48281
2025-01-02 16:17:05 +01:00
Leonid Evdokimov 0749d81343 pf tests: check cleared time when zeroing stats for table addresses
Verify that we reset the cleared time when we zero an address' counters in
a table.

PR:		282877, 282984
Reviewed by:	kp
MFC after:	2 weeks
Signed-off-by:	Leonid Evdokimov <leon@darkk.net.ru>
Differential Revision:	https://reviews.freebsd.org/D48242
2025-01-02 13:34:50 +01:00
Emmanuel Vadot b2d2a78ad8 Import device-tree files from Linux 6.12 2025-01-02 10:12:13 +01:00
Emmanuel Vadot cd989bfc73 Import device-tree files from Linux 6.12 2025-01-02 10:11:32 +01:00
Emmanuel Vadot 0e8011faf5 Import device-tree files from Linux 6.11 2025-01-02 10:10:48 +01:00
Emmanuel Vadot beb6e748a9 Import device-tree files from Linux 6.11 2025-01-02 10:10:08 +01:00
Emmanuel Vadot 7d0873ebb8 Import device-tree files from Linux 6.10 2025-01-02 10:09:19 +01:00
Emmanuel Vadot a809180891 Import device-tree files from Linux 6.10 2025-01-02 10:07:48 +01:00
Emmanuel Vadot 01950c46b8 Import device-tree files from Linux 6.9 2025-01-02 10:06:22 +01:00
Baptiste Daroussin 4087ffdbce nvi: import version 2.2.1-52c07e8 2025-01-02 10:04:12 +01:00
Baptiste Daroussin ae7f9696ae nvi: import version 2.2.1-52c07e8 2025-01-02 09:53:44 +01:00
Emmanuel Vadot e2e0a4ea3f Import device-tree files from Linux 6.9 2025-01-02 08:42:44 +01:00
Kyle Evans 2832af7b4e shar: add a note about the port to the deprecation warning
cy@ was kind enough to preemptively create a port from the version of
this script in base for those that need this exact interface; add a
pointer to it so that interested individuals could start installing it
sooner rather than later.

Noted by:	cy
MFC after:	3 days
2025-01-01 21:18:00 -06:00
Kyle Evans f68ee0e7a1 shar: add a deprecation notice
The shar(1) program is simple, but the fundamental idea of a sh archive
is risky at best and one that we probably shouldn't be promoting as
prominently as a program in $PATH and a manpage.  Let's deprecate and
remove it, since the same functionality can easily be found in
tar(1) instead.

Reviewed by:	emaste, philip
Reviewed by:	allanjude, brooks, delphij, des, imp, rpokala (previous)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D48130
2025-01-01 20:15:36 -06:00
Kyle Evans 3d0a0dda3a pkg: finish adding the ECC signer and signature type bits
Signature types need to be parsed out of the key/signature information
that we are presented with from the files we download.  We use that to
understand whicher signer we need to dispatch to.

The ECC signer is more-or-less lifted from pkg(8), with some changes to
slim it down for pkg(7).

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D48108
2025-01-01 15:11:24 -06:00
Kyle Evans 2e065d74a5 pkg: add a pkgsign_verify_data callback
This will be used to verify raw payloads, as if signed by pkg-key(8).
It will be used specifically in pkg(7) to verify .pubkeysig as published
by poudriere.

Amend verify_pubsignature() now to use it.  For the RSA signer, we need
to verify using a sha256 of the data instead of the data itself.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D48109
2025-01-01 15:11:23 -06:00
Kyle Evans 2ecfc040a0 pkg: refactor out a pkg_read_fd()
We already have to do this for reading the pubkey, just pull it out for
other uses.  The ECC signer will use this to verify the bootstrap if
the PUBKEY mechanism is used.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48107
2025-01-01 15:11:23 -06:00
Kyle Evans 5862580ded pkg: abstract rsa out behind a pkgsign API
This mirrors a change we made in pkg(8), and will be used to next add
another signer that does ECC.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48106
2025-01-01 15:11:23 -06:00
Kyle Evans 2629e90dd0 pkg: pull rsa bits out of pkg.c
We'll eventually add a pkgsign abstraction over these similar to how we do
in pkg(8), but start by isolating these parts.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48105
2025-01-01 15:11:22 -06:00
Kyle Evans 05427f4639 secure: hook up libecc as libpkgecc
libecc is not intended to be general use, other applications should
really be using openssl.  pkg(7) uses libecc to align with the pkg(8)
project and its goals.  This will be used in the upcoming support for
ECC in pkg(7).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D48117
2025-01-01 15:11:22 -06:00
Kyle Evans f0865ec990 Add 'crypto/libecc/' from commit '736d663976d1768533badbf06581481d01fade4c'
git-subtree-dir: crypto/libecc
git-subtree-mainline: f59bb61e1e
git-subtree-split: 736d663976
2025-01-01 15:11:18 -06:00
Kyle Evans f59bb61e1e lib: hook libder up to the build
libder will be used in upcoming ECC support in the pkg(7) bootstrap to
read DER-encoded keys and signatures.

Differential Revision:	https://reviews.freebsd.org/D48116
2025-01-01 15:11:06 -06:00
Kyle Evans 35c0a8c449 Add 'contrib/libder/' from commit '9c40c4de4c33b2ba1124fb752ebea0bebaa6013f'
git-subtree-dir: contrib/libder
git-subtree-mainline: d11904b350
git-subtree-split: 9c40c4de4c
2025-01-01 15:11:02 -06:00
Alan Somers d11904b350 Fix lib/libc/nss/getgr_test with large numbers of groups
These tests create a linked list with one entry for every group on the
running system.  On a system with about 30,000 groups, the test took 69
seconds to run, and crashed Kyua with the below error:

kyua: E: string or blob too big (sqlite op: sqlite3_bind_blob) (sqlite db: /root/.kyua/store/results.usr_tests.20241231-203317-570235.db).

Fix the test by limiting it to operating on the first 1024 groups.
Apply the same change to getpw_test and getserv_test too, which are
vulnerable to the same problem.

MFC after:	2 weeks
Sponsored by:	ConnectWise
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D48275
2025-01-01 13:23:47 -07:00
Michael Tuexen 3b9da3dcd1 TCP RACK: avoid using uninitialized tot_idle variable
Reviewed by:		rrs
CID:			1540027
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48277
2025-01-01 18:42:00 +01:00
Michael Tuexen 1781324db2 TCP BBR: remove code which is never executed
USEC_2_TICKS() returns at least 1.

Reviewed by:		rrs
CID:			1523775
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D4827
2025-01-01 18:39:23 +01:00
Juraj Lutter 4c0435d919 mac(4): Mention mac_do(4)
Mention also mac_do(4) in the mac(4) manual page.

Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D48255
2025-01-01 14:18:46 +01:00
Mark Johnston 4196f227aa libdtrace: Be less strict when comparing pointer types
If one of two pointers refers to a forward declaration, let the pointers
be compatible so long as the referred types have the same name.
Otherwise we can get spurious errors.

To give a specific example, this can happen when ipfw_nat.ko is loaded
before ipfw.ko and /usr/lib/dtrace/ipfw.d is processed.  Currently,
ipfw_nat.ko does not have a definition for struct inpcb (i.e., none of
its files include in_pcb.h), so in the CTF type graph, struct
ip_fw_args' "inp" member refers to a forward declaration, represented in
CTF with CTF_K_FORWARD.

Then, when libdtrace processes the ipfw_match_info_t translator in
ipfw.d, it decides that the "inp" field assignment is incorrect because
the two pointers are incompatible.  However, there's no harm in allowing
this assignment.  Add some logic to dt_node_is_ptrcompat() to detect
this case and declare the pointers as compatible so long as the name of
the thing they refer to is the same, similar to how any pointer is
compatible with a void *.

Reported by:	marck
Reviewed by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48254
2025-01-01 00:05:03 +00:00
Xin LI b55baa8139 copyright: Happy New Year 2025 2025-01-01 00:04:28 +00:00
Adrian Chadd cbc331d153 rtwn: fix builds on non-x86 platforms
The powerpcspe build is spitting out uint64_t != unsigned long, so this
fails.  Comment out the logging for now to unbreak the build.
2024-12-31 14:45:52 -08:00
Adrian Chadd aa17878371 rtwn: print out the firmware file being loaded
The firmware version isn't enough; different firmware is loaded
for different revisions of a given chip.  So print out the file too;
it'll make handling reports much easier.

Differential Revision:	https://reviews.freebsd.org/D48067
Reviewed by:	emaste
2024-12-31 13:58:17 -08:00
Michael Tuexen 5ec914e06c TCP BBR: fix condition when sending a tail loss probe
Reviewed by:		rrs
CID:			1523793
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48274
2024-12-31 22:03:13 +01:00
Michael Tuexen 0ce13b1d58 TCP RACK: add comment
Indicate that the missing of the break is intentionally.

Reviewed by:		rrs
CID:			1523782
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48273
2024-12-31 21:51:58 +01:00
Joseph Koshy aac74b708b libelftc: Fix a typo - FreeBSD's riscv port is little-endian.
This change brings the descriptor for target "elf64-riscv-freebsd"
in line with its documentation.

I missed this somehow when reviewing https://reviews.freebsd.org/D20768.

Reported by: Haowu Ge (on elftoolchain-developers)
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D48271
2024-12-31 19:53:05 +00:00
Adrian Chadd 06b7335701 rtwn: add rtwn_ctl_vhtrate(), some cleanups
* remove the hard-coded ridx values in rate2ridx(), use the RIDX
  defines for CCK/OFDM rates

* Add a placeholder rtwn_ctl_vhtrate() which returns the dot11rate
  control rate to use for the given VHT rate index.  Since net80211
  currently doesn't have any VHT PHY tables, there's no mapping for
  us to leverage so just return OFDM 12M for now.

* Use the new macro to convert rate index to MCS rate

* Add a printf() in rate2ridx if it's passed a HT/VHT rate.

Differential Revision:	https://reviews.freebsd.org/D48098
Reviewed by:	bz
2024-12-31 11:13:26 -08:00