Commit Graph

289586 Commits

Author SHA1 Message Date
Ed Maste
8d1348f55a path_test: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR:		277057
Fixes:		e5e1d9c7b7 ("path_test: Add a test case for...")
Sponsored by:	The FreeBSD Foundation
2024-02-15 08:58:39 -05:00
Philip Paeps
2911c44baf bsdinstall: remove two dead mirrors 2024-02-15 21:49:33 +08:00
Philip Paeps
9c59988175 bsdinstall: prefer HTTP
In 2024, users are more likely to have working HTTP than working FTP.
Present http://ftp.FreeBSD.org as the first option in the installer.
Keep ftp://ftp.FreeBSD.org as the second option.

MFC after:	3 weeks
2024-02-15 21:49:33 +08:00
Kajetan Staszkiewicz
50edc63071 pfsync: Fix offset calculation
Even though message version is automatically recognized and the top of
the struct is identical for different versions, when iterating over
multiple messages proper message length must be used. That's the length
of an union member for given version, not of the union itself.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D43862
2024-02-15 12:54:02 +01:00
Martin Matuska
e2257b3168 zfs: merge openzfs/zfs@e0bd8118d
Notable upstream pull request merges:
 #15469 cbe882298 Add slow disk diagnosis to ZED
 #15857 d0d273320 Update zfs-snapshot.8
 #15864 a5a725440 zfs list: add '-t fs' and '-t vol' options
 #15874 6cc93ccde BRT: Fix slop space calculation with block cloning
 #15882 a0635ae73 zdb: Fix false leak report for BRT objects

Obtained from:	OpenZFS
OpenZFS commit:	e0bd8118d0
2024-02-15 10:22:15 +01:00
Ed Maste
3733d82c4d libcasper: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR:		277057
Fixes:		faaf43b2a7 ("fileargs: add tests")
Sponsored by:	The FreeBSD Foundation
2024-02-14 22:33:24 -05:00
Tai-hwa Liang
25a5bb7318 net: bandaid for plugging a fw_com leak in fwip_detach()
Adding a temporary workaround for plugging a fw_com upon if_fwip unloading.

Steps to reproduce(needs two hosts connected with firewire):

  while true; do
    ifconfig fwip0 10.0.0.5 up
    fwcontrol -r
    ping -c 10.0.0.3
    kldunload if_fwip
  done

There's a chance that the unloading of if_fwip.ko triggers following warning:

	Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).

commit d79b6b8ec2 (origin/main, origin/HEAD)
2024-02-15 01:00:49 +00:00
Ed Maste
05f530f4d2 cat: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR:		277057
Reported by:	asomers, markj
2024-02-14 19:37:54 -05:00
John Baldwin
d79b6b8ec2 pci_host_generic: Don't rewrite resource start address for translation
Allocate resources from the parent device for decoded physical address
ranges.  When child resources suballocated from rman's are mapped,
translate those mapping requests into a mapping request of the
associated physical address range in a bus_map_resource method.

While here, convert generic_pcie_rman to a bus_get_rman method and use
bus_generic_rman_* for operations on child resources.

Factor out a generic_pcie_containing_range to share logic between
bus_translate_resource and bus_*map_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43894
2024-02-14 14:07:33 -08:00
John Baldwin
add99c9c4b physmem ram: Don't reserve excluded regions
These regions can conflict with I/O resources and prevent allocation
of those regions by other drivers.  It may make sense to reserve them
after the boot-time probe of devices has concluded (or after an
initial pass to reserve firmware-assigned resources before "wildcard"
resources are allocated), but that would require additional changes.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43893
2024-02-14 14:07:33 -08:00
John Baldwin
055c1fe230 acpi: Allow child drivers to use bus_set_resource for more resources
acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43892
2024-02-14 14:07:32 -08:00
John Baldwin
e05436d577 acpi: Don't assume a resource is reserved in acpi_delete_resource
This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43891
2024-02-14 14:07:32 -08:00
John Baldwin
51f8ac224f pci_host_generic: Include the bridge's device name in rman descriptions
The rman description strings now match those used in the PCI-PCI
bridge driver.  Using more specific names removes ambiguity in devinfo -u
output on systems with multiple host to PCI bridges.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43890
2024-02-14 14:07:32 -08:00
John Baldwin
eac46b9dd7 pci_host_generic: Remove unused res1 field from softc
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43889
2024-02-14 14:07:32 -08:00
John Baldwin
93923685d3 pci_host_generic_fdt: Remove duplicate DEVMETHOD entries
These are already inherited from generic_pcie_core_driver.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43888
2024-02-14 14:07:32 -08:00
John Baldwin
5bda26333a gpiobus: Use bus_generic_rman_*
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43887
2024-02-14 14:07:32 -08:00
Bjoern A. Zeeb
7061745867 LinuxKPI: sort dev_<loglevel>() functions
Sort the dev_<loglevel> functions by loglevel order, add the dev_alert()
version and an indentation change.

