summaryrefslogtreecommitdiff
path: root/sys
AgeCommit message (Collapse)Author
2022-02-15consistently use __linux__Jonathan Gray
2022-02-15Use knote_modify_fn() and knote_process_fn() in bpf.Visa Hankala
OK dlg@
2022-02-15only tweak ifp if_flags while holding NET_LOCK.David Gwynne
tun_dev_open and tun_dev_close were being optmistic.
2022-02-15make tun_link_state take the ifnet pointer instead of tun_softc.David Gwynne
it only works on struct ifnet data, so passing ifp makes it clearer what's actually being manipulated. also fix tun_dev_open so tun_link_state is called before if_put instead of immediately after.
2022-02-15unifdef TIOCHPCL, 4.3BSD compat ioctlJonathan Gray
ok deraadt@ guenther@
2022-02-15remove unused and uneeded bits in a byte defineJonathan Gray
posix requires a byte to be 8 bits
2022-02-15MI disable_lid_wakeups() is not needed, x86 systems can do thisTheo de Raadt
in sleep_resume(), which seems sensible for other future systems also
2022-02-15The DVACT_POWERDOWN step was accidentally moved in relation to some MDTheo de Raadt
steps, so shuffle the MD steps to reinforce the order.
2022-02-15fix mask in hppa inst_trap_return()Jonathan Gray
inst_trap_return() was checking for rfir by masking with 0xfc001fc0 which made it impossible to match rfir (0xca0) rfi: return from interruption 00 rv rv rv 60 0 6 5 5 3 8 5 rfir: return from interruption and restore 00 rv rv rv 65 0 6 5 5 3 8 5 from "PA-RISC 1.1 Architecture and Instruction Set Reference Manual" where rv indicates reserved bits change the mask to only mask out reserved bits and check for rfi in addition to rfir ok miod@
2022-02-14Make sure we call acpi_resume_cpu() with the right ACPI state. This wasMark Kettenis
accidentally broken with the reorganization of the suspend/resume code that was committed a few days ago. ok deraadt@
2022-02-14don't deref pointer before test it is safeJonathan Gray
ok miod@
2022-02-14fix cmalo_media_change() testJonathan Gray
ok claudio@ deraadt@
2022-02-14Unwire with map lock heldKlemens Nanni
This is an updated version of uvm_map.c r1.283 "Unwire with map lock held". The previous version introduced a use-after-free by not unlocking vm_map locks in uvm_map_teardown(), resulting in dangling references on the reaper's lock list (thanks visa!). Lock and unlock the map in around uvm_map_teardown() instead. This code path holds the last reference, hence the lock isn't strictly needed except for satisfying upcoming locking assertions. Tested on amd64, arm64, i386, macppc, octeon, sparc64. This time also with WITNESS enabled (except on sparc64 which builds but does not boot with WITNESS; this is a known issue). OK mpi visa
2022-02-14acpi_indicator() can take the softc*, instead of void*Theo de Raadt
2022-02-14Revert change to ps for displaying chrooted process.Rob Pierce
Ok deraadt
2022-02-14Use iic_is_compatible(9) and use the more generic compatible string toMark Kettenis
match the device. ok visa@
2022-02-14Pass the entire compatible property for devices attaching to the iic(4) bus.Mark Kettenis
ok visa@
2022-02-14Delete incomplete implementation of bus_space_{alloc,free} in bus.h.Kenji Aoyama
This prevents errors on luna88k in src/usr.sbin/fw_update/pattern.c which includes dev/pci/pcivar.h, which includes machine/bus.h. Suggested by miod@
2022-02-14OF_getproplen() returns -1 on error, so don't store result in size_tJonathan Gray
spotted by and ok tb@, ok tobhe@
2022-02-14Introduce a signal context that is used to pass signal related informationClaudio Jeker
from cursig() to postsig() or the caller itself. This will simplify locking. Also alter sigactsfree() a bit and move it into process_zap() so ps_sigacts is always a valid pointer. OK semarie@
2022-02-14reprint device name in attach error paths if neededJonathan Gray
2022-02-14check return value of drm_attach_pci()Jonathan Gray
adapted from a diff by Ted Bullock
2022-02-14remove unused codeJonathan Gray
2022-02-14no need for ifndef __sparc64__Jonathan Gray
from Ted Bullock who tested on sparc64 with xvr-100
2022-02-14update sbchecklowmem() to better detect actual mbuf memory usage.David Gwynne
previously sbchecklowmem() (and sonewconn()) would look at the mbuf and mbuf cluster pools to see if they were approaching their hard limits. based on how many mbufs/clusters were allocated against the limits, socket operations would start to fail with ENOBUFS until utilisation went down. mbufs and clusters have changed a lot since then though. there are now many mbuf cluster pools, not just one for 2k clusters. because of this the mbuf layer now limits the amount of memory all the mbuf pools can allocate backend pages from rather than limit the individual pools. this means sbchecklowmem() ends up looking at the default pool hard limit, which is UINT_MAX, which in turn means means sbchecklowmem() probably never applies backpressure. this is made worse on multiprocessor systems where per cpu caches of mbuf and cluster pool items are enabled because the number of in use pool items is distorted by the cpu caches. this switches sbchecklowmem to looking at the page allocations made by all the pools instead. the big benefit of this is that the page allocations are much more representative of the overall mbuf memory usage in the system. the downside is is that the backend page allocation accounting does not see idle memory held by pools. pools cannot release partially free pages to the page backend (obviously), and pools cache idle items to avoid thrashing on the backend page allocator. this means the page allocation level is higher than the memory used by actual in-flight mbufs. however, this can also be a benefit. the backend page allocation is a kind of smoothed out "trend" line. mbuf utilisation over short periods can be extremely bursty because of things like rx ring dequeue and fill cycles, or large socket sends. if you're trying to grow socket buffers while these things are happening, luck becomes an important factor in whether it will work or not. because pools cache idle items, the backend page utilisation better represents the overall trend of activity in the system and will give more consistent behaviour here. this diff is deliberately simple. we're basically going from "no limits" to "some sort of limit" for sockets again, so keeping the code simple means it should be easy to understand and tweak in the future. ok djm@ visa@ claudio@
2022-02-14change a NULL pa_memex test after use to an earlier KASSERTJonathan Gray
from Ted Bullock
2022-02-14test the correct pointer for acpi_intr_establish() resultJonathan Gray
ok deraadt@ gnezdo@
2022-02-14OF_getproplen() returns -1 on error, so don't store result in size_tJonathan Gray
ok kettenis@
2022-02-13The length value in bpf_movein() is casted to from size_t to u_intAlexander Bluhm
and then rounded before checking. Put the same check before the calculations to avoid overflow. Reported-by: syzbot+6f29d23eca959c5a9705@syzkaller.appspotmail.com OK claudio@
2022-02-13remove stray tab whitespace. no code change.Mike Larkin
2022-02-13Fix return value check of OF_getproplen(). If "reset-gpios" is not foundTobias Heider
in the device tree -1 is returned, causing a panic in the following malloc call. ok kn@ patrick@ kettenis@
2022-02-13Move some MI pieces out of suspend_mp/resume_mpTheo de Raadt
ok kettenis
2022-02-13The Apple M1 SoC has two mechanism for doing IPIs. The first method usesMark Kettenis
the interrupt controller, the second method used implementation-specific CPU registers. The M1 Pro/Max SoCs use a modified interrupt controller that no longer provides the first method. So switch to the second method in preparation for adding M1 Pro/Max support to OpenBSD. As a bonus this mechanism seems to be faster (which may be why Apple calls these "fast" IPIs). ok patrick@
2022-02-13Use knote_modify() and knote_process() in obvious places.Visa Hankala
2022-02-13Add helper functions for f_modify and f_process to condense codeVisa Hankala
These new functions, knote_modify() and knote_process(), implement the logic that is common to most f_modify and f_process instances. The code is inlined so as to not add yet another call frame on the already towering stack of kqueue functions. Also, the _fn versions allow direct calling of an event function when there is only one filter type to handle.
2022-02-13Rename knote_modify() to knote_assign()Visa Hankala
This avoids verb overlap with f_modify.
2022-02-13Some PCIe devices on the M1 and M1 Pro/Max need to be explicitly powered onMark Kettenis
(most notably the WiFi chip). This is done through a GPIO controlled by the SMC. Add support for this and make sure we wait for the 100ms required by the PCIe standard when we use that GPIO to turn on power. This makes sure these devices are available even if U-Boot doesn't turn them on for us. ok patrick@
2022-02-13Add basic GPIO support.Mark Kettenis
ok patrick@
2022-02-12wsdisplay checks are no longer needed hereTheo de Raadt
2022-02-12wsdisplay checks are no longer needed hereTheo de Raadt
2022-02-12add MP stubsTheo de Raadt
2022-02-12for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdefTheo de Raadt
2022-02-12Reduce code duplication in pipe event filtersVisa Hankala
Use the f_event callback for checking event state within the pipe event filters. This enables the same f_modify and f_process functions to handle the different filter types. OK anton@
2022-02-11Fix typo in comment for f_favail.Todd C. Miller
From Alf Schlichting
2022-02-11Backout previous "Unwire with map lock held" (commitid: eQBvWUwShD91dN9Z)Klemens Nanni
WITNESS builds broke^W^Wkernels panic on boot as reported by anton and bluhm. Booting bsd.mp in single-user mode inside VMM shows: root on sd0a (5f9e458ed30b39ab.a) swap on sd0b dump on sd0b Enter pathname of shell or RETURN for sh: witness: lock order reversal: 1st 0xfffffd801f8ce468 vmmaplk (&map->lock) 2nd 0xfffffd801b8162c0 inode (&ip->i_lock) lock order "&ip->i_lock"(rrwlock) -> "&map->lock"(rwlock) first seen at: #0 rw_enter_read+0x38 #1 uvmfault_lookup+0x8a #2 uvm_fault_check+0x32 #3 uvm_fault+0xfb #4 kpageflttrap+0x12c #5 kerntrap+0x91 #6 alltraps_kern_meltdown+0x7b #7 copyout+0x53 #8 ffs_read+0x1f6 #9 VOP_READ+0x41 #10 vn_rdwr+0xa1 #11 vmcmd_map_readvn+0xa0 #12 exec_process_vmcmds+0x88 #13 sys_execve+0x732 #14 start_init+0x26f #15 proc_trampoline+0x1c lock order data w1 -> w2 missing # exit kernel: protection fault trap, code=0 Stopped at witness_checkorder+0x312: movl 0x10(%r14),%ecx gkoehler reported faults on poisened addresses on macppc dual G5.
2022-02-11Backout previous "Assert vm map locks" (commitid: sRNBfzX2dJrxFDmb)Klemens Nanni
WITNESS builds broke as reported by anton and bluhm: root on sd0a (5ec49b3ad23eb2d4.a) swap on sd0b dump on sd0b kernel: protection fault trap, code=0 Stopped at witness_checkorder+0x4ec: movl 0x10(%r12),%ecx https://syzkaller.appspot.com/bug?id=be02b290a93c648986c35370a271aad4135a5044 https://syzkaller.appspot.com/text?tag=CrashLog&x=136e9aa4700000
2022-02-11Replace manual !klist_empty()+knote() with KNOTE().Visa Hankala
OK mpi@
2022-02-11Check klist emptiness instead of NULL pointer in KNOTE()Visa Hankala
All callers of KNOTE() supply a non-NULL klist argument. Replace the NULL pointer check with klist emptiness check as a small optimization. OK mpi@
2022-02-11Inline klist_empty() for more economic machine code.Visa Hankala
OK mpi@
2022-02-11the sleep_clocks() hook is not needed because the architectures whichTheo de Raadt
need to do this can do it a few moments later in a different hook