summaryrefslogtreecommitdiff
path: root/sys
AgeCommit message (Collapse)Author
2021-10-24Implement poll(2), select(2), ppoll(2) & pselect(2) on top of kqueue.Martin Pieuchot
The given set of fds are converted to equivalent kevents using EV_SET(2) and passed to the scanning internals of kevent(2): kqueue_scan(). ktrace(1) will now output the converted kevents on top of the usuals set bits to be able to find possible error in the convertion. This switch implies that poll(2) and select(2) will now query underlying kqfilters instead of the *_poll() routines. An increase in latency is visible, especially with UDP sockets and NET_LOCK()-contended subsystems and will be addressed in next steps. Based on similar work done on MacOS and DragonFlyBSD with inputs from visa@, millert@, anton@, cheloha@, thanks! Tested by many, thanks! ok claudio@, bluhm@
2021-10-24let pf_table.c to use standard way to work with listsAlexandr Nedvedicky
OK todd@, mvs@, kn@
2021-10-24Stop setting etype in the MD crypto code. So far we have set the etypePatrick Wildt
and returned the error, which made the MI crypto code set the etype for a second time. We still have to set etype after calling the MD process function, as the callers of crypto_invoke() still expect error handling to be shown through the etype. But at least now all MD crypto code does not have to worry about that anymore. Once the callers are changed to not look at etype anymore, we can get rid of it completely. ok tobhe@
2021-10-24Prohibit renames of tmpfs mount-points to fix a panic.Patrick Wildt
From gerhard@
2021-10-24extra 0 fields in cfdriver are not neededTheo de Raadt
2021-10-24pretty & normalize the cfdriver declTheo de Raadt
2021-10-24Set klist lock for sockets to make socket event filters MP-safeVisa Hankala
The filterops instances already provide f_modify and f_process callbacks with proper internal locking. Locking of socket klists has been the missing detail for MP-safety. OK mpi@
2021-10-24Make pipe event filters MP-safeVisa Hankala
Add the missing f_modify and f_process callbacks so that pipe_lock serializes pipe knote handling. As pipe klist locking is already in place, pipe event filters should now be MP-safe. This uses write locking everywhere in the callbacks for simplicity. There is not much multiple-readers parallelism to utilize. OK mpi@ anton@
2021-10-24use NULL not 0 for pointer values in kernJonathan Gray
ok semarie@
2021-10-23There is an m_pullup() down in AH input. As it may free or changeAlexander Bluhm
the mbuf, the callers must be careful. Although there is no bug, use the common pattern to handle this. Pass down an mbuf pointer mp and let m_pullup() update the pointer in all callers. It looks like the tcp signature functions should not be called. Avoid an mbuf leak and return an error. OK mvs@
2021-10-23Fix use-after-free in ipcomp_output() introduced by previous commit.Alexander Bluhm
Retrieve ilen and olen from crypto descriptors before freeing them. Found by regress/sys/netinet/ipsec. OK mpi@
2021-10-23sonewconn() returns the pointer to 'socket' struct so check it againstVitaliy Makkoveev
NULL instead of '0'. ok deraadt@
2021-10-23Call uvm_vnp_uncache() in tmpfs_write(). We currently only callPatrick Wildt
uvm_vnp_uncache() in tmpfs_write() when a file grows in size. This is not enough. We need to invalidate UVM's cache of the vnode every time the contents of the vnode are modified. Failure to do so might lead to inconsistencies between read/mmap consumers. From Pedro Martelletto
2021-10-23Fix tmpfs_lookup locking for ".." == ".". unveil_find_cover() callsPatrick Wildt
VFS_LOOKUP(dir, &parent) in a loop and looks up the parent directory ".." repeatedly. VFS_LOOKUP is expected to unlock 'dir' and return 'parent' locked. So tmpfs_lookup() is called for ISDOTDOT and: - runs with dvp = dir, vpp = &parent - gets parent from tmpfs_vnode_get() and - re-locks dir with vn_lock(dvp) but skips the call to VOP_UNLOCK(dvp); on return because *vpp == dvp The reason for doing so is the lookup for ".". In this case tmpfs_lookup() just increases the reference on dvp and copies the pointer: *vpp = dvp; vref(dvp); However, in our case we also have *vpp == dvp, but for a different lookup (ISDOTDOT), so we must do the unlock. From markus@
2021-10-23tpm(4): add support for tpm2 CRB interfaceDave Voutila
Some modern tpm2 devices require or prefer drivers communicate via the CRB interface and not the TIS/fifo interface. This change adds basic support for detecting CRB start mode and using CRB to issue commands required for proper S4 hibernation. As a result, this also defines a new struct definition for the TPM2 acpi table required for start mode detection. This fixes recent S4 regressions on the Surface Go 2 caused by a change in firmware from Microsoft. Other CRB start methods may need implementing in the future to support additional hardware. tested by deraadt@ and many others, ok kettenis@
2021-10-23Retire asynchronous crypto API as it is no longer required by any driver andTobias Heider
adds unnecessary complexity. Dedicated crypto offloading devices are not common anymore. Modern CPU crypto acceleration works synchronously, eliminating the need for callbacks. Replace all occurrences of crypto_dispatch() with crypto_invoke(), which is blocking and only returns after the operation has completed or an error occured. Invoke callback functions directly from the consumer (e.g. IPsec, softraid) instead of relying on the crypto driver to call crypto_done(). ok bluhm@ mvs@ patrick@
2021-10-23Fix double free after allocation failure in bpf(4).Visa Hankala
Reported by Peter J. Philipp. OK mpi@
2021-10-23Be consistend and add missing spaces around some of the NOTREACHED comments.Claudio Jeker
2021-10-23ps_sigcode, ps_sigcoderet and ps_sigcookie are immutable after a processClaudio Jeker
is created. Annotate them accordingly. OK mpi@
2021-10-23Sprinkle uvm_obj_destroy() over UVM object recycling code.Martin Pieuchot
For now, only assert that the tree of pages is empty in uvm_obj_destroy(). This will soon be used to free the per-UVM object lock. While here call uvm_obj_init() when new vnodes are allocated instead of in uvn_attach(). Because vnodes and there associated UVM object are currently never freed, it isn't easy to know where/when to garbage collect the associated lock. So simply check that the reference of a given object is 0 when uvn_attach(). Tested by many as part of a bigger diff. ok kettenis@
2021-10-23Assert that the KERNEL_LOCK() is held in vref(9).Martin Pieuchot
This is a guard against pushing the lock too far in UVM's vnode land. ok beck@
2021-10-23Make sure we have enough space to add padding and final token to the nvramMark Kettenis
data. Also add the MAC address to the nvram data when there is a "local-mac-address" property in the device tree. This makes bwfm(4) work with the firmware/nvram/clm_blob files provided with MacOS on the Apple M1 Macs. ok patrick@
2021-10-23YIELD() in pf_table.c should preempt for ioctl() callers onlyAlexandr Nedvedicky
OK @mpi
2021-10-22Make error handling in IPsec consistent. Pass errors to the callers.Alexander Bluhm
OK tobhe@
2021-10-22Revert "Preserve select(2) semantics when the other end of the pipe is gone".Martin Pieuchot
The logic to emulate the current poll/select behavior is better implemented at the syscall layer and not in the kqueue backend. Discussed with deraadt@, ok anton@
2021-10-22Make EVFILT_EXCEPT handling separate from the read filter.Martin Pieuchot
This is a change of behavior and events wont be generated if there is something to read on the fd. Only EV_EOF or NOTE_OOB will now be reported. While here a new filter for FIFOs supporting EV_EOF and __EV_HUP. ok visa@
2021-10-22Mask LPI interrupts. This fixes an interrupt storm on dwge(4) variantsMark Kettenis
that support Energy Efficient Ethernet when connected to a switch that also supports Energy Effient Ethernet. For example on the odroid-hc4. ok patrick@
2021-10-22After deleting hifn(4) the only provider for the LZS compressionAlexander Bluhm
algorithm is gone. Reomve all LZS references from the tree. The v42bis in isakmpd also looks unsupported. OK mvs@ patrick@ sthen@
2021-10-22regenJonathan Gray
2021-10-22add Intel ADL-S and ADL-P graphics ids Mesa matchesJonathan Gray
fix a GMA600 id while here
2021-10-22Remove last dangling usage of CRYPTO_F_NOQUEUE.Anton Lindqvist
ok tb@
2021-10-22Preserve pipe select(2) semantics when the other end of the pipe is gone.Anton Lindqvist
In preparation for implementing select(2) on top of kqueue. ok mpi@
2021-10-22One could end up with the wrong encoding in xenocara while having a uccAnton Lindqvist
keyboard attached and /etc/kbdtype being present. The advertised encoding of a wsmux is a bit fragile as the last attached device will dictate it. If this happens to be a ucc keyboard, KB_US will always be the advertised encoding as its encoding is immutable and /etc/kbdtype is ignored. Instead, do not advertise the encoding for ucc devices when the parent mux queries its attached devices. However, asking the device directly (i.e. bypassing the mux) still returns the encoding as wsconsctl(8) would otherwise report an error. Thanks to landry@ for the report and testing.
2021-10-21Remove more dead code related to crypto task queues.Tobias Heider
2021-10-21Remove code to run crypto operations in a task queue. The code wasTobias Heider
not reachable because all callers had set the CRYPTO_F_NOQUEUE flag. ok patrick@ mvs@ bluhm@
2021-10-21Initialize interrupts to G1NS by configuring IGROUPR and IGRPMODR. ThisPatrick Wildt
makes interrupts work with Parallels on the Apple M1. Tested by patrick@ on Ampere eMAG and MacchiatoBin Tested by fkr@ on Pinebook Pro ok kettenis@
2021-10-21Release solock() before call unp_internalize() and take it within whenVitaliy Makkoveev
access garbage collector data. This is the next step to make UNIX domain sockets locking fine grained. This also moves M_WAIT/M_WAITOK allocations out from `unp_lock' rwlock(9). The lock order between fdplock() and `unp_lock' changed and now fdplock() should be taken first. This was not required, but helps to mpi@'s knote(9) related work. ok bluhm@
2021-10-21regenJonathan Gray
2021-10-21add Gemini Lake MEI; from fkrJonathan Gray
2021-10-21Remove hifn(4), safe(4), and ubsec(4) crypto drivers. They requireAlexander Bluhm
the asynchronous crypto API which makes progress in MP difficult. The hardware is rarely available. They support only obsolete crypto algorithms. Scheduling crypto tasks via PCI is probably slower than the CPU, especailly as modern CPUs have their own accelerators.
2021-10-21Have ampintcmsi(4) go through the list of interrupt controllers to find thePatrick Wildt
correct parent. So far we were directly calling some ampintc(4) code, which is fine for regular hardware. With Parallels on the Apple M1, ampintcmsi(4) is combined with agintc(4), which is quite a surprise. Luckily both types of interrupt controllers use the same API for passing interrupt information, so we can craft one structure and both ampintc(4) and agintc(4) will happily work with it. ok kettenis@
2021-10-21Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.Claudio Jeker
vfs stalling is used by suspend/resume and by vmt(4) to stall any filesystem operation from altering the state on disk. All these operations will call vn_lock and be stalled. Adjust vfs_stall_barrier() to allow the lock owner to still progress so that suspend can sync the filesystems after stalling vfs operation. OK mpi@
2021-10-21Remove duplicate variable ibytes, use plen instead.Tobias Heider
ok bluhm@
2021-10-20drm/edid: In connector_bad_edid() cap num_of_ext by num_blocks readJonathan Gray
From Douglas Anderson a7b45024f66f9ec769e8dbb1a51ae83cd05929c7 in linux 5.10.y/5.10.75 97794170b696856483f74b47bfb6049780d2d3a0 in mainline linux
2021-10-20revert vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
(both kernel and userland bits) GENERIC + VFSLCKDEBUG is broken with it.
2021-10-19vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
This flag is currently used to mark or unmark a vnode to actively check vnode locking semantic (when compiled with VFSLCKDEBUG). Currently, VLOCKSWORK flag isn't properly set for several FS implementation which have full locking support. This commit enable proper checking for them too (cd9660, udf, fuse, msdosfs, tmpfs). Instead of using a particular flag, it directly check if v_op->vop_islocked is nullop or not to activate or not the vnode locking checks. ok mpi@
2021-10-19vnode: do not manipulate vnode lock directlySebastien Marie
use VOP_LOCK / VOP_UNLOCK wrappers. VOP_LOCK() is prefered over vn_lock() here in order to keep equivalent code. ok mpi@ visa@ (as part of larger diff)
2021-10-19vnode: deadfs: do not call v_op->vop_lock directly, use VOP_LOCK() wrapperSebastien Marie
ok mpi@ visa@ (as part of larger diff)
2021-10-17km_alloc(9) needs to be passed a size that is a multiple of PAGE_SIZE.Patrick Wildt
ok mpi@
2021-10-17drm/amdgpu: fix gart.bo pin_count leakJonathan Gray
From Leslie Shi 621ddffb70db824eabd63d18ac635180fe9500f9 in linux 5.10.y/5.10.74 66805763a97f8f7bdf742fc0851d85c02ed9411f in mainline linux