No functional changes.

MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D43719
2024-02-14 22:05:21 +00:00
Ed Maste
95ca89cda1 ctfmerge: demote "No ctf sections found" to a warning
If there are no CTF sections then ctfmerge just has nothing to do; it
should not be an error.

Note that ctfmerge has an option to require CTF:
     -t      Make sure that all object files have a CTF section.

Before this change, this option explicitly exited without error if none
of the object files have CTF sections, with the comment:

    If we're verifying that C files have CTF, it's safe to
    assume that in this case, we're building only from assembly
    inputs.

PR:		276930
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43878
2024-02-14 15:53:11 -05:00
Bjoern A. Zeeb
0936c648ad LinuxKPI: 802.11: update the ni/lsta reference cycle
Update the ni/lsta reference cycle, add extra checks and assertions.
This is to accomodate problems we were seeing based on net80211
behaviour (join1() and (*iv_update_bss)() as well as state changes for
new iv_bss nodes during an active session).
This should hopefully help to stabilise behaviour until the underlying
problems gets properly addressed (for this and all other device drivers).

PR:		272607, 273985, 274003
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43753
2024-02-14 19:48:04 +00:00
Bjoern A. Zeeb
2ac8a2189a LinuxKPI: 802.11: band-aid for invalid state changes after (*iv_update_bss)
With firmware based solutions we cannot just jump from an active session
to a new iv_bss node without tearing down state for the old and bringing
up the new node.  This likely used to work on softmac based cards/drivers
where one could essentially set the state and fire at will.

We track (*iv_update_bss) calls from net80211 and set a local flag that
we are out of synch and do not allow any further operations up the state
machine until we hit INIT or SCAN.  That means someone will take the state
down, clean up firmware state and then we can join again and build up
state.

Apparently this problem has been "known" for a while as native iwm(4) and
others have similar workarounds (though less strict) and can be equally
pestered into bad states.  For LinuxKPI all the KASSERTs just massively
brought this problem out.  The solution will be some rewrites in net80211.
Until then, try to keep us more stable at least and not die on second
join1() calls triggered by service netif start wlan0 and similar.

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (2023, partial)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43725
2024-02-14 19:47:53 +00:00
Bjoern A. Zeeb
713db49d06 net80211: deal with lost state transitions
Since 5efea30f03 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389
2024-02-14 19:47:21 +00:00
Bjoern A. Zeeb
df9d7d1e0e iwlwifi: improve error message
In case we cannot identify the firmware monitor buf_location,
print the type (usually 0 = invalid) so we have an idea at least
of what was set (or not).

MFC after:	3 days
2024-02-14 19:36:30 +00:00
Bjoern A. Zeeb
53eb2c63c9 LinuxKPI: 802.11: correct HT protection fields
It seems during the initial buildup of the file, the defines were
either mixed or not flagged as "FIXME".
Define the values through to the net80211 definitions and also
annotate them by at least some standards reference.

MFC after:	3 days
Fixes:		6b4cac814e
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43658
2024-02-14 19:36:30 +00:00
Bjoern A. Zeeb
48d689d6ca net80211: fix checks for (*iv_preamble_update)/(*iv_ht_protmode_update)
Both vap_update_preamble() and vap_update_ht_protmode() also check for
(*iv_erp_protmode_update)() rather than (*iv_preamble_update)()
or (*iv_ht_protmode_update)() before calling the later.
Use the appropriate NULL-function-pointer checks before calling it.

All seem unused currently so no functional changes expected.

MFC after:	3 days
Fixes:		f1481c8d3b
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43655
2024-02-14 19:36:29 +00:00
Warner Losh
a27c1350e4 loader: Make vidc_biosputchar static
It's currently unused outside of vidconsole.c. Gerald Hicks' fix to the
beep code from de37e4a6d2333/1998 introduced the funciton as
static. Maxim Sobolev (sobomax) made it non-static since his spinconsole
called it in c4c3b35172d67/2009. When sobomax dropped the direct call
after making spinconsole console independent in b35172d67/2017,
vidc_biosputchar remained a harmless unreferenced global. Make it static
once again.

