jaildesc: remove desc from the sysctl parameter list
Like lastjid, desc should count as a pseudo-parameter. The difference
lies entirely in the security.jail.param sysctls, which list all of
the jail parameters. Since desc opens and returns a file descriptor,
it has no place in such uses as "jls all." Like lastjid, it's still
recognized by the kernel if passed in/out, and hard-coded into libjail
so it can be recognized there.
(cherry picked from commit e75dda31c1eead9ad40580bd8fec17f2bbf55a21)
jaildesc: add kevent support
Give jail descriptors the same kevent flags as jails. Also fix the
event reporting in jails, where it was including data for events the
user didn't ask for.
(cherry picked from commit 66d8ffe3046ded1eb3f78599c6af8eb965482ef5)
jail: simplify EVFILT_JAIL events
Instead of using the EVFILT_PROC model of attempting to automatically
register new events when a child jail is created, just give a single
event when a child jail is created. As was already done with jail
attach events, make a best-effort report of the added jail's id in
kn_data. If the are multiple NOTE_JAIL_CHILD and/or NOTE_JAIL_ATTACH
events, set the NOTE_JAIL_MULTI flag, and don't report anything in
data, indicating that the caller will need to query the system state
on their own.
(cherry picked from commit dbcaac13e49c88d1c077f34f56dd2b7ba77a145a)
iwlwifi: Don't compile for gcc before 14
gcc 13 and earlier don't have __builtin_bitcountg. The linux wifi kpi
uses this unconditionally. While in this one use, it might not be
needed, I opted to not compile iwlwifi when building gcc12 or 13 rather
than risk breaking it for everbody else.
With this change gcc12 builds the kernel. Maybe this will stop jenkins
email for every commit I make.
Sponsored by: Netflix
fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 test
The LastLocalModify tests were originally written to simulate a race
condition between VOP_SETATTR and VOP_LOOKUP. They were later extended
to cover some other VOPs that can affect file size, including VOP_WRITE.
However, the test never correctly simulated the race with VOP_WRITE. So
that test only ever passed by accident. Fix it by always opening the
file with O_DIRECT.
PR: 289237
Reported by: Siva Mahadevan <me at svmhdvn.name>
MFC after: 1 week
sys/power: Sleep type reporting by PM backends
Allow PM backends to report supported sleep types when registering
through `power_pm_register`. Expose this information through
`kern.power.supported_stype` sysctl, and set defaults for
`power_standby/suspend/hibernate_stype` based on this.
Implement this in ACPI PM backend.
Reviewed by: mckusick (mentor), markj
Approved by: mckusick (mentor), markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52044
acpi: Use sleep types defined in sys/power.h
This is as opposed to using ACPI sleep states (`ACPI_STATE_S*`). We now
use `POWER_STYPE_*` added in D52036.
This is in preparation for adding support for s2idle, which is not an
ACPI sleep state, but needs to be handled specially by
`acpi_EnterSleepState`.
Supersedes D48732.
Reviewed by: mckusick (mentor), markj
Approved by: mckusick (mentor), markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52043
sys/power: Generic sleep types
Pull out the sleep types (stype) from ACPI, as was previously being
done in D48732, and pass this sleep type to `power_pm_fn` instead of
passing the existing sleep state. This is a little awkward because we
already kinda have generic sleep states (`POWER_SLEEP_STATE_*`), but
these are not precise enough to build upon.
This revision also adds generic equivalents to `hw.acpi.suspend_state`
etc sysctls, e.g. `kern.power.suspend`.
Reviewed by: markj, mckusick (mentor)
Approved by: markj, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52036
dhclient: improve UDP checksum handling
When sending UDP packets:
* compute the checksum in the correct order. This only has an impact
if the length of the payload is odd.
* don't send packet with a checksum of zero, use 0xffff instead as
required.
When receiving UDP packets:
* don't do any computations when the checksum is zero.
* compute the checksum in the correct order. This only has an impact
if the length of the payload is odd.
* when computing the checksum, store the pseudo header checksum
* if the checksum is computed as zero, use 0xffff instead.
* also accept packets, when the checksum in the packet is the pseudo
header checksum.
The last point fixes a problem when the DHCP client runs in a VM,
the DHCP server runs on the host serving the VM and the network
interface supports transmit checksum offloading. Since dhclient
doesn't use UDP sockets but bpf devices to read the packets, the
[9 lines not shown]
dhclient: improve UDP checksum handling
When sending UDP packets:
* compute the checksum in the correct order. This only has an impact
if the length of the payload is odd.
* don't send packet with a checksum of zero, use 0xffff instead as
required.
When receiving UDP packets:
* don't do any computations when the checksum is zero.
* compute the checksum in the correct order. This only has an impact
if the length of the payload is odd.
* when computing the checksum, store the pseudo header checksum
* if the checksum is computed as zero, use 0xffff instead.
* also accept packets, when the checksum in the packet is the pseudo
header checksum.
The last point fixes a problem when the DHCP client runs in a VM,
the DHCP server runs on the host serving the VM and the network
interface supports transmit checksum offloading. Since dhclient
doesn't use UDP sockets but bpf devices to read the packets, the
[9 lines not shown]
vm_fault: assert that first_m is xbusy
There are several invariants, most important of which is prevention of
parallel faults handling, that depend on first_m being xbusy for the
duration of the page fault processing.
Suggested by: markj
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51474
vm_fault: try to only share-busy page for soft faults
If the fault handler found a vaild page that is definitely not going to be
renamed for COW, try to only sbusy the page. We do not need to validate
the page, and parallel faults on the same address are excluded by the
xbusy state of the page from the top object.
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51474
sys: add MBM device ioctl() values
This is part of the upcoming USB umb(4) work. It implements the control
ioctl(4)s that MBM devices will need to implement.
Differential Revision: https://reviews.freebsd.org/D48167
Approved by: adrian, zlei
Sponsored by: FreeBSD Foundation
PR: kern/263783
Submitted by: Pierre Pronchery <khorben at defora.org>
(cherry picked from commit e5f3620a3e12c0febab7e4125da526c59a5a195b)
vm_fault: add vm_fault_might_be_cow() helper
The helper checks that the object containing the fs->m page is not the
top object in the shadow chain.
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51474
mpi3mr: Get rid of a supurious printf
If we have outstanding tractions and then poll and still have
outstanding transactions, we print a warning. However, we print the
warning, confusingly, even if there's 0 left. Enclose the two statements
in {} to avoid this relatively harmless effect and quiet gcc12's
indentation complaint.
Sponsored by: Netflix
mpi3mr: Build with gcc12 by being more explicit about conditions
Help the flow analysis in gcc12 by initializing scsi_reply to NULL and
testing it along with sense_buf. Sense buf should be non-null only in
this code path, but might also be non-null if the PA for is somehow set
to zero. I debated adding an assert for the latter, but opted to instead
preserve existing behavior.
Also set host_diagnostic to 0. gcc12 can't quite realize that we only
test it after we've been through this loop at least once to report an
error condition. Initialize to 0 to avoid a diagnostic.
Sponsored by: Netflix
mpr3mr: Fix missing braces
We detect an error condiction and print it. And then unconditionally
jump to the err code, which is incorrect. It's clear from indentation
and code tracing there should be braces here.
Sponsored by: Netflix
iicbb: Fix gcc12 complaint
So gcc12 doesn't understand that t->udelay is >= 1, so thinks that noack
might be unset sometimes. While we specifically constrain this on direct
assignment, there's a sysctl that might not. This is likely also a bug.
Instead of uglifying everything by using MAX(1, sc->udelay), I rewrote
the for loop as a do-while loop (which arguably dictates intent better
because this code clearly assumes it will be executed once).
Sponsored by: Netflix
krb5: Enable PRINC_LOOK_AHEAD in ksu
PRINC_LOOK_AHEAD is the upstream default. Normally ksu determines the
target princiapl by (quoted from the man page)
a. default principal of the source cache
b. target_user at local_realm
c. source_user at local_realm
With PRINC_LOOK_AHEAD emabled, for each candidate in the above
list, select an authorized principal that has the same realm name
and first part of the principal name equal to the prefix of the
candidate. For example if candidate a) is jqpublic at ISI.EDU and
jqpublic/secure at ISI.EDU is authorized to access the target account
then the default principal is set to jqpublic/secure at ISI.EDU.
Case 2: source user is root.
[14 lines not shown]
Fix floaing point test.
I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be inserted here. It's not math, but a funky
notation.
Fixes: 9dd78db9c30a