aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* LinuxKPI: add supporting #includesBjoern A. Zeeb42 hours3-0/+3
| | | | | | | | | | | | | | Compiling drm-kmod on !X86 does not include asm/smp.h which includes preempt.h on FreeBSD. In order to compile drm-kmod on other architectures add the secondary #includes for preempt.h to spinlock.h and hardirq.h (which now also gets included from highmem.h) to connect the #include chain. Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 279864 Reviewed by: jhibbits, emaste Differential Revision: https://reviews.freebsd.org/D55974
* LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end readsJohn Baldwin6 days1-2/+2
| | | | | | | | | | | | I noticed that the buf_size < 0 check can never be true (it's a size_t) and decided to check for this condition by an alternate expression, and I also noticed that a read_size of 0 would incorrectly return -EFAULT. Instead, return success for both of these cases as reading beyond the EOF of a normal file also returns EOF, not EINVAL. Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55845
* lindebugfs: Pass user buffer pointers to the read/write file operationsJohn Baldwin6 days5-58/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux file_operations API expects the read and write operations to take a single user buffer pointer (along with the length and the file offset as an in/out parameter). However, the debugfs_fill function was violating this part of the contract as it was passing down kernel pointers instead. An earlier commit (5668c22a13c6befa9b8486387d38457c40ce7af4) hacked around this by modifying simple_read_from_buffer() to treat its user pointer argument as a kernel pointer instead. However, other commits keep tripping over this same API mismatch (e.g. 78e25e65bf381303c8bdac9a713ab7b26a854b8c passes a kernel pointer to copy_from_user in fops_str_write). Instead, change debugfs_fill to use the "raw" pseudofs mode where the uio is passed down to directly to the fill callback rather than an sbuf. debufs_fill now iterates over the iovec in the uio similar to the implementation of uiomove invoking the read or write operation on each user pointer. This also fixes a tiny bug where the initial file offset from uio_offset was ignored. Instead, the operations were always invoked with a file offset of 0. As part of this, revert the the changes to simple_read_from_buffer() from commit 5668c22a13c6befa9b8486387d38457c40ce7af4. Also as part of this, the simple_attr_read/write methods and seq_read now also need to accept and handle user pointers (also matching the API in Linux). For simple_attr_write*(), copy the user buffer into a kernel buffer before parsing. Also, do not permit writes at an offset as it's unclear what the semantics for those would even be (perhaps you would write out the formatted value into a buffer first and then allow the copy_from_user to overwrite/extend that buffer and then re-parse the integer value?). The old handling of *ppos for writes was definitely wrong before and only worked for an offset of 0 anyway. Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55833
* LinuxKPI: Use simple_read_from_buffer in simple_attr_read and seq_readJohn Baldwin6 days2-20/+4
| | | | | | Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55879
* LinuxKPI: Clear the sbuf at the start of each call to seq_readJohn Baldwin6 days1-0/+1
| | | | | | | | | | Each invocation of seq_read invokes the seq_file.show callback which writes into the sbuf. Then it invokes sbuf_finish before copying the data into the caller's buffer. Without this, a second call to seq_read on the same file would try to append data to a finished sbuf. Reviewed by: bz Sponsored by: AFRL, DARPA
* compat/linux: Avoid waitid() kernel stack disclosureEd Maste11 days1-0/+1
| | | | | | | Reported by: Adam Crosser, Praetorian Reviewed by: philip Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55812
* compat32: Zero struct to avoid stack disclosureEd Maste11 days1-1/+1
| | | | | | | Reported by: Adam Crosser, Praetorian Reviewed by: philip Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55811
* LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULLBjoern A. Zeeb2026-03-081-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Usually after a firmware crash, we see reports of crashes in lkpi_sta_auth_to_scan(). One of the last ones was in the PR mentioned below. These crashes are often attributed as the problem while the real problem happened before. At this point try avoid the NULL pointer and to fail graciously if lvif->iv_bss (lsta) is no longer set. This way users have a chance to possibly recover using netif restart wlan0 rather than dealing with a panic. See if this helps us to better track down the original problems rather than the follow-up crash. On a debug kernel the KASSERT should normally have caught that condition as well but we see panics on page faults were the log line was there but then the lsta->ni deref has happened, which is after the KASSERT. I have not checked if this is a reordering problem or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS. Sponsored by: The FreeBSD Foundation PR: 286219 #c11 MFC after: 3 days
* RegenKonstantin Belousov2026-03-054-1/+42
|
* linuxolator: translate LINUX_RENAME_NOREPLACE into our AT_RENAME_NOREPLACEKonstantin Belousov2026-03-051-12/+23
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55539
* kern_renameat(9): add flags argumentKonstantin Belousov2026-03-051-2/+2
| | | | | | | | Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55539
* LinuxKPI: 802.11: change teardown order of disassoc and sta rmBjoern A. Zeeb2026-03-051-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In lkpi_sta_auth_to_scan() we remove the sta from the firmware for everything supporting (*sta_state). We used to run into issues here with iwlwifi in that we had to use a specific order: set vif->cfg.assoc = false, .aid = 0, then remove the sta, and then send the mac update as otherwise we would either have the sta silently removed (if we run (*bss_info_change) first and fail then or silently not have the sta removed and upon sta add we would trigger the fw crash. The order of events seem to have changed now and especially BE200 (iwlwifi/mld) is picky about this and would crash the firmware with something like: iwlwifi0: 0x20103311 | ADVANCED_SYSASSERT iwlwifi0: 0x00000000 | umac branchlink1 iwlwifi0: 0xC00808AA | umac branchlink2 iwlwifi0: 0xD00D6E90 | umac interruptlink1 iwlwifi0: 0x0108C504 | umac interruptlink2 iwlwifi0: 0x00000000 | umac data1 (link_id? seen weird values there though) iwlwifi0: 0x00000006 | umac data2 (fw_sta_id) iwlwifi0: 0x00000001 | umac data3 if it would still think we were assoc. So the new order is as one would have expected initially: set assoc = false, aid = 0; do the remaining bss_conf (vif/link) changes and issue the (*vif_cfg_changed) / (*link_info_changed) or for older drivers (*bss_info_changed). That will tell the mac we are no longer associated. And only then remove the sta from the firmware. Update the comment there along so we do have the paper trail as to when and why this changed. Tested on: BE200, AX210 (11ac) Tested on: AX200. 9260, 8265, 3165 (11a) Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: split (*bss_info_changed) up for more modern driversBjoern A. Zeeb2026-03-053-21/+128
| | | | | | | | | | | | | | | | | | | | | With the advent of MLO some of the updates (*bss_info_changed) would have done are not per-link. This had (*vif_cfg_changed) and (*link_conf_changed) introduced which are used by iwlwifi, rtw89, select mt76 drivers, and ath12k currently it seems. A driver normally only supports on or the other set. Factor out the call to (*bss_info_changed) into an internal function. There split the options up depending on whether they are for the vif or a link and leave a fallback to (*bss_info_changed) for older drivers. Add the mac80211 ops implementations for the two new calls along with a currently unused backup option for (*bss_info_changed) for each as I assume we will eventually call the directly rather than from the internal wrapper function. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix typoBjoern A. Zeeb2026-03-051-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: pass attrs in more places in dma-mapping.hBjoern A. Zeeb2026-03-041-6/+6
| | | | | | | | | | | | | | | | Various macros (dma_map_sg_attrs, dma_unmap_sg_attrs, dma_map_single_attrs, and dma_unmap_single_attrs) currently supress passing on the attrs argument. Their implementation (even though at times still marked the argument __unused; we remove that) have long gained support for handling the argument. With ofed fixed (5edf24aac1d09), pass the argument through so that other drivers using these functions may hopefully work just a bit better as well. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D55391
* LinuxKPI: 802.11: improve prep_tx_infoBjoern A. Zeeb2026-03-042-22/+72
| | | | | | | | | | | | | | | | | | | | | Over time struct ieee80211_prep_tx_info has grown further fields. One which is becoming mandatory is the subtype (of the mgmt frame). iwlwifi(mld) has a WARN for it if it does not match, so we now have to set this for proper operation. In addition we are tyring to improve the situation of setting/unsetting (prepare_tx/complete_tx) in various states and cleanup the use of other fields but link_id which we now leave as a marker for the future everywhere. The general problem we are facing is that our hook surface in this case is the state machine but likely would have to be tx/rx mgmt frames but we would alos have to driver the TX queues from there which is tricky. The long-term answer is to change net80211. Further the hardware flag DEAUTH_NEED_MGD_TX_PREP is dead and was removed again in favour of leting drivers deal with it. iwlwifi(mvm) likely being the only driver which ever used this. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: move linuxkpi_ieee80211_handle_wake_tx_queue()Bjoern A. Zeeb2026-03-041-39/+37
| | | | | | | No functional changes. Just moved the function within the file. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix typoBjoern A. Zeeb2026-03-041-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: avoid -Werror=unused-value in sort() from BUILD_BUG_ON_ZERO()Siva Mahadevan2026-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The BUILD_BUG_ON_ZERO() macro returns an (int)0 if it does not fail at build time. LinuxKPI sort() has it as a guard for an unsupported argument but ignores the return value. This leads to gcc complaining: /usr/src/sys/compat/linuxkpi/common/include/linux/build_bug.h:60:33: error: statement with no effect [-Werror=unused-value] 60 | #define BUILD_BUG_ON_ZERO(x) ((int)sizeof(struct { int:-((x) != 0); })) | ^ /usr/src/sys/compat/linuxkpi/common/include/linux/sort.h:37:9: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 37 | BUILD_BUG_ON_ZERO(swap); \ | ^~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/dev/rtw89/core.c:2575:9: note: in expansion of macro 'sort' 2575 | sort(drift, RTW89_BCN_TRACK_STAT_NR, sizeof(*drift), cmp_u16, NULL); Change to BUILD_BUG_ON() for the statement version. Reported by: CI Co-authored-by: bz Approved by: emaste (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55634
* LinuxKPI: remove dumm header now in commonBjoern A. Zeeb2026-02-261-0/+0
| | | | | | | | page_pool/helpers.h does exist in common/include/net/page_pool/helpers.h so we can remove the dummy header file. Sponosred by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fold the sta state machine againBjoern A. Zeeb2026-02-251-532/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In and around d9f59799fc3e7 we adjusted the initial sta state machine implementation and unfolded some functions, duplicating code. This version tries to undo some of that as it seems that we can get away with doing it more cleanly these days. There are 5 main functions for the path from INIT to RUN (UP1,2,3.1,3.2,4) and 4 main functions for the path from RUN to INIT (DOWN1,2,3,4). The reason there is one more on the patch up is that we can go directly from AUTH to RUN without going through ASSOC first. In addition there are further functions relying only on these 9 base state change functions in order to implement the remaining possible state transitions net80211 can do (without CSA and SLEEP). Another change is that we no longer take a sta always through INIT/SCAN first and then back up to AUTH, that is, we are no longer deleting the sta from the firmware unless net80211 would also take us down to that state and in a follow-up back up. This is a preparation for another fix to come in order to import a newer version of iwlwifi (v6.19). I have run a few days of mlme_assoc (see tools) and some other basic regression tests. The only thing I managed was to deadlock net80211 for other reasons (ieee80211_waitfor_parent()). But this will need excessive user testing as the various options which may have an effect on the subtle details are great as we learnt in the past years. Sponsored by: The FreeBSD Foundation MFC after: 5 days
* LinuxKPI: 802.11: improve crypto debug loggingBjoern A. Zeeb2026-02-251-0/+8
| | | | | | | | | | Add a log entry to lkpi_ieee80211_iterate_keys() in order to be able to determine if there are still keys available when a driver calls into this (e.g., iwlwifi does before removing the sta to make sure the keys are gone). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: adjust assoc check before key deletionBjoern A. Zeeb2026-02-251-9/+21
| | | | | | | | | | | | | | | There is a discrepancy between the vif assoc state and the sta state (see comment in lkpi_sta_run_to_init()). Adjust the check in lkpi_iv_key_delete() and add it to lkpi_sta_del_keys() so that we can take way the keys after whatever comes first: the sta went away from AUTHORIZED (RUN) or if the vif is no longer marked assoc. This is needed as we may only take the sta down partially back to State 2 (cf. 802.11-2024, Figure 11-23) and key material is no longer valid before the vif gets cleaned up and the sta is removed entirely. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: do not leak BA sessions when tearing down stateBjoern A. Zeeb2026-02-241-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain cases we may tear down state of a node with 'ongoing' BA sessions. This can trigger a firmware crash with iwlwifi as reported in [1] when trying to remove the sta from the firmware. 0x2010303A | ADVANCED_SYSASSERT .. 0x00000000 | umac data1 (sta id=0) .. 0x0088030C | last host cmd (STA_RM) [1] https://lists.freebsd.org/archives/freebsd-wireless/2025-November/003901.html I hit the same problem while running regression tests after reworking some LinuxKPI 802.11 sta state machine bits. Add the missing calls to lkpi_sta_run_to_assoc() and lkpi_sta_run_to_init() to make sure (through net80211) we call (*ampdu_action) with IEEE80211_AMPDU_RX_STOP to avoid the firmware crash. Note: this specific patch was not excessively tested. The upcoming change to the state machine including this fix has seen more testing but also only needed the change in one place. The reason for putting this in upfront is to document the case well. Reported by: Mohammad Amin (the.madamin20 gmail.com) [1] Sponsored by: The FreeBSSD Foundation MFC after: 3 days
* sys/compat/freebsd32: FF clock struct: Don't pack, use 'ffcounter32'Olivier Certner2026-02-162-11/+9
| | | | | | | | | | | | | | | | | | | Packing 'struct ffclock_estimate32', in absence of substitution of 'ffcounter' (some 'uint64_t') by a 32-bit compatible type, was necessary on amd64 since 'uint64_t' is 8-byte aligned, which leaves a padding gap of 4-byte between fields 'update_time' and 'update_ffcount'. This gap does not exist on i386 (or amd64 32-bit mode), as 'uint64_t' there is only 4-byte aligned. Change the type of the 'update_ffcount' and 'leapsec_next' fields to the recently introduced 'freebsd32_uint64_t', and adapt copy-in and copy-out accordingly. Using `CP()` previously worked due to the '__packed__' attribute. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55282
* sys/compat/freebsd32: Fix i386 compilationOlivier Certner2026-02-131-1/+1
| | | | | | | | | | | The compile assertion now failing is due to the change '__int64_t' => '__int32_t' as the type of 'time32_t' on i386, which is the correct value. The use of 'freebsd32.h' on i386 may seem strange, but it comes from 'kern_umtx.c' including it unconditionally as it needs 'struct umutex32'. Fixes: 87632ddf67b0 ("openzfs sys/types32.h: use abi_compat.h for time32_t") Sponsored by: The FreeBSD Foundation
* LinuxKPI: 802.11: add cfg80211 (*change_bss) and related structsBjoern A. Zeeb2026-02-111-1/+11
| | | | | | | Needed by brcmfmac v6.19. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* brcm80211: add LinuxKPI files and module MakefilesBjoern A. Zeeb2026-02-105-0/+277
| | | | | | | | | | | | | | sys/compat/linuxkpi/common/include/linux/platform_data/brcmfmac.h is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ). Currently only PCIe is made to compile. It does load firmware (if needed, e.g., on arm64 with an alignment issue fixed), and starts to come up. To make it work there is a cfg80211 layer and netdevice integration to do, so do not hold your breath just yet.
* net: Remove the IFF_RENAMING flagMark Johnston2026-02-101-1/+0
| | | | | | | | | | | This used to be needed when interface renames were broadcast using the ifnet_departure_event eventhandler, but since commit 349fcf079ca3 ("net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming"), it has no purpose. Remove it. Reviewed by: pouria, zlei Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D55171
* LinuxKPI: add scoped_guard(), spinlock guard supportBjoern A. Zeeb2026-02-092-28/+109
| | | | | | | | | | | | | | | | | | | The "cleanup.h" implementation got a bit more complicated. For one we now use a macro to concatenate a prefix, the name, and a suffix for variable and function declarations. This was triggered by the fact that the "guard_" prefix we used was confusing. We now use a generic "cleanup_" which is only encoded in the single place rather than all over the file. As already indicated by the comment the DEFINE_LOCK_GUARD_0() macro got split up and a _1 version which also takes a type got implemented and is used for a spinlock variant used by rtw89(4) via the new scoped_guard() bits. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54808
* LinuxKPI: mod_devicetable, add comment about [future] LinuxKPI USBBjoern A. Zeeb2026-02-091-0/+6
| | | | | | | | | | USB structures are defined with the native USB implementation. Just leave a comment why they are not here. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D54991
* LinuxKPI: move MODULE_DEVICE_TABLE from pci.h to module.hBjoern A. Zeeb2026-02-092-18/+18
| | | | | | | | | | | | | | | | Move the MODULE_DEVICE_TABLE macro to module.h where it belongs in preparation for different bus (e.g., USB, SDIO) support. The various struct <bus>_device_id, if not elsewhere, should be defined in mod_devicetable.h. This is the next step after 2f5666c1727c. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste, dumbbell Differential Revision: https://reviews.freebsd.org/D54900
* LinuxKPI: pci: make sure a tailq and lock are initializedBjoern A. Zeeb2026-02-091-4/+3
| | | | | | | | | | | | Move the initializations of the tailq and lock from linux_pci_attach_device() into lkpifill_pci_dev() so that they are initialized in all cases we create a device (see all the possible callers of lkpifill_pci_dev()). Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste, dumbbell Differential Revision: https://reviews.freebsd.org/D54861
* LinuxKPI: expand dma_sync_single_for_cpu() in lkpi_dma_unmap()Bjoern A. Zeeb2026-02-091-2/+19
| | | | | | | | | | | | | | | | In case lkpi_dma_unmap() would call dma_sync_single_for_cpu() we get into a lock recursion which will trigger a panic with debug kernels. It would be hard to provide an internal "locked" version for dma_sync_single_for_cpu(). In the old days this would not have been a problem but (long before we added the missing sync calls) some locks got folded into one in a6619e8d9c1a3. Sponsored by: The FreeBSD Foundation MFC after: 3 days Observed with: iwlwifi mld Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D54841
* sys/compat/freebsd32: use freebsd32_uint64_t for struct kinfo_proc32Konstantin Belousov2026-02-091-2/+2
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/compat/freebsd32: ki_pd is missing from struct kinfo_proc32Konstantin Belousov2026-02-091-0/+1
| | | | | | | | | | | | This is missed by the sizeof(struct kinfo_proc32) assert due to another bug: namely, the use of uint64_t type that has different alignment on i386 than on amd64 host. Fixes: 85078b8573332c2c83a79adea8a61b519fb3b6af Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/compat/freebsd32: use freebsd32_uint64_t for several struct stat'sKonstantin Belousov2026-02-092-9/+9
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/compat/freebsd32: use freebsd32_uint64_t for struct ffclock_estimate32Konstantin Belousov2026-02-092-3/+3
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/compat/freebsd32: use freebsd32_uint64_t for struct kinfo_knote32Konstantin Belousov2026-02-092-31/+6
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/event.h: use freebsd32_uint64_t for kevent32 64bit membersKonstantin Belousov2026-02-091-32/+6
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* sys/abi_compat.h: move freebsd32_uint64_t and FU64_CP() thereKonstantin Belousov2026-02-091-18/+0
| | | | | | | | | | Use private names for uintXX_t types. Remove conflicting (but equal) PTR_IN() definition from dev/mfi.c. Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* kern/vfs_unmount.c: promote flags to uint64_tKonstantin Belousov2026-02-091-1/+1
| | | | | | | | | | to prevent sign-extension, causing unexpected flags to be passed to dounmount(). The mnt_flags and MNT_* constants are 64bit wide. Suggested and reviewed by: jah Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55197
* linux_file.c: Fix handling of NFS getdents() emulationRick Macklem2026-02-071-68/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bugzilla PR#292282 reports a problem, where a Linux binary running in the Linuxulator gets bogus entries in a readdir()/getdents() reply when the directory is an NFS mount. This appears to be caused by the NFS client including entries with d_fileno == 0, which are always ignored by BSD, but are not ignored by Linux. This patch filters out the "d_fileno == 0" entries and the reporter of the bugzilla PR notes that it fixes the problem for him. It could be argued that the NFS client should filter out the "d_fileno == 0" entries, but the NFS client readdir code is "fragile" and any change to it runs a significant risk of causing regression type problems. As such, since the LInuxulator is already broken for this case, it seems safer to filter them out there. PR: 292282 Tested by: Jerry Williams <jwillia3@proton.me> Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D54679
* LinuxKPI: 802.11: catch possible NULL pointer deref with mt76Bjoern A. Zeeb2026-02-071-3/+13
| | | | | | | | | | With mt76 we, for the first time, see that txstat->skb or txstat->info may not be filled in linuxkpi_ieee80211_tx_status_ext(). Guard for these cases checking for skb and info to be not NULL and assume a TX failure in case info is NULL. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: make sure we are scheduled before wake_tx_queue()Bjoern A. Zeeb2026-02-073-8/+15
| | | | | | | | | | | | | If we are not scheduled before calling wake_tx_queue() packets may never go out, which at first will look like EAPOL fails (as wpa_supplicant suggest possibly with a wrong key). Using monitor mode it will be clear what is going on. Pass a flag down to wake_tx_queue() to call ieee80211_schedule_txq() in case (*wake_tx_queue)() is supported or not, which solves the problem for the lkpi_80211_txq_tx_one() which was failing. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: set extra tx info flag for EAPOL for mt76Bjoern A. Zeeb2026-02-071-1/+3
| | | | | | | | mt76 requires IEEE80211_TX_CTL_USE_MINRATE to be set for EAPOL, so add it. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: string_choices.h: use ternary operatorBjoern A. Zeeb2026-02-031-20/+5
| | | | | | | | | | | Switch from using if () else to a direct return (?:) code. No functional changes. Suggested by: kib (D55029) Sponosred by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste (before removing more () as suggested by him) Differential Revision: https://reviews.freebsd.org/D55088
* LinuxKPI: add str_read_write()Bjoern A. Zeeb2026-02-031-0/+9
| | | | | | | | | Needed by a wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D55029
* lindebugfs: check that name is set as otherwise pfs_alloc_node_flags() panicsBjoern A. Zeeb2026-01-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | I have hit the case multiple times that some LinuxKPI field may not be set during driver bringup and lindebugfs would cause a panic. The backtrace goes like: strlen() at strlen+0x54 pfs_create_dir() at pfs_create_dir+0x41 debugfs_create_dir() at debugfs_create_dir+0xa1 ... While the problem is clearly in LinuxKPI or the driver, we likely should at least add an assert to pfs_create_dir() if name is NULL like we have for pfs_add_node() but for lindebugfs at least make this a graceful error and continue without creating the dir instead of panicing. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D54944
* LinuxKPI: 802.11: only announce netdev_features if any are setBjoern A. Zeeb2026-01-291-1/+3
| | | | | | | | Printing an empty netdev_features= line makes little sense even under bootverbose. Sponsored by: The FreeBSD Foundation MFC after: 3 days