cpucontrol: return selected revision from ucode_amd_find()
This fixes two printing bugs in cpucontrol(1). First, the utility will
now print "updating from rev X to rev Y", instead of incorrect "updating
to revision X", where X is actually the old revision. This also matches
what Intel updater prints. Second, the utility won't incorrectly warn
that the update failed after reading the new revision post update.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D52506
cpuctl: run amd_ucode_wrmsr only on one CPU and report if it failed
The CPUCTL_UPDATE is supposed to be applied only to the CPU the ioctl(2)
was performed on. This is true for Intel CPUs, but for AMD the SMP
rendezvouz of amd_ucode_wrmsr() effectively executed it on all CPUs.
Also, the update failure was not reported.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D52466
ufshci: revisit controller reset path and add I/O timeout handling
This patch revisits the controller reset path and introduces timeout
handling for I/O commands.
To support controller reset during driver operation, the controller’s
construct, destruct, enable, and disable functions are clearly
separated in ufshci_ctrlr.c. ufshci_ctrlr_hw_reset() function is
added to leverage enable/disable.
After initialization, ufshci_ctrlr_reset_task() is also introduced to
ensure controller resets are performed via the task queue.
Timeout handling is designed in five steps. This patch implements
Step 1 and Step 5, while the remaining steps will be added later.
The timeout mechanism follows the same shared timeout model used in
the NVMe driver.
Test: Intentionally delayed UPIU I/O in QEMU to trigger a timeout and
[5 lines not shown]
committers-src: add myself (jaeyoon@)
Add myself (jaeyoon@) as a new src committer with imp@ as my mentor.
Reviewed by: imp (mentor)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D52570
atf_pytest: fix xfail detection from pytest report
The location of the 'wasxfail' attribute was moved from
the 'reason' attribute back to the parent 'report'. This
fixes an issue where xfails are wrongly reported to ATF
as skipped tests.
Signed-off-by: Siva Mahadevan <me at svmhdvn.name>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1849
Sponsored by: The FreeBSD Foundation
udbc: Add usb debug host mode driver
xhci offers a debugging interface which uses a special usb 3 cable with the D+,
D- and VBUS pairs disconnected. This interface allows a target device to
configure its xhci controller as a debugging channel which can then be used to
provide a serial link between the target and a debug host.
This change extracts the udbc host mode driver from hrs@'s xhci debug
implementation.
Reviewed by: bcr (man page)
MFC after: Before 15-ALPHA3 builds
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51299
(cherry picked from commit d566b6a70bcbc329e8c690464043401fa8bdd49f)
libc: fix the _FORTIFY_SOURCE build of getgrouplist(3)
We need <unistd.h> to get our prototype normally, but WARNS in libc is
way too low to surface that.
Additionally, _FORTIFY_SOURCE needs to include <ssp/unistd.h> by way of
<unistd.h> to actually export an implementation of getgrouplist(3). The
version defined in the .c gets named __ssp_real_getgrouplist() and the
actual implementation comes from the redirect stub in <ssp/unistd.h>,
which basically gets optimized away in the built object because our
__builtin_object_size() check is trivially false when we cannot resolve
any object sizes in this translation unit.
This could be argued as a design flaw in _FORTIFY_SOURCE, but we should
grab <unistd.h> for our prototype anyways so let's kick the can down
the road instead of re-thinking it for 15.0.
Reported by: Shawn Webb (HardenedBSD)
Fixes: d3f8ed6066 ("getgrouplist(3): Remove superfluous [...]")
[7 lines not shown]
hwpmc: On attach, fix allowing a PMC's owner to attach it to itself
The returned value in this case was wrong, and would basically prevent
some PMC's owner process to attach that PMC to itself although the
security checks underneath would have allowed it.
Now that this early return has been fixed, its block basically becomes
a performance short-circuit which has no effect from a functional
standpoint.
Fixes: ebccf1e3a6b1 ("Bring a working snapshot of hwpmc(4), ...")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1c40b15971f09c0c0676ae476b88b32166eae8ac)
hwpmc: On attach, ensure owner is a target effective GID's member
This restores a check that existed prior to commit be1f7435ef218b1d
("kern: start tracking cr_gid outside of cr_groups[]").
While here, improve pmc_can_attach()'s style by changing the type of
'decline_attach' to 'bool', fixing tests on it, adding missing
parentheses to 'return' statements, and by changing its return value
type to 'bool'.
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52252
(cherry picked from commit 1c3c698ba4c40485ebbbd157cb49172cfa7de9b2)
MFC to 14 does not fix any bug, but just applies some style changes
needed by next MFC.
[6 lines not shown]
sdp(3): Change bdaddr parameter type in sdp_register_service()
Fixes compiler error when the caller passes a const bdaddr_t *
paramemeter (e.g., NG_HCI_BDADDR_ANY).
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D52582
(cherry picked from commit 3d14cc82d7a8c11cd164a6ba668d20b939c576fe)
ng_btsocket_rfcomm: Mark a couple buffers as const in a helper function
Fixes: 680f9acc3657 ("ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *")
(cherry picked from commit 18fd3f8ec5c50da21515757af24421a078a4a468)
ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *
This is needed to address some compiler errors cleanly, where consumer
functions want this address to be a const pointer.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D52310
(cherry picked from commit 680f9acc3657efcea07d8ac0954645b6eaf8dac8)
sdp(3): Change bdaddr parameter type in sdp_register_service()
Fixes compiler error when the caller passes a const bdaddr_t *
paramemeter (e.g., NG_HCI_BDADDR_ANY).
Sponsored by: The FreeBSD Foundation
MFC after: 1 day
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D52582
(cherry picked from commit 3d14cc82d7a8c11cd164a6ba668d20b939c576fe)
ng_btsocket_rfcomm: Mark a couple buffers as const in a helper function
Fixes: 680f9acc3657 ("ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *")
(cherry picked from commit 18fd3f8ec5c50da21515757af24421a078a4a468)
ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *
This is needed to address some compiler errors cleanly, where consumer
functions want this address to be a const pointer.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D52310
(cherry picked from commit 680f9acc3657efcea07d8ac0954645b6eaf8dac8)
packages: Add a mandoc package
Move mandoc to its own package so users can install it independently of
-utilities. Put the package in the minimal set, since we also ship
manpages in minimal and "man" is a basic Unix utility.
Add a pkg-triggers(5) hook to run makewhatis when new manpages are
installed, so that apropos(1) works. This depends on a new pkg(8)
feature expected to be in in the upcoming 2.3.2 release; in the mean
time, this is a no-op (i.e., having an older pkg doesn't break anything,
it just won't run the trigger).
MFC after: 3 seconds
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D52564
packages: Remove the tests-dev package
We don't want a tests-dev package, because this means set-devel depends
on tests-dev, which transitively depends on tests, which means you can't
install set-devel without also getting tests.
The only real "dev" files in tests-dev are from ATF (libprivateatf),
so move that to its own package and add a dependency from tests.
Also move Kyua to its own package, since this might be useful for
running tests even when the user doesn't want the whole set of base
tests installed.
Add a dependency from -tests to both -atf and -kyua, and a dependency
on -set-base, since the tests won't work without the full base system
installed.
The remaining "dev" files in tests are actually test artifacts, not real
development libraries. Add a new NO_DEV_PACKAGE option to bsd.lib.mk,
[10 lines not shown]
libc: fix the _FORTIFY_SOURCE build of getgrouplist(3)
We need <unistd.h> to get our prototype normally, but WARNS in libc is
way too low to surface that.
Additionally, _FORTIFY_SOURCE needs to include <ssp/unistd.h> by way of
<unistd.h> to actually export an implementation of getgrouplist(3). The
version defined in the .c gets named __ssp_real_getgrouplist() and the
actual implementation comes from the redirect stub in <ssp/unistd.h>,
which basically gets optimized away in the built object because our
__builtin_object_size() check is trivially false when we cannot resolve
any object sizes in this translation unit.
This could be argued as a design flaw in _FORTIFY_SOURCE, but we should
grab <unistd.h> for our prototype anyways so let's kick the can down
the road instead of re-thinking it for 15.0.
Reported by: Shawn Webb (HardenedBSD)
Fixes: d3f8ed6066 ("getgrouplist(3): Remove superfluous [...]")
[3 lines not shown]
'kern.proc.groups' sysctl knob: Restore outputting the effective GID
In particular, fixes 'procstat -s' on a live system (for processes with
more than 16 groups).
Reviewed by: kib, emaste
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52261
(cherry picked from commit faf7e99375910fadb1b409a756be5477b561a517)
jail.2: Mention EPERM is returned on open directories
The manual page does not directly mention this reason for getting EPERM,
instead referring the reader to chroot(2). We have had some questions
about it recently, in part due to a bug (fixed), and this case is not an
obvious permission/problem, so let's be more explicit.
PR: 280809
Reviewed by: jamie
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52319
(cherry picked from commit ef2f36be8fce8cf7a62ce7d33ab1c4a181fac3e2)
kvm_proclist(): Restore outputting the effective GID
In particular, fixes 'procstat -s -M' (only if there are less than 16
groups).
Reviewed by: kib, emaste
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52260
(cherry picked from commit 7676df2faeb6dcbf20456574dcd2a7f4ab8fff8a)
kinfo_proc: Restore outputting the effective GID
In particular, fixes 'procstat -s' on a live system or a core file (only
if there are less than 16 groups).
Reviewed by: kib
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52259
(cherry picked from commit 63a40ca813a9995e8e2dee0142297d9c38106c05)
imgact_elf: procstat groups: Restore sending the effective GID
Fixes 'procstat -s' run on a core file when the number of groups in
effect at the moment of core dump exceeds KI_NGROUPS (16).
Reviewed by: kib
Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after: 9 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52258
(cherry picked from commit 5568b4441dff078733a76835312a6ce1ccb50a17)