Fixes:		c7e10205ae
Sponsored by:	Netflix
2024-02-14 11:22:57 -07:00
Warner Losh
62a52c1542 loader: export the CMD_ constants in loader table
Export the CMD_OK, etc constants in the loader table. They are the
return values of loader.perform, etc.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43821
2024-02-14 10:55:38 -07:00
Warner Losh
cd147a2a02 loader: Fetch initial script from loader_lua env
Sometimes it is nice to override the initial script that we run. Make it
possible by fetching loader_lua from the env and using that instead of
the default if prsent.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43819
2024-02-14 10:55:38 -07:00
Himanshu Chauhan
ee91dae43d riscv: Introduce support for APLIC interrupt controller
This patch introduces support for the RISC-V APLIC interrupt controller
[1]. Currently, it is only supports direct mode, i.e. without an IMSIC
and functionally replacing the legacy RISC-V PLIC. Work on IMSIC support
is in progress.

[1] https://github.com/riscv/riscv-aia/releases/tag/1.0

Reviewed by:	mhorne
Discussed with:	jrtc27
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43293
2024-02-14 11:42:29 -04:00
Mitchell Horne
3fb8f1272b riscv: add firmware partitions to GENERICSD.conf
Create two partitions in the existing space at the beginning of the
image (8MB). These are intended to hold u-boot SPL and u-boot proper.

The partition types selected are compatible with SiFive boards, e.g. the
HiFive Unmatched. They can easily be overridden for a platform that uses
the same scheme but different partition types, e.g. the StarFive
VisionFive v2. Firmware is not actually installed, this too is left for
the user.

It is not as simple to create the firmware partitions after the fact,
e.g. with partition indices 3 and 4. It is a shortcoming of current day
u-boot that the SPL loader looks for a specific partition index, rather
than the partition type, meaning that we will fail to boot if partition
2 doesn't contain u-boot.

Thus, our GENERICSD images become more generically usable with current
RISC-V hardware/firmware platforms.

Reviewed by:	manu, karels, imp
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43849
2024-02-14 11:16:54 -04:00
Mitchell Horne
2af03ebfb8 release: make SD card partition layout more flexible
Currently the partition layout is hardcoded to create an EFI/FAT
partition and a UFS root partition, with some logic to handle GPT/MBR
differences.

On RISC-V platforms we are seeing the emerging pattern that firmware
should be placed in a partition of a known type, rather than just a
known sector of the disk. Thus, some functionality is needed to
customize the layout for SD card images.

Add a hook, arm_create_partitions(), which can be overridden to insert
additional platform-specific partitions, possibly preceding the standard
EFI and UFS ones. A couple of new variables are added to track the
indices, e.g. ROOTFSPART_SUFFIX=p2.

In a couple places this de-duplicates the GPT/MBR logic.

Reviewed by:	manu, karels, imp
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43848
2024-02-14 11:16:54 -04:00
Mitchell Horne
94b86c12f1 release: de-duplicate arm.subr fstab logic
These days, the entries are the identical for GPT and MBR.

Reviewed by:	manu, karels, imp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D43847
2024-02-14 11:16:54 -04:00
Mark Johnston
f48cd806e0 build: Do not run ctfconvert on VDSO files
Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43877
2024-02-14 09:57:38 -05:00
Florian Walpen
2198221bd9
sched_setscheduler(2): Change realtime privilege check
Check for privilege PRIV_SCHED_SETPOLICY instead of PRIV_SCHED_SET, to
at least make it coherent with what is done at thread creation when
a realtime policy is requested, and have users authorized by
mac_priority(4) pass it.

This change is good enough in practice since it only allows 'root' (as
before) and mac_priority(4)'s authorized users in (the point of this
change), without other side effects.  More changes in this area, to
generally ensure that all privilege checks are consistent, are going to
come as olce's priority revamp project lands.

(olce: Expanded the explanations.)

PR:                     276962
Reported by:            jbeich
Reviewed by:            olce
Approved by:            emaste (mentor)
MFC after:              3 days
Differential Revision:  https://reviews.freebsd.org/D43835
2024-02-14 15:24:11 +01:00
Christopher Davidson
bbd29c4394 wlan(4) - remove an(4) reference
Fixes: 663b174b5b ("an: Remove driver")
Pull request: https://github.com/freebsd/freebsd-src/pull/1120
2024-02-14 09:11:00 -05:00
Richard Scheffenegger
fcea1cc971 tcp: fix RTO ssthresh for non-6675 pipe calculation
Follow up on D43768 to properly deal with the non-default
pipe calculation. When CC_RTO is processed, the timeout
will have already pulled back snd_nxt. Further, snd_fack
is not pulled along with snd_una.

Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D43876
2024-02-14 14:51:53 +01:00
Cy Schubert
b76ef9a7cb unbound: Vendor import 1.19.1
Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/

