aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* kqueue_fork_copy_knote(): zero kn_knlist for the copy before calling ↵Konstantin Belousov14 hours1-0/+1
| | | | | | | | | knlist_add() Reported by: pho, dhw Fixes: 306c9049c642da6a59a5dc088589605a9aa38b87 Sponsored by: The FreeBSD Foundation MFC after: 1 week
* nd6: Fix delayed NA for proxy addressesPouria Mousavizadeh Tehrani16 hours2-20/+53
| | | | | | | | | | Delayed proxy addresses need special handling, since they can use link-local ifa as their source address and have different link-layer data in their response. Fixes: f37fbe30f559 Reviewed by: glebius, markj Differential Revision: https://reviews.freebsd.org/D55850
* ipfw_nptv6: fix handling the ifaddr removal eventAndrey V. Elsukov17 hours1-2/+2
| | | | | | | | | The result of IN6_ARE_MASKED_ADDR_EQUAL() macro is not an integer, so threat it as a boolean value. PR: 294114 Reported by: Peter Much <pmc citylink dinoex sub org> MFC after: 1 week
* kqueue: assert that kqueue knote lists own the knotesKonstantin Belousov25 hours1-2/+12
| | | | | | | Reviewed by: kevans, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D56212
* kqueue: add some kn_knlist assertions around knlist_(add|remove)Kyle Evans29 hours1-0/+4
| | | | | | | | | | | We currently assert that kn_status is accurate, but there's more room for error. Neither of these are very likely, but currently we'd blow up in SLIST*() macros instead of providing more obvious diagnostics. It's perhaps only worth testing these because knlist_remove() requires getting logic across both f_attach() and f_detach() correct. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D56211
* kqueue: simplify knote_fdclose()Kyle Evans29 hours1-10/+12
| | | | | | | | | | | | | | | | | The influx logic in knote_fdclose() is a little misguided, the resulting wakeup() call should always be redundant: knote_drop_detached() will always issue a wakeup before it returns, so anything waiting on *that* knote that had entered fluxwait should have been woken up then. This is the obvious divergence from the other influx/wakeup pattern in the implementation, which will kn_influx-- and then issue the wakeup after it has processed all of the knotes it can make progress on. While we're here, the kq_knlist cannot shrink, so we can avoid that condition in the loop and avoid potentially excessive wakeups from fluxwait on kqueues that we didn't touch. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D56210
* kqueue: avoid a possible fork-deadlockKyle Evans29 hours1-1/+1
| | | | | | | | | | | | kqueue_fork_copy() is likely to have transitioned at least one knote through a flux state, so we should check whether we need to wake anything up on the way out to avoid a possible deadlock. This was a part of D56210, but we'll close the review with the next commit. Fixes: b11289f87123f ("kqueuex(2): add KQUEUE_CPONFORK") Reviewed by: kib, markj
* kqueue: compare against the size in kqueue_expandKyle Evans29 hours1-4/+6
| | | | | | | | | | | | | | | This is a cosmetic change, rather than a functional one: comparing the knlistsize against the fd requires a little bit of mental gymnastics to confirm that this is fine and not doing unnecessary work in some cases. Notably, one must consider that kq_knlistsize only grows in KQEXTENT chunks, which means that concurrent threads trying to grow the kqueue to consecutive fds will usually not result in the list being replaced twice. One can also more clearly rule out classes of arithmetic problems in the final `else` branch. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D56209
* compat/linux: map TCP_USER_TIMEOUT sockopt into TCP_MAXUNACKTIMEMaxim Sobolev30 hours2-0/+62
| | | | | | | | | | | | | | After reading both manual pages, our TCP_MAXUNACKTIME is fairly similar to the TCP_USER_TIMEOUT, the only considerable difference is ours is in seconds and linux's in milliseconds. Round up linux's in setsockopt(2) to a next whole second and clamp ours getter to UINT_MAX ms. Reviewed by: tuexen, glebius Differential Revision: https://reviews.freebsd.org/D56168 MFC after: 2 weeks Sponsored by: Sippy Software, Inc.
* cd9660: Add length checks to Rock Ridge parserDag-Erling Smørgrav34 hours1-0/+4
| | | | | | | | | | | | | | | | | | * cd9660_rrip_slink() did not check that the lengths of individual entries do not exceed the length of the overall record. * cd9660_rrip_altname() did not check that the length of the record was at least 5 before subtracting 5 from it. Note that in both cases, a better solution would be to check the length of the data before calling the handler, or immediately upon entry of the handler, but this would require significant refactoring. MFC after: 1 week Reported by: Calif.io in collaboration with Claude and Anthropic Research Reported by: Adam Crosser, Praetorian Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56215
* linuxkpi: Handle bin attributes in sysfs attribute groupsJean-Sébastien Pédron36 hours1-9/+25
| | | | | | | | | | | | | | | | | | | | | For instance, this is used by DRM drivers to declare the EDID property of an GPU output connector: sysctl -b sys.device.drmn1.card0.card0-DP-1.edid | edid-decode ... Block 0, Base EDID: EDID Structure Version & Revision: 1.4 Vendor & Product Identification: Manufacturer: SAM Model: 29814 Serial Number: 810635354 (0x3051505a) Made in: week 15 of 2025 ... Reviewed by: bz, emaste, wulf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55176
* acpi_spmc: Call new MS turn on display DSMAymeric Wibo40 hours1-5/+20
| | | | | | | | | | | | | | | | | | Microsoft added a new function index (turn on display, 9) to their DSM set. This revision calls this, which fixes S0ix on certain machines, such as the Lenovo Yoga Slim 7i Aura, who's ECs use this method as a trigger to restore power to certain devices. See commit 229ecbaac6b3 ("ACPI: x86: s2idle: Invoke Microsoft _DSM Function 9 (Turn On Display)") on Linux. Also see the following: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-firmware-notifications#turn-on-display-notification-function-9 Reviewed by: olce Approved by: olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56062
* acpi_spmc: Fail probe if acpi_spmc device already attachedAymeric Wibo40 hours1-0/+5
| | | | | | | | | We cannot have more than one SPMC device. Reviewed by: olce Approved by: olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56062
* ip6_mroute: Fix the type name in sysctl_mfctable()Mark Johnston40 hours1-1/+1
| | | | | | | No functional change since apparently it's fine to compute the size of a pointer type when the base type is undefined. Fixes: 0bb9c2b665d9 ("ip6_mroute: FIBify")
* vmm: Restore the ability to create VMs as root in a jailMark Johnston40 hours2-5/+19
| | | | | | | | | | | | | | | | | | The new PRIV_VMM_CREATE and DESTROY permissions should be allowed by jails, so need to be added to the list in prison_priv_check(). Then, modify vmmdev_create() to verify that the jail was created with the allow.vmm flag. This is already verified when opening /dev/vmmctl, but checking again doesn't hurt and ensures that one can't pass the allow.vmm policy by passing a vmmctl fd along a unix domain socket from outside the jail. Rename vmm_priv_check() to vmm_jail_priv_check() to make the function's purpose more clear. Reported by: novel Reviewed by: bnovkov Fixes: d4c05edd410e ("vmm: Add privilege checks to vmmctl operations") Differential Revision: https://reviews.freebsd.org/D56119
* pmap: Do not use PMAP_LOCK_INIT with kernel_pmapMark Johnston40 hours9-9/+9
| | | | | | | | | | | | | | | | The kernel_pmap lock is a bit special: it does not need the DUPOK flag, and it really belongs to a different lock class. If it belongs to the same class as regular pmap locks, then witness may report warnings when performing UMA allocations under a regular pmap lock, if the allocation triggers a pmap_growkernel() call. Replace instances of PMAP_LOCK_INIT(kernel_pmap) with inline mtx_init() calls to silence some witness warnings for harmless behaviour I see with some uncommitted test programs. Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D56185
* bce: Fix SYSCTL_IN error check in bce_sysctl_nvram_write()Weixie Cui44 hours1-1/+1
| | | | | | | | | | The condition after SYSCTL_IN was inverted: success (error == 0) returned immediately and skipped the NVRAM write path, while failure fell through. Return only when SYSCTL_IN fails. Signed-off-by: Weixie Cui <cuiweixie@gmail.com> Reviewed-by: ngie Pull-Request: https://github.com/freebsd/freebsd-src/pull/2113
* bcm2835_virtgpio: Add driver for virtual GPIO controller on some RPi modelsTetsuya Uemura2 days3-0/+360
| | | | | | | | | | | | | This driver enables bcm2835-virtgpio GPIO controller found on RPi3B and some CM boards. On which, the ACT (green) LED is connected to this controller. It is essential for FreeBSD to have this driver to control this LED. It will be exposed via gpioled(4). Reviewed by: mhorne MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51456
* Jail sysctls: deprecate generic sysctls in favour of allow-flagsAlexander Leidinger2 days1-1/+5
| | | | | | | | - add a missing sysctl to the deprecated list - add a comment to not add new generic sysctls and point to SYSCTL_JAIL_PARAM instead Reviewed by: jamie Differential Revision: https://reviews.freebsd.org/D51150
* rss: make toeplitz.c standard part of the kernelGleb Smirnoff2 days1-1/+1
| | | | | | | | | | | | This will fix LINT-NOIP build. This actually adds very little to the kernel text, e.g. 500 bytes on amd64. A perfect solution would be to instead declare rss_config.c as 'optional inet | inet6', but that would fail to build LINT-NOIP in several NIC drivers, that use RSS and absolutely ignore that both INET and INET6 are optional. It is very unlikely that vendors who maintain these drivers will will ever chase the holy grail of a build that doesn't support IPv4 and IPv6. Fixes: d9c55b2e8cd6b79f6926278e10a79f1bcca27a4b
* acpi_spmc: Improve device descriptionAymeric Wibo3 days1-2/+2
| | | | | | | "Low Power S0 Idle" doesn't mean that much. "System Power Management Controller" is what "SPMC" stands for in the first place. Sponsored by: The FreeBSD Foundation
* amdsmu: Cezanne supportAymeric Wibo3 days3-27/+31
| | | | | | | | | | | | | | Add support for Cezanne chips. The only real difference vs Rembrandt/Phoenix is the idlemask register. Also simplify getting IP block count by having this straight in struct amdsmu_product and remove Strix Point from the list for now, as that doesn't support S0ix and our driver can't handle that. Reviewed by: mckusick Approved by: mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55594
* ip6_mroute: Handle interface detach eventsMark Johnston3 days1-2/+67
| | | | | | | | | | | | | When an interface goes away we need to make sure the v6 multicast routing tables don't carry any dangling references to the ifnet. The v4 code handles this already. Copy the approach there and use an eventhandler to purge the corresponding MIF, if one exists, and further go through all routes in the FIB and remove references to the interface. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55246
* ip6_mroute: Pass the multicast interface number directly to del_m6if()Mark Johnston3 days1-13/+13
| | | | | | | | | | There's no need to pass a pointer to the interface number. No functional change intended. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55245
* ip6_mroute: Make ip6_mroute.h more self-containedMark Johnston3 days1-0/+3
| | | | | | | MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55243
* ip6_mroute: FIBifyMark Johnston3 days4-67/+85
| | | | | | | | | | | | Modify the control plane (ioctl and socket option handlers) to use the routing socket FIB to index into the mfctable array. Modify the forwarding plane to use the mbuf's FIB to determine which routing table to use. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55242
* ip_mroute: FIBifyMark Johnston3 days5-162/+180
| | | | | | | | | | | | Modify the control plane (ioctl and socket option handlers) to use the routing socket FIB to index into the mfctable array. Modify the forwarding plane to use the mbuf's FIB to determine which routing table to use. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55241
* ip(6)_mroute: Grow the routing tables when the number of FIBs changesMark Johnston3 days2-13/+84
| | | | | | | | | | Use the new rtnumfibs_change event to expand the mfctable array when the number of FIBs increases. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55240
* net/route: Add an eventhandler for rt_numfibs changesMark Johnston3 days2-1/+9
| | | | | | | | | | | | | The multicast routing code will start implementing per-FIB routing tables. As a part of this, it needs to be notified when the number of FIBs changes, so that it can expand its tables. Add an eventhandler for this purpose. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55239
* ip6_mroute: Start putting global variables into a structureMark Johnston3 days1-162/+229
| | | | | | | | | | | | | | As in the IPv4 version of this change, I added a struct mf6ctable structure which holds all global routing table state, soon to become per-FIB state. Note that much of the v6 multicast routing code was not VNETified; this change fixes that too. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55238
* ip_mroute: Start moving globals into a structureMark Johnston3 days1-207/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | I would like to support per-FIB multicast routing tables, such that one can run a routing daemon per-FIB, with each daemon oblivious to the existence of others. Currently the multicast routing code is completely unaware of FIBs. To that end, start collecting various global variables in ip_mroute.c into a per-VNET struct mfctable. In a future patch this will be expanded into an array of mfctable structures, one per FIB. For now, all of the state is collected into V_mfctables[0]. Each mfctable contains, among other things: - a pointer to the routing socket, if routing is enabled, - a hash table of routing cache entries, - an table of network interfaces participating in the routing configuration This change has no functional effect, it is just factoring out these global variables to make the subsequent patches simpler. MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55237
* ifnet: Fix races in if_vmove_reclaim()Zhenlei Huang3 days1-5/+9
| | | | | | | | | | | | | | | | | | | | | | | The thread running if_vmove_reclaim() may race with other threads those running if_detach(), if_vmove_loan() or if_vmove_reclaim(). In case the current thread loses race, two issues arise, 1. It is unstable and unsafe to access ifp->if_vnet, 2. The interface is removed from "active" list, hence if_unlink_ifnet() can fail. For the first case, check against source prison's vnet instead, given the interface is obtained from that vnet. For the second one, return ENODEV to indicate the interface was on the list but the current thread loses race, to distinguish from ENXIO, which means the interface or child prison is not found. This is the same with if_vmove_loan(). Reviewed by: kp, pouria Fixes: a779388f8bb3 if: Protect V_ifnet in vnet_if_return() MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55997
* stat(2): Send to sticky(7) in the S_ISVTX descriptionGleb Popov4 days1-1/+1
| | | | | Approved by: ziaee Differential Revision: https://reviews.freebsd.org/D56015
* snd_uaudio: Retire sndcard_func usageChristos Margiolis4 days2-17/+1
| | | | | | | | | | | | | | This is effectively a no-op, as it does not make use of the sndcard_func->varinfo field, so eventually ua_probe() always succeeds. Also change ua_probe()'s value to 0. There is no need to return BUS_PROBE_DEFAULT, because snd_uaudio() attaches the sound(4)'s children with bus_attach_children(). Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56160
* acpi_apm: Narrow scope of ACPI_LOCKJohn Baldwin4 days1-6/+2
| | | | | | | | | | | | This lock doesn't need to be held across seldrain/knlist_destroy. It is also redundant (and a bug) to hold it across knlist_add and knlist_remove since it is the mutex for the knlist. PR: 293901 Reported by: Jiaming Zhang <r772577952@gmail.com> Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55994
* nvme_sim: Fix name in module version metadataOlivier Certner4 days1-1/+1
| | | | | | MFC after: 1 week Fixes: 1e39b5d4833e ("nvme_sim: Attach as a child of nvme") Sponsored by: The FreeBSD Foundation
* vfs: Simplify vfs_write_resume()/vn_start_write_refed()Olivier Certner4 days1-12/+10
| | | | | | | | | | | | | | | | | | | The call to vn_start_write_refed() from vfs_write_resume() with 'mplocked' set to 'true' exactly boils down to doing an increment of 'mnt_writeopcount', albeit with lots of unnecessary verifications. Replace it with an inline incrementation. As the original call was the last with 'mplocked' with 'true', remove the 'mplocked' parameter from vfs_write_resume(), simplifying its code accordingly ('mplocked' always false). While here, in vfs_write_resume(), initialize 'error' out of the mount lock. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56108
* vmm: Add missing AVX instructions for AVX512 in cpuid stdextShengYi Hung4 days1-3/+12
| | | | | | | | | Reported by: Tom <freebsd@fizz.buzz> Reviewed by: markj Tested by: Tom <freebsd@fizz.buzz> MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56021
* LinuxKPI wlan drivers: update makefiles to not use WITH_Bjoern A. Zeeb4 days17-233/+300
| | | | | | | | | | | | | | | | | | | | | | | | Up to now the LinuxKPI wlan drivers were using local variables starting with a WITH_ prefix in their Makefiles. That is likely to collide with other mechanisms like WITH_ and WITHOUT_ from src.conf. Adjust the local variables to use a driver name prefix for now to control what is built and what is not. These variables are mainly for the time of development so we can turn off/on a feature or bus attachment while working on it. Otherwise they are there for documentation purposes. The only reason one would change them locally would be if someone was to build a very custom image and not want certain bits (e.g., USB support) being compiled into the modules. While here, try to harmonize some parts of the Makefiles. Suggested by: imp Discussed with: imp Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D55977
* nfs_nfsdsocket.c: Allow Copy/Clone from a read-only fsRick Macklem4 days1-3/+22
| | | | | | | | | | | | | | | | | | For some server file system types, such as ZFS, a Copy/Clone operation can be done across file systems of the same file system type. However, without this patch, the Copy/Clone will fail with EROFS if the input file is on a read-only mounted file system. This happens because Copy/Clone will try to do a VOP_SETATTR() of atime to set the atime. This patch pretends the VOP_SETATTR() of atime worked for read-only file systems. It fixes a problem when copying files from a ZFS snapshot. PR: 294010 MFC after: 2 weeks
* bluetooth: remove redundant 0x0bda entries from ng_ubt_rtl, rtlbtfwChristos Longros4 days1-18/+6
| | | | | | | | | | Generic Realtek vendor rules already match all 0x0bda Bluetooth devices. Remove the redundant per-product entries from ng_ubt_rtl.c, rtlbtfw main.c, and rtlbtfw.conf. Reviewed by: wulf MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D56137
* asmc(4): Add support for backlight(9) interfaceVladimir Kondratyev4 days3-1/+70
| | | | MFC after: 1 month
* asmc(4): Add PnP recordVladimir Kondratyev4 days1-0/+1
| | | | | | To load asmc(4) automagically on boot with devd(8). MFC after: 1 month
* dpaa2: Perform bus_dma pre-write sync before enqueue operationDmitry Salychev4 days1-3/+3
| | | | | | | | | | | | | | | | | | | Without a proper synchronization payload of the egress TCP segments can be corrupted as tuexen@ described in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292006#c31. This patch is indirectly related to 292006 because a properly enabled and announced support for the TX checksum offloading hides potentially corrupted frame payload. NOTE: Returned back with updated placeholders. PR: 292006 Reported by: tuexen@ Reviewed by: tuexen@ Tested by: dsl@, tuexen@ Differential Revision: https://reviews.freebsd.org/D56144 MFC after: 3 days
* Revert "dpaa2: Perform bus_dma pre-write sync before enqueue operation"Dmitry Salychev4 days1-3/+3
| | | | This reverts commit 968164eb650fd986f293512a3faac5c1c9e4d51f.
* dpaa2: Perform bus_dma pre-write sync before enqueue operationDmitry Salychev4 days1-3/+3
| | | | | | | | | | | | | | | | | Without a proper synchronization payload of the egress TCP segments can be corrupted as tuexen@ described in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292006#c31. This patch is indirectly related to 292006 because a properly enabled and announced support for the TX checksum offloading hides potentially corrupted frame payload. PR: 292006 Reported by: tuexen@ Reviewed by: ... Tested by: dsl@ Differential Revision: <https://reviews.freebsd.org/D###> MFC after: 3 days
* ukbd(4): make debug guard consistent with hkbd(4)Toby Slight5 days1-1/+3
| | | | | | | | Signed-off-by: Toby Slight <tslight@pm.me> Reviewed by: wulf MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1998
* hkbd(4): add some extra handy fn key bindingsToby Slight5 days2-0/+20
| | | | | | | | | | | | | | | | - Fn+S for ScrollLock as it's very useful to have ScrollLock on FreeBSD's TTY. - Fn+P for PrtSc/SysRq, as it's another very handy but sadly missing key on Macbooks. - Some other Fn+<key> combinations duplicating existing keys. Apply the change to ukbd(4) as well. Signed-off-by: Toby Slight <tslight@pm.me> Reviewed by: wulf MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1998
* hkbd(4): be more cautious & explicit about Apple vendor checkingtslight5 days3-56/+66
| | | | | | | | | | Apply the changes to ukbd(4) as well. Signed-off-by: tslight <tslight@pm.com> Reviewed by: wulf MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1998
* ukbd(4): backport Apple function keys support from hkbd(4)tslight5 days2-26/+91
| | | | | | | | | | and expose eject in addition to fn. Signed-off-by: tslight <tslight@pm.com> Reviewed by: wulf MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1998