aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* mfi(4): Add subvendor and subdevice for Fujitsu RAID Controller SAS 6Gbit/s ↵Michael Osipov5 days1-0/+1
| | | | | | | | | | | | | | | | 1GB (D3116) This is an OEM card from Fujitsu using an LSI SAS2208 ROC controller shipped with many Fujitsu PRIMERGY servers like RX300 S7. This chip is also recognized by mrsas(4) under the generic name for the controller chip. Controller description: https://www.fujitsu.com/global/products/computing/servers/primergy/blades/connection/cb-pmod-110426.html Reviewed by: ziaee MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D54520 (cherry picked from commit 8b210276cde207ca3dc1f7f46d5a6d32e0a1c51d)
* ipfilter: fix broken buildWarner Losh7 days2-6/+1
| | | | | | | | | Every commit earns me a dozen emails that LINT is broken. This should stop that. Fixes: eda1756d0454f ipfilter: Verify frentry on entry into kernel Sponsored by: Netflix (cherry picked from commit ddec4209b10d65ef19e1d1b884e1b876eab58c7d)
* ipfilter: Add missing kenv fetchCy Schubert7 days1-0/+2
| | | | | | | | | | | | When a module the environment must be explicitly fetched. Fixes: d9788eabffa4 PR: 291548 Noted by: markj Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D54242 MFC after: 3 days (cherry picked from commit a6ea80bc917510b5e056cc5a29b62dfd7b39d068)
* ipfilter: Disable ipfs(8) by defaultCy Schubert7 days5-1/+16
| | | | | | | | | | | | | | | At the moment ipfs(8) is a tool that can be easily abused. Though the concept is sound the implementation needs some work. ipfs(8) should be considered experimental at the moment. This commit also makes ipfs support in the kernel optional. Reviewed by: emaste, glebius MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53787 (cherry picked from commit 0ff0c19e7f70bc4d3f98196a8ad43de635cf13e5)
* ipfilter: Restrict ipfilter within a jailCy Schubert7 days4-0/+18
| | | | | | | | | | | | | | | | | | | | | | Add a sysctl/tunable (net.inet.ipf.jail_allowed) to control whether a jail can manage its own ipfilter rules, pools, and settings. A jail's control over its own ipfilter rules and settings may not be desireable. The default is jail access to ipfilter is denied. The host system can stil manage a jail's rules by attaching the rules, using the on keyword, limiting the rule to the jail's interface. Or the sysctl/tunable can be enabled to allow a jail control over its own ipfilter rules and settings. Implementation note: Rather than store the jail_allowed variable, referenced by sysctl(9), in a global area, storing the variable in the ipfilter softc is consistent with ipfilter's use of its softc. Discussed with: emaste, jrm MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53623 (cherry picked from commit d9788eabffa4b67fc534685fc3d9b8e3334af196)
* ipfilter: Restore used variableCy Schubert7 days1-1/+1
| | | | | | | One of the "unused" i variables is actually used. Fixes: 20c48f090b27 (cherry picked from commit 78c6cfdc3dc0b84aa2daf0f32c7c9cdf3b34fee5)
* ipfilter: Remove unused variableCy Schubert7 days2-2/+2
| | | | | | | | Reported by: jlduran Fixes: eda1756d0454, 821774dfbdaa MFC after: 1 week X-MFC with: eda1756d0454, 821774dfbdaa (cherry picked from commit 20c48f090b270d0124d5f0b31c6f3a639efbbc80)
* ipfilter: Verify ipnat on entry into kernelCy Schubert7 days1-1/+41
| | | | | | | | | | | | | | | | | | The ipnat struct is built by ipnat(8), specifically ipnat_y.y when parsing the ipnat configuration file (typically ipnat.conf). ipnat contains a variable length string field at the end of the struct. This data field, called in_names, may contain various text strings such as NIC names. There is no upper bound limit to the length of strings as long as the in_namelen length field specifies the length of in_names within the ipnat structure and in_size specifies the size of the ipnat structure itself. Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53843 (cherry picked from commit 821774dfbdaa12ef072ff7eaea8f9966a7e63935)
* ipfilter: Verify frentry on entry into kernelCy Schubert7 days3-2/+61
| | | | | | | | | | | | | | | | | | | | | | The frentry struct is built by ipf(8), specifically ipf_y.y when parsing the ipfilter configuration file (typically ipf.conf). frentry contains a variable length string field at the end of the struct. This data field, called fr_names, may contain various text strings such as NIC names, destination list (dstlist) names, and filter rule comments. The length field specifies the length of fr_names within the frentry structure and fr_size specifies the size of the frentry structure itself. The upper bound limit to the length of strings field is controlled by the fr_max_namelen sysctl/kenv or the max_namelen ipfilter tuneable. The initial concepts were discussed with emaste and jrm. Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53843 (cherry picked from commit eda1756d0454f9383940dc825cf571ff67e0c013)
* ipfilter: Add ipf_check_names_string()Cy Schubert7 days2-0/+32
| | | | | | | | | | | | | | ipf_check_names_string will verify userland inputs in names strings (fr.fr_names, in.in_names) for correctness. Original concept of ipf_check_names_string() instead of macros by markj. Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53843 (cherry picked from commit 525c535d5aa87f686dcfee620619827f7c6090db)
* sys/xen: Use __printflike() instead of format(printf)Alex Richardson8 days4-7/+7
| | | | | | | | | | The __printflike macro sets the format to freebsd_kprintf which recent clang understands and warns about. Fixes the following error: `passing 'printf' format string where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]` MFC after: 1 week (cherry picked from commit 4cd7be3e81863bd22aacccc34fc2e8b2cfcb14d9)
* ocs_fc: Use __printflike() instead of format(printf)Alex Richardson8 days4-13/+7
| | | | | | | | | | The __printflike macro sets the format to freebsd_kprintf which recent clang understands and warns about. Fixes the following error: `passing 'printf' format string where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]` MFC after: 1 week (cherry picked from commit 3c0ea1b629764c49611e3e3adfa0c44f9afa3558)
* crypto: avoid warnings about too-long initializer stringsDimitry Andric9 days1-2/+2
| | | | | | | | | | | | | | | | | | Mark `sigma` and `tau` as `__non_string`, to avoid warnings from clang 21 similar to: sys/crypto/chacha20/chacha.c:53:31: error: initializer-string for character array is too long, array size is 16 but initializer has size 17 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization] 53 | static const char sigma[16] = "expand 32-byte k"; | ^~~~~~~~~~~~~~~~~~ sys/crypto/chacha20/chacha.c:54:29: error: initializer-string for character array is too long, array size is 16 but initializer has size 17 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization] 54 | static const char tau[16] = "expand 16-byte k"; | ^~~~~~~~~~~~~~~~~~ MFC after: 3 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D54364 (cherry picked from commit 710ec409dffed3306ced253bba85dbdc7758510b)
* compat: linux: use appropriate variables for copying out old timersKyle Evans9 days1-2/+2
| | | | | | | | | | | | | | We copyout &l_oval but do the conversions into &l_val, leaving us with stack garbage. A build with an LLVM21 cross-toolchain seems to catch this. Reported by: Florian Limberger <flo purplekraken com> Reviewed by: markj Fixes: a1fd2911ddb06 ("linux(4): Implement timer_settime64 syscall.") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52985 (cherry picked from commit 541a98d7e28a8e4697ac2fa78dd4c4203c2c3a9c)
* Remove __deprecated definition from OpenZFS compiler.hDimitry Andric13 days1-1/+0
| | | | | | | Since it is now provided by <sys/cdefs.h>. Direct commit to stable/13, since OpenZFS compiler.h has been substantially changed in newer branches.
* cdefs: Add __deprecated1 which accepts a message as an argumentJohn Baldwin13 days1-0/+1
| | | | | | | | | | This message will be included in any warning issued by the compiler for use of the deprecated function. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47701 (cherry picked from commit 6da04bcff9efedeae7d4046553002b9e3b2bc24f)
* cdefs: Add __deprecatedWarner Losh13 days2-0/+3
| | | | | | | | | | | | | | | | | | Add __deprecated decorator. This is for a deprecated interface. copystr is tagged with this today in copy(9), but don't actually provide it or use it. copystr is a #define so adding it will have to wait. LinuxKPI was defining this away completely in compiler.h. Since this is shared between Linux KPI consumers and OpenZFS, if it's already defined, use the FreeBSD sys/cdefs.h version, otherwise define it away. For OpenZFS this will retain it, while for Linux KPI it will tend to drop it (I think always, but I didn't look at everything). Sponsored by: Netflix Reviewed by: jhb, emaste Differential Revision: https://reviews.freebsd.org/D46137 (cherry picked from commit 16672453f12586703f1c51d909bd1900691bf884)
* sys/cdefs.h: add __noexcept and __noexcept_ifLexi Winter13 days1-0/+11
| | | | | | | | | | | | | | | | These macros provide the C++11 noexcept and noexcept(...) keywords if we're compiling in a C++11 environment. Otherwise, they expand to an empty string. This will be used to add the required noexcept specifier to several libc functions as required in C++11. MFC after: 2 weeks Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1085 (cherry picked from commit 02b0d4b688cc4deb14cb6e7534a2a4958e48b753)
* sys/font.h: avoid warnings about too-long initializer stringsDimitry Andric13 days1-1/+1
| | | | | | | | | | | | | | | | Mark `font_header::fh_magic` as `__non_string`, to avoid a warning from clang 21 similar to: /usr/src/usr.bin/vtfontcvt/vtfontcvt.c:763:15: error: initializer-string for character array is too long, array size is 8 but initializer has size 9 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization] 763 | .fh_magic = FONT_HEADER_MAGIC, | ^~~~~~~~~~~~~~~~~ /usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/font.h:109:27: note: expanded from macro 'FONT_HEADER_MAGIC' 109 | #define FONT_HEADER_MAGIC "VFNT0002" | ^~~~~~~~~~ MFC after: 3 days (cherry picked from commit e2c93ed09f259ed049923bdaa9b697b3586e2f1a)
* cdefs.h: Introduce __nonstring attributeAlex Richardson13 days1-0/+7
| | | | | | | | | | | | This attribute can be used to annotate char arrays that are not supposed to be terminated with a NUL char and is needed to silence clang's new -Wunterminated-string-initialization warning. The name matches linuxkpi. Reviewed by: emaste, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52565 (cherry picked from commit 802c6d5d61d15494a54a386dc2ffbcfefc68c8ab)
* ipfilter: Prevent stack buffer overflowDag-Erling Smørgrav2025-12-191-14/+37
| | | | | | | | | | | | | | | | | | When copying ipfs data from user space, don't just check that the payload length is nonzero, but also that it does not exceed the size of the stack buffer we're copying it into. While we're at it, use a union to create a buffer of the exact size we need instead of guessing that 2048 will be enough (and not too much). Finally, check the size of the payload once it gets to where it's used. MFC after: 3 days Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D54194 (cherry picked from commit a34c50fbd2a52bb63acde82e5aec4cb57880e39b)
* proc: Fix proc_init / proc_dtor ordering issuesDag-Erling Smørgrav2025-12-192-6/+6
| | | | | | | | | | | | | | | | | | | | * Move the initialization of p_ktr into proc_init() and make the check in proc_dtor() unconditional. Prior to this, it was possible to fail and invoke proc_dtor() after the first thread had been created (which was the condition for checking p_ktr in proc_dtor()) but before p_ktr had been initialized. * Move the p_klist initialization in fork1() past the last possible failure point so we don't have to free it on failure. We didn't, which meant we were leaking a knlist every time we failed to fork due to hitting the resource limit. PR: 291470 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54215 (cherry picked from commit 026d962ef14dafe19fa73361bea6dcc95f141dfa)
* vfs: Let prison_enforce_statfs zero the fsidDag-Erling Smørgrav2025-12-192-4/+4
| | | | | | | | | | | | | | Currently, we unconditionally zero the fsid before returning a struct statfs to a jailed process. Move this into prison_enforce_statfs() so it only happens if enforce_statfs is greater than 1, or enforce_statfs is 1 but the mountpoint is outside the jail. PR: 291301 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54214 (cherry picked from commit d4f25d0c7957f0f1960028eec82625c2d6405537)
* netlink: Don't overwrite existing data in a linear buffer in snl_writerJohn Baldwin2025-12-191-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, a bit of background on some of the data structures netlink uses to manage data associated with a netlink connection. - struct linear_buffer contains a single virtually-contiguous buffer of bytes. Regions of this buffer are suballocated via lb_allocz() which uses a simple "bump" where the buffer is split into an allocated region at the start and a free region at the end. Each allocation "bumps" the boundary (lb->offset) forward by the allocation size. Individual allocations are not freed. Instead, the entire buffer is freed once all of the allocations are no longer in use. Linear buffers also contain an embedded link to permit chaining buffers together. - snl_state contains various state for a netlink connection including a chain of linear buffers. This chain of linear buffers can contain allocations for netlink messages as well as other ancillary data buffers such as socket address structures. The chain of linear buffers are freed once the connection is torn down. - snl_writer is used to construct a message written on a netlink connection. It contains a single virtually-contiguous buffer (nw->base) allocated from the associated snl_state's linear buffer chain. The buffer distinguishes between the amount of space reserved from the underlying allocator (nw->size) and the current message length actually written (nw->offset). As new chunks of data (e.g. netlink attributes) are added to the write buffer, the buffer is grown by snl_realloc_msg_buffer by reallocating a larger buffer from the associated snl_state and copying over the current message data to the new buffer. Commit 0c511bafdd5b309505c13c8dc7c6816686d1e103 aimed to fix two bugs in snl_realloc_msg_buffer. The first bug is that snl_realloc_msg_buffer originally failed to update nw->size after growing the buffer which could result in spurious re-allocations when growing in the future. It also probably could eventually lead to overflowing the buffer since each reallocation request was just adding the new bytes needed for a chunk to the original 'nw->size' while 'nw->offset' kept growing. Eventually the new 'nw->offset' would be larger than 'nw->size + sz' causing routines like snl_reserve_msg_data_raw() to return an out-of-bounds pointer. The second change in this commit I think was trying to fix the buffer overflows due to 'nw->size' being wrong, but instead introduced a new set of bugs. The second change ignored the returned pointer from snl_allocz() and instead assumed it could use all of the currently-allocated data in the current linear buffer. This is only ok if the only data in the linear buffer chain for the associated snl_state is the snl_writer's message buffer. If there is any other data allocated from the snl_state, it could be earlier in the current linear buffer, so resetting new_base to nw->ss->lb->base can result in overwriting that other data. The second change was also over-allocating storage from the underlying chain of linear buffers (e.g. a writer allocation of 256 followed by 512 would end up using the first 512 bytes, but 768 bytes would be reserved in the underlying linear buffer). To fix, revert the second change keeping only the fix for 'nw->size' being wrong. Reviewed by: igoro, markj Fixes: 0c511bafdd5b ("netlink: fix snl_writer and linear_buffer re-allocation logic") Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54148 (cherry picked from commit 255af72c8059b0117db646f82efa2e4848fa7570)
* Revert "ipfilter: Add missing kenv fetch"Cy Schubert2025-12-191-2/+0
| | | | | | | The commit depends on d9788eabffa4b67fc534685fc3d9b8e3334af196 which has not been merged yet. This reverts commit fb20aad3e846bf42d98f9e84d5035e4d16115f95.
* ipfilter: Add missing kenv fetchCy Schubert2025-12-191-0/+2
| | | | | | | | | | | | When a module the environment must be explicitly fetched. Fixes: d9788eabffa4 PR: 291548 Noted by: markj Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D54242 (cherry picked from commit a6ea80bc917510b5e056cc5a29b62dfd7b39d068)
* agp: Export intel_gtt_read_pte, required by i915kmsEd Maste2025-12-151-0/+1
| | | | | | | | | | | | | | This isn't used by modern cards, but is needed for i915kms to load on a system that has agp as a module not compiled into the kernel. PR: 291214 Reviewed by: cy Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53906 (cherry picked from commit a87c1e2dd8fc997d6ee603c252c543afe8a4d2a4) (cherry picked from commit 8befd2d2b6a0c5d54fa53246a89ae09009007799) (cherry picked from commit ae1f6fd47c4584d1abe5ecf26f291d282e6f6a67)
* mips: Include CCLDFLAGS when linking kernel.tramp.binJessica Clarke2025-12-151-1/+1
| | | | | | | | This ensures we pick up -fuse-ld/--ld-path for external toolchains rather than trying to use the default system linker, which may not exist (e.g. on macOS). This is a direct commit to stable/13 as mips no longer exists in main.
* mips: Drop unused TRAMP_LDFLAGSJessica Clarke2025-12-151-1/+1
| | | | | | | This has always been empty since e8dce5b9b3a5 ("Complete the integration of tbemd branch into head."). This is a direct commit to stable/13 as mips no longer exists in main.
* imgact_elf: Fix off-by-one in note size checkJessica Clarke2025-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to c86af2cc4cd1 ("imgact_elf: Check note body sizes"), this was note_name + n_namesz >= note_end, which checks that there is at least one byte after the unpadded name (which could be either padding or data), and given our notes always have data with them this was fine. However, once we started checking the padded name (note that "FreeBSD\0" is already a multiple of 4 bytes, so has no padding) and data, this turned into checking that there is at least one byte after the unpadded data, and since our ELF notes already have a multiple of 4 bytes for their data and therefore have no padding, this means that we are now checking that there is at least one byte after the ELF note, which is not going to be the case for the last ELF note. Instead, switch this to a strict greater than, as should be used when comparing one-past-the-end pointers, which both sides of the inequality are. For executables, this was generally not a problem in reality, since the last of our ELF notes is NT_FREEBSD_NOINIT_TAG, which isn't read by the kernel. However, ld-elf.so.1 (and libcompat variants), like shared libraries, only has NT_FREEBSD_ABI_TAG, which meant the kernel did not see this ELF note when directly executing it (e.g. as done by ldd), and on RISC-V this is the only branding present, so doing so would fail with ENOEXEC. This does also mean on non-RISC-V direct exec ld-elf.so.1 runs with the wrong p_osrel, but given it sets kern.proc.osrel.PID to the executable's NT_FREEBSD_ABI_TAG that it loads, this probably doesn't matter in practice. PR: 291446 Reported by: bdragon Tested by: bdragon Fixes: c86af2cc4cd1 ("imgact_elf: Check note body sizes") MFC after: 3 days (cherry picked from commit 5d58198ccc2b562098ee5fc4898013622b32b065)
* sys: Various whitespace style(9) fixes for sys/elf_common.hJessica Clarke2025-12-151-10/+10
| | | | | | MFC after: 1 week (cherry picked from commit 22ae840b9f0ff290cb08edacf975a99d264d3a0d)
* sys: Sync RISC-V relocationsJessica Clarke2025-12-151-1/+10
| | | | | | MFC after: 1 week (cherry picked from commit 65bd6c7acd1fba38ce0b234d5d777a2ebad7e807)
* elf: Remove R_RISCV_[GT]PREL_[IS] relocation definesJessica Clarke2025-12-151-4/+0
| | | | | | | | | | | These were internal binutils relocations that have no way to be generated in assembly nor will ever be seen in the output, and so should never have been defined in the psABI in the first place. They have therefore been removed from the spec as of [1], so do so here too. [1] https://github.com/riscv/riscv-elf-psabi-doc/commit/44f98e0fd8104def00f2a5a8d94b23dd647d18fb (cherry picked from commit f221000127767d33ea06d3a00e731c0164f9a70f)
* sys: Delete stale comments in sys/elf_common.hJessica Clarke2025-12-151-3/+0
| | | | | | | | | | | | | | Originally the relocations for RISC-V were partitioned into dynamic and static (with those that are both being classed as dynamic), but they were packed next to each other, and so as new relocations were added they were allocated sequentially, at the end of the static block, even if really dynamic, R_RISCV_IRELATIVE being the first such case (and only one we currently have a definition for). Delete the misleading comments. Fixes: 4b88ccbc79cc ("Sync relocation definitions") MFC after: 1 week (cherry picked from commit d26f481bcdfec9354614ccc0f7f694bd7bcc5a6c)
* riscv: Fix and generalise saving TP (PCPU pointer) whilst in userspaceJessica Clarke2025-12-155-15/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In cpu_fork, we allocate sizeof(struct pcb) + sizeof(struct trapframe) space on the stack, then round it for stack alignment. This not only fails to include the space needed for TP but also doesn't round up the trapframe allocation to be stack-aligned, yet TF_SIZE does, as is the expectation of fork_trampoline and cpu_exception_handler. Given that sizeof(struct pcb) + sizeof(struct trapframe) is a multiple of 16, this causes the saved TP to be stored in the PCB's pcb_sp (the intended trapframe padding aliasing pcb_ra), which is probably harmless in practice as the PCB isn't expected to be current, but definitely not intended. In cpu_thread_alloc, we do include the 8 bytes for TP and then stack align that. This again fails to include the padding for trapframe as present in TF_SIZE, but sizeof(struct pcb) + sizeof(struct trapframe) happens to be a multiple of 16, as above, so adding 8 then rounding to stack alignment (16) includes an extra 8 bytes of padding, giving the right result for the wrong reason (and could be broken by future struct growth). Extract the calculation into a shared function that rounds correctly regardless of the struct layouts. Also introduce a new struct kernframe to encapsulate and clearly document this shared state rather than using magic constants, and also enable it to be easily extended in future, as we intend to do downstream in CheriBSD. Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48799 (cherry picked from commit 21c534b9f5d5de07137f9a42e016876dd6ae66c1)
* ofw: Fix inverted bcmp in ofw_bus_node_status_okayJessica Clarke2025-12-151-1/+1
| | | | | | | | | Otherwise this matches any two-character status except for ok. Fixes: e5e94d2de987 ("Expand OpenFirmware API with ofw_bus_node_status_okay method") MFC after: 1 week (cherry picked from commit e1060f6dfd80b34cab6d439bf7420ad686ddc8f1)
* gic_v3: Correctly handle GICC GIGR Base Address caseJessica Clarke2025-12-153-1/+9
| | | | | | | | | | | | | | | | | | | | When using the GICR Base Address field from each GICC structure instead of GICR structures, the field gives the address of a single redistributor page. However, that does not mean that they are not contiguous, and so GICR_TYPER.Last could be clear on them. Thus we must ignore GICR_TYPER.Last in this case and always treat each region as having a single page. Normally we'd do that as a result of checking against the rman's size (though that's a rather roundabout and iffy way of achieving it), but for whatever reason this is bigger on the Qualcomm Snapdragon X Elite (I assume the MADT reports GICv4 but TYPER doesn't report VLPIS and so there is a mismatch between the rman size and the stride used) and we end up walking off the region's mapping. Reviewed by: andrew, phk MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47560 (cherry picked from commit f8c90b704189c94275d22d7cc204d1d74e821d86)
* sys/cdefs.h: Add comments to make #if/#else/#endif triple more obviousJessica Clarke2025-12-151-2/+2
| | | | | | | | | | | This block has a lot of nesting, not helped by two adjacent nested blocks involving _POSIX_C_SOURCE, with only the inner one commented, looking like it's the end of the outer one. Comment the outer one as well so it's not quite so hard to figure out. MFC after: 1 week (cherry picked from commit 7a3af393d8ac2dfe72d24fe401344b60c4f87866)
* Merge commit 88433e640ddb from upstream OpenZFS (by Jessica Clarke)Jessica Clarke2025-12-151-5/+0
| | | | | | | | | | | | | | | | | | | | | sys/types32.h: Remove struct timeval32 from libspl's header (#16491) macOS Sequoia's sys/sockio.h, as included by various bootstrap tools whilst building FreeBSD, has started to include net/if.h, which then includes sys/_types/_timeval32.h and provide a conflicting definition for struct timeval32. Since this type is entirely unused within OpenZFS, simply delete the type rather than adding in some kind of OS detection. This fixes building FreeBSD on macOS Sequoia (Beta). Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com> Reviewed-by: Rob Norris <rob.norris@klarasystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> MFC after: 1 week (cherry picked from commit 796c6031cde6dfdd92b4d178792fc0534bf788c5)
* gpart: Add u-boot-env alias for U-Boot's environment GPT partition UUIDJessica Clarke2025-12-154-0/+7
| | | | | | | | This is a platform-independent UUID, and this is the name U-Boot uses. MFC after: 1 week (cherry picked from commit b162fc3f3094c50c8ed47ab50981c5448cf0052c)
* riscv: Add machine/ifunc.h corresponding to rtld-elf's resolver interfaceJessica Clarke2025-12-151-0/+49
| | | | | | | | Reviewed by: kib, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D46279 (cherry picked from commit 8afae0caf4c4816eb56b732fcd1a4b185e86098a)
* riscv: Recognise B extension for AT_HWCAPJessica Clarke2025-12-152-0/+2
| | | | | | | | | | | | This was ratified earlier this year as an alias for Zba_Zbb_Zbs. Whilst we don't currently export multi-letter extensions, we can still export this alias in AT_HWCAP. Reviewed by: mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D46277 (cherry picked from commit 228a3e73e16983bc7f985b24ef20909500792d3c)
* riscv: Remove the unused riscv64_cpu driverJessica Clarke2025-12-151-77/+0
| | | | | | | | | | | | | This is a repeat of 63bf2d735ca3 ("Remove the unused arm64_cpu driver.") for RISC-V, which copied the defunct code from arm64 with no changes beyond substituting riscv64 for arm64, and made no use of it elsewhere. It has thus always been entirely superfluous. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43672 (cherry picked from commit 722b40377198e384a808f9561ae7262767068ab2)
* vfs_cache: Fix the SDT definition of vfs:fplookup:lookup:doneMateusz Piotrowski2025-12-151-1/+2
| | | | | | | | | | | | | | | 1. The definition lists struct nameidata as the type of the first argument. However, the actual probes always pass a variable of type struct nameidata* to SDT_PROBE3. 2. The third argument (args[2]) is actually enum cache_fpl_status. Reviewed by: markj Approved by: markj (mentor) Fixes: 07d2145a1717 vfs: add the infrastructure for lockless lookup MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51315 (cherry picked from commit 6567623f831daaffa67777d17780e8f424c1bb01)
* netmap: Fix error handling in nm_os_extmem_create()Mark Johnston2025-12-151-0/+1
| | | | | | | | | | | | | | We bump the object reference count prior to mapping it into the kernel map, at which point the vm_map_entry owns the reference. Then, if vm_map_wire() fails, vm_map_remove() will release the reference, so we should avoid decrementing it in the error path. Reported by: Ilja van Sprundel <ivansprundel@ioactive.com> Reviewed by: vmaffione MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53066 (cherry picked from commit dfc1041c08ba32f24b8050b4d635a0bbbfd9b767)
* bus: Return 0 if reading an ivar failsDag-Erling Smørgrav2025-12-121-1/+1
| | | | | | | | | | | | | In the non-INVARIANTS case, return 0 rather than stack garbage if reading an ivar fails (in the INVARIANTS case, we still panic). MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D54078 (cherry picked from commit 4c2295c15860e70c8bd3f05f9229d2fc40dfd50d)
* pf: relax sctp v_tag verificationKristof Provost2025-12-111-2/+6
| | | | | | | | | | | | | | | | | | pf was too strict when validating SCTP tags. When a server receives a retransmitted INIT it will reply with a random initiate tag every time. However, pf saves the first initiate tag and expects every subsequent INIT_ACK retransmission to have the same tag. This is not the case, leading to endless INIT/INIT_ACK cycles. Allow the tag to be updated as long as we've not gone past COOKIE_WAIT. Add a test case to verify this. MFC after: 2 weeks See also: https://redmine.pfsense.org/issues/16516 Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit bc3b72ff48953551e0e8bd6e5a2c718ecd973285)
* pfsync: fix incorrect unlock during destroyKristof Provost2025-12-081-2/+2
| | | | | | | | | | | | | | | During pfsync_clone_destroy() we clean up pending packets. This may involve calling pfsync_undefer() or callout_drain(). We may not hold the bucket lock during callout_drain(), but must hold it during pfsync_undefer(). We incorrectly always released the lock, leading to assertion failures during cleanup if there were pending deferred packets. MFC after: 1 week Sponsored by: Orange Business Services (cherry picked from commit 639e65144aa71cb03b5431861803f528308760dc)
* pf: handle divert packetsKristof Provost2025-11-291-10/+14
| | | | | | | | | | | | | | | In a divert setup pf_test_state() may return PF_PASS, but not set the state pointer. We didn't handle that, and as a result crashed immediately afterwards trying to dereference that NULL state pointer. Add a test case to provoke the problem. PR: 260867 MFC after: 2 weeks Submitted by: Phil Budne <phil.budne@gmail.com> Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 66f2f1c83247f05a3a599d7e88c7e7efbedd16b5)
* namei: Fix cn_flags width in various placesMark Johnston2025-11-196-11/+12
| | | | | | | | | | | This truncation is mostly harmless today, but fix it anyway to avoid pain later down the road. Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50417 (cherry picked from commit 0d224af399a66f00a5b33e5512fc018062cabf1d)