Security:	CVE-2023-50387, CVE-2023-50868
MFC after:	3 days
2024-02-13 21:05:50 -08:00
Cy Schubert
217a625642 unbound: Vendor import 1.19.1
Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/
2024-02-13 20:54:33 -08:00
Mark Johnston
53fba3b984 build: Default to DWARF4 in the kernel
gcc 12 defaults to emitting DWARF 5, but this is not yet supported by
our libdwarf and thus by ctfconvert.

Reviewed by:	emaste, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43837
2024-02-13 17:51:09 -05:00
Dag-Erling Smørgrav
46c599340f Update tzcode to 2024a.
MFC after:	3 weeks
Sponsored by:	Klara, Inc.
2024-02-13 21:31:41 +01:00
Alexander Motin
e0bd8118d0
Linux: Cleanup taskq threads spawn/exit
This changes taskq_thread_should_stop() to limit maximum exit rate
for idle threads to one per 5 seconds.  I believe the previous one
was broken, not allowing any thread exits for tasks arriving more
than one at a time and so completing while others are running.

Also while there:
 - Remove taskq_thread_spawn() calls on task allocation errors.
 - Remove extra taskq_thread_should_stop() call.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15873
2024-02-13 11:15:16 -08:00
Dag-Erling Smørgrav
378c74faf3 Import tzcode 2024a 2024-02-13 19:30:52 +01:00
Edward Tomasz Napierala
b4b61ead7e dot.profile: handle symlinked $HOME
Reapply 4cea05a273c875b5d5d4c41bfa6f2f0a60fa4a66:

    Make sh(1) recognize the default $HOME.  By default /home
    is a symlink; without this change, when you log in, sh(1)
    won't realize the current directory (eg '/usr/home/test')
    is the same as $HOME ('/home/test').

/home is no longer a symlink by default, but new users may be added on
systems that started out with an earlier version of FreeBSD (and still
have /home as a symlink) or admins may do so.

This test is not particularly expensive, so just restore it.

Suggested by:	danfe, brooks
2024-02-13 13:24:22 -05:00
Dan Kotowski
9cc816c255 Fix typo in da flags reporting
ANNOUCNED -> ANNOUNCED

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D41948
2024-02-13 10:44:59 -07:00
Chuck Silvers
fd24a63a38 x86/ucode: add const where appropriate
Sponsored by:   Netflix
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43865
2024-02-13 08:18:06 -08:00
Kyle Evans
c5796f1572 rtld: add some dlopen tests
dlopen_basic just tests that libthr.so can be dlopen()ed, which will
just serve as a sanity check that "libthr.so" is a thing that can be
dlopened in case we get a weird failure in dlopen_recursing.

dlopen_recursing tests a regression reported after the libsys split,
where some dlopen() may cause infinite recursion and a resulting crash.
This case is inspired by bdrewery's description of what seemed to be
causing his issue.

The corresponding fix landed in commit
968a18975a ("rtld: ignore load_filtees() calls if we already [...]")

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43859
2024-02-13 09:38:02 -06:00
Konstantin Belousov
968a18975a rtld: ignore load_filtees() calls if we already loading filtees for the obj
in addition to avoiding it for already loaded filtees. Issue is that
during load, rtld needs to resolve some special ABI symbols, like
executable stack fixer and static TLS initializer, which might trigger
recursion.

Example is libthr which is filter for libsys, and which exports
__pthread_distribute_static_tls.

Tested by:	kevans, krion
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43858
2024-02-13 16:24:01 +02:00
Konstantin Belousov
30b5f6b33b rtld load_filtees(): reindent and reduce block nesting
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43858
2024-02-13 16:23:55 +02:00
Konstantin Belousov
9ea864b54b rtld symlook_obj: move common code to check filtees into helper
Revieved by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43858
2024-02-13 16:23:41 +02:00
Andrew Turner
69e4b35eb3 arm: Add EARLY_PRINTF and SOCDEV_PA/VA to NOTES
This ensures they are build tested.

Sponsored by:   Arm Ltd
2024-02-13 11:48:53 +00:00
Andrew Turner
a9fc9d6d15 dev/uart: Support 8-byte register access
While we only support 4-byte registers in the uart code the physical
access may be to an 8-byte register. Support this as an option on
non-i386. On i386 we lack the needed 8-byte bus_space functions.

ACPI has an option for 8-byte register io width, and FDT can be given
any size. Support these sizes, even if we don't expect to see hardware
with an 8-byte io width.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43374
2024-02-13 11:48:53 +00:00