summaryrefslogtreecommitdiff
path: root/sys
AgeCommit message (Collapse)Author
2022-06-30Allow sysctl mib CTL_NET.PF_INET6 with a length of 3 in PLEDGE_VMINFO.Claudio Jeker
This will be used for sysconf(3) and getconf(1) to handle _POSIX_IPV6 without opening a socket. OK sthen@ deraadt@
2022-06-30Remove an incorrect KASSERT() introduced in previous.Martin Pieuchot
If uvm_pagermapin() fails that doesn't mean the emergency pages aren't in use. In OOM situation, a single segment can still be held by an asynchronous write so the second call to uvm_pagermapin() can fail.
2022-06-30amd64/pmap: Change the wording of a panic stringMike Larkin
Change a panic string to make the text locatable in the code since there is another panic with the same text. Helps debugging when the line number information isn't available. no functional change. ok dv
2022-06-30vmm(4): reference count vm's and vcpu'sDave Voutila
Unlocking most of vmm last year at k2k21 exposed bugs related to lifetime management of vm and vcpu objects. Add reference counts to make sure we don't attempt to teardown vcpu or vm related objects while a thread is holding a reference. This also reduces abuse of rwlocks originally intended to protect the linked lists cleaning things up quite a bit. While here, also document assumptions on how struct members are protected for the next brave soul wander in. ok mlarkin@
2022-06-30amd64 pmap: Zero out the EPTP on pmap_createMike Larkin
Non-EPT pmaps were picking up old EPTPs from previous owners. This doesn't cause any problems but makes debugging harder. ok dv@
2022-06-29Pass a pointer to mbuf pointer further down into ip6_process_hopopts()Alexander Bluhm
and ip6_unknown_opt(). Instead of having dangling pointer in caller, use m_freemp() to set mbuf to NULL. OK sashan@
2022-06-29Between the calls to art_match() and SRPL_FIRST() another CPU mayAlexander Bluhm
remove the route from the list. In rtable_match() check if the route entry is NULL. discussed with mpi@ jmatthew@ claudio@; OK mpi@
2022-06-29Remove switch(4) remains.Vitaliy Makkoveev
ok claudio@ mpi@
2022-06-29remove archaic comment from original import of i386 pmapDave Voutila
This comment hasn't been relevant for at least 11 years as there's no such lock. NetBSD removed the comment 11 years ago. No functional change. Discussed with mlarkin@
2022-06-29Regen syscalls files as they were meant to be, correcting the "created ↵Jeremie Courreges-Anglas
from:" info Cluebat from miod@
2022-06-29Unlock the pledge(2) system callJeremie Courreges-Anglas
Protect the ps_pledge/ps_execpledge fields with ps_mtx. Shuffle the code to call unveil_destroy() outside the critical section. Only writes to those fields are protected. Since we may only remove bits from those fields, garbage values should do no harm even when a read crosses a write on 32 bits systems. Input claudio@ kettenis@ deraadt@, ok deraadt@
2022-06-29Simplify the locking dance around pledge_syscall()Jeremie Courreges-Anglas
It doesn't make sense to wrap this function with the kernel lock only when the syscall to be executed is itself locked. Instead pledge_syscall() should be always safe to execute without the kernel lock. "looks good" kettenis@, ok deraadt@
2022-06-29Use READ_ONCE() when saving pr->ps_pledge to a local variableJeremie Courreges-Anglas
This prevents the compiler from reloading a possibly different value from memory. Even if it doesn't matter in this code it's just better practice. Discussed with kettenis@ and deraadt@, ok deraadt@
2022-06-29Pass down the pointer to mbuf pointer into ip6_hbhchcheck(). ThisAlexander Bluhm
allows to set the mbuf to NULL and keep it consistent in the caller, instead of having dangling pointer after free. OK sashan@
2022-06-29Move the deep check back into the loop. There are ways that even thoughClaudio Jeker
we're deep the code will SSTOP and sleep and then on wakeup we need to recheck the deep conditions. Issue analyzed and OK by mpi@ Reported-by: syzbot+f7634539e73108238c2a@syzkaller.appspotmail.com
2022-06-29drm/i915: Implement w/a 22010492432 for adl-sJonathan Gray
From Ville Syrjala 0895a2235bae6671077c2de94268cccc346005d6 in linux 5.15.y/5.15.51 13bd259b64bb58ae130923ada42ebc19bf3f2fa2 in mainline linux
2022-06-29correct vararg use in kasprintf/kvasprintfJonathan Gray
fixes names of some encoders
2022-06-29ether_input() called with shared netlock, but pppoe(4) wants it to beVitaliy Makkoveev
exclusive. Do the pppoe(4) input within netisr handler with exclusive netlok held and remove kernel lock hack from ether_input(). This is the step back, but it makes ether_input() path better then it is now. Tested by Hrvoje Popovski. ok bluhm@ claudio@
2022-06-29Nullify `ipsecflowinfo' when mbuf(9) has no ipsec flowinfo data.Vitaliy Makkoveev
Otherwise we use `ipsecflowinfo' obtained from previous packet. ok claudio@
2022-06-29Add support for using non-standard UARTs (such as the Synopsys DesignWareMark Kettenis
UART found on AMD's Ryzen Embedded V1000 family) as an early console. This requires additional parameters to be passed by the bootloader to the kernel so it changes the struct for the BOOTARG_CONSDEV boot argument. The old struct will still be supported until OpenBSD 7.3 has been released such that new kernels boot with the old bootloader. ok anton@, deraadt@
2022-06-29Make bus_space_map(9) work before the pmap is initialized for addressesMark Kettenis
below 4G by using the direct map. ok anton@, deraadt@
2022-06-29match on Alder Lake-PJonathan Gray
ok deraadt@ kettenis@
2022-06-28constify miscellaneous arm64 pin and clock tablesChristian Weisgerber
ok miod@
2022-06-28Add support for the Synopsys DesignWare UART found on the Ryzen EmbeddedMark Kettenis
V1000 SoCs. ok anton@
2022-06-28On the x13s, using the EfiLoaderData memory type for the memory blockMark Kettenis
that we load the kernel into doesn't work. But changing it to EfiLoaderCode makes it work. Presumably the firmware creates a mapping with executable permissions in that case, which is obviously needed for executing kernel code. ok patrick@, mlarkin@
2022-06-28The x13s uses Memory32Fixed() to describe the windows forwarded by theMark Kettenis
host bridges. Add support for this. ok mlarkin@, patrick@
2022-06-28Make sure uvm_swap_get() always sleep and do not return and error.Martin Pieuchot
If no memory was immediately available to decrypt (bounce) a page from swap an error was returned to the fault handler which would result in processes dying when a lot of memory pressure was applied to a system. Note that reading from swap is always done synchronously. ok beck@, kettenis@
2022-06-28Consider pmemrange regions when trying to free pages from the inactive list.Martin Pieuchot
Instead of starting with the first page on the inactive list pick the first one that fits in the range of a given pmemrange region. Fix an issue where the page daemon would be hogging a CPU without freeing any page because the global limits are satisfied. The algorithm could certainly be revisited, the LRU is not really working and there is a huge delay before recovering when the first pages need to be swapped and the system is in OOM situation but at least there is no starvation and the system now recovers. ok beck@, kettenis@
2022-06-28Use new & shiny define for the maximum number of pages of a swap cluster.Martin Pieuchot
ok beck@, kettenis@
2022-06-28Pre-allocate pages in DMA-reachable region to ensure progress in the swapper.Martin Pieuchot
Currently swap encryption is not done in place and some architectures need to bounce pages into a DMA-reachable region for I/Os, for that uvm_swap_io() needs to allocate at most 64K to write a swap cluster to disk. Pre-allocate such amount of memory to be sure the page daemon can make progress in OOM situation. Also introduce a sleeping point to wait for the previous asynchronous I/O holding the pre-allocated pages, there's no point in building clusters if no progress can be made. ok beck@, kettenis@
2022-06-28Reserve a second segment for the page daemon.Martin Pieuchot
This ensures uvm_swap_io() can succeeds even in OOM situations because two uvm_pagermapin() allocations, requiring a segment each, are needed to bounce or encrypt a swap cluster. ok beck@, kettenis@
2022-06-28A com_acpi_softc pointer is used as the interrupt callback cookie whichAnton Lindqvist
is later on interpreted as a com_softc pointer. This is not a problem in practice as a com_softc structure is the first member of the com_acpi_softc structure. Using the actual types consistently yields a better symmetry in my opinion between registering the interrupt and the corresponding interrupt handler. ok deraadt@ kettenis@
2022-06-28No need to pass a copy of the bcmdmac_channel structure to predicateAnton Lindqvist
routines. ok deraadt@ kettenis@
2022-06-28Remove commented out variables and excessive blank lines inAnton Lindqvist
pluart_param().
2022-06-28Don't call pipex_rele_session() when `session' is NULL.Vitaliy Makkoveev
Reported by Hrvoje Popovski. ok bluhm@
2022-06-28Remove unused field d_poll from struct cdevsw.Visa Hankala
OK miod@ mpi@
2022-06-28fix syncookies in conjunction with tcp fast port reuse.Henning Brauer
This really pointed out that the place syncookies were hooked in was almost, but not completely right. The way it was the special case for tcp fast port reuse in pf_test_state wasn't hit, because the first packet hitting that was the ACK from the peer finishing the 3WHS, and the reconstructed SYN came after. We're now doing pf_find_state (and *only* that) first, then syncookies, then going on so that the old state is thrown away properly and we get a new one with the sequence number modulator set up correctly Bonus: -11 lines of code tracked down (that took a while) + fixed under contract with Hush Communications Canada; special thanks to Lyndon ok sashan
2022-06-28syncTheo de Raadt
2022-06-28a start at qualcomm productsTheo de Raadt
2022-06-28rewrite amd64 printing of cache detailsJonathan Gray
Previously we looked at cpuid 0x80000005 for L1/TLB details which Intel documents as reserved. And cpuid 0x80000006 for L2 details. Intel also encode cache details in cpuid 4. AMD have mostly the same encoding with cpuid 0x8000001d 0x80000005/0x80000006 is used as a fallback. Prompted by Intel Tiger Lake and Alder Lake machines returning an associativity value of 7 from cpuid 0x80000006. The previous code would print "disabled L2 cache", 7 is documented by Intel as "See CPUID leaf 04H, sub-leaf 2". tested by Hrvoje Popovski on EPYC 7413, and myself on various machines ok mlarkin@
2022-06-28Move the guts of uvm_aio_aiodone() into a separate function.Martin Pieuchot
This will help dealing with error cases. No functionnal changes.
2022-06-28Cleanup the sleep loop in single_thread_check_locked(). The deep checksClaudio Jeker
only matter on entry and the pr->ps_single check is done in the while body. With and OK mpi@
2022-06-28Do not clean PG_BUSY before calling uvm_anon_release().Martin Pieuchot
Fix an assertion reported by gkoehler@. ok kettenis@
2022-06-28Do not consider adjacent pages when doing a CoW.Martin Pieuchot
Those pages should already be entered, this speeds up CoW faults. Stolen from NetBSD. ok miod@, kettenis@
2022-06-28Use refcnt API for struct rtentry instead of hand-crafted atomicAlexander Bluhm
operations. OK mvs@
2022-06-28ifconfig(8) return "Not supported" if you try to configure tso on a non-tsoJan Klemkow
supported interface. pointed out by bluhm@ OK bluhm@
2022-06-28Use btrace(8) to debug reference counting. dt(4) provides a staticAlexander Bluhm
tracepoint for each type of refcnt we have. As a start, add inpcb and tdb refcnt. When the counter changes, btrace may print the actual object, the current counter, the change value and optionally the stack trace. discussed with visa@; OK mpi@
2022-06-28The ip6_hbhchcheck() function never reads the nxtp parameter, itAlexander Bluhm
only sets its value. It is more obvious to return the next protocol or IPPROTO_DONE to signal error. All IP protocol functions do that. OK sashan@ florian@
2022-06-28Add hardware ID for EHCI-compliant USB controller with standard debug.Mark Kettenis
ok jsg@
2022-06-28Add hardware ID for XHCI-compliant USB controller without standard debug.Mark Kettenis
ok jsg@