iwx: unbreak monitor mode support
A bunch of changes that turns it into a working mode (at least for me)
1) Call iwx_auth instead of iwx_run on -> RUN transition in monitor mode.
That's how it is intended to work because we never transition to the
AUTH state in this mode and current implementation of iwx_run just
results in endless 'firmware error' -> 'restart' loop.
2) Use ic_curchan instead of ic_bsschan while initializing NIC state;
the last one contains ANYC channel in monitor mode.
3) Do not print 'input_all returned -1' message - ieee80211_input_mimo_all
always returns -1 in monitor mode.
4) Always set IEEE80211_RADIOTAP_F_FCS in radiotap flags while in monitor mode.
While header documentation states it is controlled by IWX_MAC_FILTER_IN_CRC32
flag in practice IWX_MAC_FILTER_IN_PROMISC appends it as well - and it is
required since this is the only flag that allows to receive data and
control frames. While it alone is enough I left other flags in place for
smaller diff with other drivers.
[6 lines not shown]
organization.dot: update clusteradm
I checked with zi@ and others in clusteradm.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D61816
organization.dot: update core secretary
I'm it for the time being.
Reviewed by: jrm, olivier, imp, glebius
Differential Revision: https://reviews.freebsd.org/D61815
organization.dot: update bugmeister
checked in with linimon@ about what this should say.
Reviewed by: ziaee
Differential Revision: https://reviews.freebsd.org/D61814
powerpc: fix the VSCR save and restore on little endian
VSCR was saved and restored through stvewx/lvewx at byte 12 of a
16 byte slot. Which element those instructions move at a given address
depends on the byte order, so on little-endian kernels they touched VR
bits 0-31 instead of the 96-127 where mfvscr/mtvscr keep VSCR: every
context switch and signal reset VSCR to 0, losing NJ and SAT.
Replicate the word into all four elements first so that the element
choice no longer matters.
VSCR[NJ] set with mtvscr read back as 0 after a usleep on a
little-endian kernel; it is preserved now.
Reviewed by: adrian, jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61525
(cherry picked from commit 27b4bb447eababd60da777065a813d2379050850)
powerpc: don't drop FPU and VMX ownership in grab_mcontext()
grab_mcontext() saved the FP and vector registers with save_fpu() and
save_vec(), which drop ownership: PCPU(fputhread) becomes NULL while
PCB_FPU stays set and the thread keeps using the unit. A later
cpu_update_pcb(), at fork(2) or thr_new(2), then skipped the save,
since save_fpu_nodrop() only saves for the thread that owns the unit,
and the child got the registers as they were at the getcontext() or
signal rather than at the fork. Use the nodrop variants.
A child forked after getcontext() saw the parent's f14 as it was at
the getcontext(); it sees the current value now.
Reviewed by: adrian, jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60837
(cherry picked from commit 8a79b6398f06f31947a2dada576c5f489c69d498)
powerpc64: don't reserve the red zone on the alternate signal stack
A 64-bit signal frame is 1552 bytes; rounded up and with the 512 byte
red zone added it needs 2096 bytes, more than MINSIGSTKSZ (2048), so a
handler on a minimum size alternate stack had its frame start 48 bytes
below the stack. The red zone only exists below the interrupted code's
stack pointer, so skip it only when the frame goes on that stack.
A handler on a MINSIGSTKSZ alternate stack overwrote the 48 bytes below
it; the frame stays within the stack now.
Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61519
(cherry picked from commit 34005cb7d5caeee3f3073cbc2adc3b2841ef54d7)
libthr: Enable the thread name test
Adapt NetBSD's thread naming tests to run it on FreeBSD.
Account for differences in `pthread_setname_np()` and the absence
of thread naming attributes on FreeBSD.
MFC after: 1 week
Reviewed by: ngie, kib
Differential Revision: https://reviews.freebsd.org/D61609
arm64/pmap: Fix invalidate_icache condition in stage2 fault
pmap_stage2_fault is supposed to invalidate the icache if it is
accessing an executable page. Instead, the condition currently checks
whether execution is disallowed at any EL. Make it check whether
execution is allowed at any EL to match the intended behaviour.
Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
Reviewed by: andrew
Sponsored by: Arm Ltd
Pull Request: https://github.com/freebsd/freebsd-src/pull/2416
(cherry picked from commit 728d9f322935905c09236e8312b3268b6ff8691b)
amd64/arm64 pmap: Remove KASSERTs that can never fail
In pmap_enter_largepage(), arm64's L1 block case twice asserts that
pmap_l0_to_l1() didn't return NULL, and amd64's 1G case asserts that
pmap_pml4e_to_pdpe() didn't. Neither function ever returns NULL, so
these assertions can never fail.
shm: Fix a shm object refcount leak in shm_rename(SHM_RENAME_EXCHANGE)
With RENAME_EXCHANGE we acquire an extra ref on the destination object
so that shm_remove() doesn't free it. However, we failed to release
that ref if the rename fails.
Reported by: Laam Alif at Ibteda Digital Library
Fixes: 9afb12bab41f ("Add an shm_rename syscall")
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61806
vm_object: Fix synchronization between reinit and global list walks
Checking for OBJT_DEAD in vm_object_list_handler() is racy since pagers
may set the object type to OBJT_DEAD after having dropped and reacquired
the object lock. dev_pager_dealloc() does this, for instance. Check
for the OBJ_DEAD flag as well, as that is set earlier. Fix one rare
case in the vnode pager where we freed an object without setting
OBJ_DEAD, and add an assertion to the zone destructor.
Try to minimize accesses of the object after dropping the object lock in
vm_object_list_handler().
Add a comment to warn others to think carefully before adding more
cases.
Fix shm_get_path() to reject dead objects. Fix tmpfs to finish
initialization of the object under its lock; we cannot claim that the
object is thread-private since it lives on a global list.
Try to close races with _vm_object_allocate(). Update object->flags,
[20 lines not shown]
linux: Pass a valid thread pointer to linux_msg()
linux_msg() will dereference that pointer if a debugging flag is set.
Reported by: Tianyi Chen <hi at tychen.cc>
Fixes: 3965de642c29 ("linux: Add inotify support")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
freebsd32: Fix the ffclock estimate conversions
The CP() arguments were reversed in both directions, so
ffclock_getestimate() copied out uninitialized stack memory and
ffclock_setestimate() installed it as the system estimate.
Add helper functions to do the conversion, implemented so as to make
such mistakes harder to make.
Fixes: e3e811a3f824 ("freebsd32: add feed foward clock syscalls")
Reviewed by: brooks
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61774
arm64 pmap: Sync the icache in pmap_enter_largepage()
Unlike pmap_enter(), don't test PGA_ICACHE_SYNCED, because large pages
are unmanaged.
While here, assert that va is aligned to the page size, as amd64 does,
and that the pmap is stage 1, which the new code assumes.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D61897
libc/fnmatch/rangematch: fix incorrect arguments to memset
strmbs variable is already a pointer, so calling memset on its address
was equivalent to setting the pointer, but the intent was to set the
pointed object.
This was found while debugging an unrelated issue in the same function.
Fixes: af79566b9315
MFC after: 1 week
libc/fnmatch/rangematch: fix uninitialized variable read in a condition
The condition was logically incorrect and could also result in access to
an uninitialized variable. The bug happened because of misplaced
parentheses in the complex condition. There is another very similar
condition in the code and it has the correct placement, so it does not
have the bug. I used it as an example for the fix. Both conditions
came from the same commit af79566b9315.
For me, the bug appeared as a random failure to match a simple pattern
with '[0-9]' in it. The value of the uninitialized variable depended on
the value left on the stack by other code, so the bug appeared only
under very specific conditions.
FWIW, gcc catches and reports the uninitialized variable problem.
clang does it only with -Wconditional-uninitialized but that flag leads
to too many false positives.
I also found a pattern that deterministically reveals the bug in a
[14 lines not shown]
hwpmc: claim stray PMI NMIs on Intel
core2_intr() claims an NMI only when IA_GLOBAL_STATUS shows an
overflow. It re-enables the LAPIC PMC vector before acking the
status bits, so a PMI raised while the handler runs can latch a
second NMI that finds the status already clear. That NMI goes
unclaimed and, with the default machdep.panic_on_nmi, panics the
machine. hwpmc_amd.c already absorbs such NMIs with a per-CPU
nmi_counter.
Give core2_intr() one credit per serviced PMI and spend it on the
next NMI on that CPU that finds no overflow.
Reproduced on a Xeon D-1518 (Broadwell-DE) running system-wide
CPU_CYCLES sampling: the unpatched kernel panicked with "NMI" after
about 47k PMIs. With this change it ran 12.5 hours (485k PMIs),
absorbed 6 empty NMIs, and did not panic.
Sponsored by: Netflix
[2 lines not shown]
powerpc: fix the VSCR save and restore on little endian
VSCR was saved and restored through stvewx/lvewx at byte 12 of a
16 byte slot. Which element those instructions move at a given address
depends on the byte order, so on little-endian kernels they touched VR
bits 0-31 instead of the 96-127 where mfvscr/mtvscr keep VSCR: every
context switch and signal reset VSCR to 0, losing NJ and SAT.
Replicate the word into all four elements first so that the element
choice no longer matters.
VSCR[NJ] set with mtvscr read back as 0 after a usleep on a
little-endian kernel; it is preserved now.
Reviewed by: adrian, jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61525
(cherry picked from commit 27b4bb447eababd60da777065a813d2379050850)
powerpc64: don't reserve the red zone on the alternate signal stack
A 64-bit signal frame is 1552 bytes; rounded up and with the 512 byte
red zone added it needs 2096 bytes, more than MINSIGSTKSZ (2048), so a
handler on a minimum size alternate stack had its frame start 48 bytes
below the stack. The red zone only exists below the interrupted code's
stack pointer, so skip it only when the frame goes on that stack.
A handler on a MINSIGSTKSZ alternate stack overwrote the 48 bytes below
it; the frame stays within the stack now.
Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61519
(cherry picked from commit 34005cb7d5caeee3f3073cbc2adc3b2841ef54d7)
powerpc: don't drop FPU and VMX ownership in grab_mcontext()
grab_mcontext() saved the FP and vector registers with save_fpu() and
save_vec(), which drop ownership: PCPU(fputhread) becomes NULL while
PCB_FPU stays set and the thread keeps using the unit. A later
cpu_update_pcb(), at fork(2) or thr_new(2), then skipped the save,
since save_fpu_nodrop() only saves for the thread that owns the unit,
and the child got the registers as they were at the getcontext() or
signal rather than at the fork. Use the nodrop variants.
A child forked after getcontext() saw the parent's f14 as it was at
the getcontext(); it sees the current value now.
Reviewed by: adrian, jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60837
(cherry picked from commit 8a79b6398f06f31947a2dada576c5f489c69d498)
x86: Do not take a CPUID leaf 1Fh module for the package
Each level of CPUID leaf 0Bh or 1Fh reports the shift that addresses
the next level up. Leaf 0Bh has only the SMT and core levels, so the
core level's shift identifies the package. Leaf 1Fh may enumerate
module, tile, die and die group levels above the core level, and then
the core level's shift identifies one of those instead.
topo_probe_intel_0xb() used the core level's shift for the package in
both cases. On a processor that enumerates a module level, every
module became a package, and the L3 cache was cut down to the module
with "WARNING: L3 data cache covers more APIC IDs than a package", so
the scheduler did not see that the modules share it. An Atom x7809C
(Amston Lake), which reports shifts of 1, 3 and 7 for its SMT, core and
module levels, came up as two packages of four cores. The N150 (Twin
Lake) in the PR is affected in the same way.
Use the shift of the last level enumerated for the package. The SDM
describes the package as the unenumerated domain above the last valid
[24 lines not shown]