summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-10-19netfilter: nft_payload: restrict checksum offsets to known valuesFlorian Westphal
We need to prevent userspace from corrupting e.g. tcp->doff, because many locations in conntrack and conntrack helpers rely on nf_conntrack_in() having validated the packet headers. nft_payload allows to alter headers later which invalidates this assumption. The 'Fixes' commit restricts writes to safe fields, but there is another side channel: the checksum location. Restrict this too. Reported via sashiko/gemini. Fixes: 112e447d17f7 ("netfilter: validate L4 headers after userspace packet writes") Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-10-19netfilter: nf_conntrack: avoid truncating IPv6 nexthdr offsetJérémy Jean
find_prev_fhdr() returns the offset of the Next Header field before an IPv6 Fragment header through an int pointer, but stores the offset in a u8 local. An extension header chain can put this field beyond byte 255, causing the offset to wrap before it is saved in the fragment queue. Reassembly later uses the wrapped value to update the preceding Next Header field. This overwrites another byte in the IPv6 header chain and can make conntrack parse a different transport tuple from the one used by IPv6 local delivery. A two-fragment packet can, for example, be recorded as UDP destination port 53 while its payload is delivered to UDP port 9999. Use int for the working offset, matching the output argument and the other offset variables in this path. Fixes: 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.") Assisted-by: Codex:gpt-5 Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-10-19Merge branches 'acpi-pcc', 'acpi-numa', 'acpi-pfrut', 'acpi-misc' and 'pnp'Rafael J. Wysocki
Merge updates of the ACPI PCC (Platform Communications Channel) driver, ACPI NUMA support code, ACPI Platform Firmware Runtime Update and Telemetry driver, ACPI WMI support code, and a PNP update for 7.4: - Fix the shared memory signature handling in the ACPI PCC address space handler, free the PCC mailbox channel on operation region deactivation, and avoid unnecessary repeated computations of the PCC operation region command timeout (Sudeep Holla) - Fix a log message typo in the ACPI NUMA support code (Hemanth Selam) - Zero-initialize capability query result in the ACPI Platform Firmware Runtime Update and Telemetry driver to avoid disclosure of kernel stack data to user space (Karl Mehltretter) - Replace the remaining built-in/module check for CONFIG_ACPI_WMI in a header file with IS_ENABLED() macro (Lalit Shankar Chowdhury) - Detach device after resource transition failure in pnp_device_probe() to avoid blocking later manual PNP configuration attempts (Myeonghun Pak) * acpi-pcc: ACPI: PCC: Cache OpRegion command timeout ACPI: PCC: Free channel on OpRegion deactivation ACPI: PCC: Preserve shared memory signature in OpRegion handler * acpi-numa: ACPI: NUMA: fix typo in log message * acpi-pfrut: ACPI: pfr_update: zero-initialize capability query result * acpi-misc: ACPI: WMI: use IS_ENABLED() to simplify built-in or module check * pnp: PNP: Detach device after resource transition failure
2026-10-19Merge branches 'acpi-battery', 'acpi-sbs', 'acpi-button' and 'acpi-video'Rafael J. Wysocki
Merge updates of the ACPI battery, ACPI SBS (Smart Battery System), ACPI button, and ACPI video bus device drivers for 7.4: - Fix bogus cycle count values on systems without _BIX in the ACPI battery driver (Armin Wolf) - Fix NULL pointer dereference on allocation failure and report relative state of charge as CAPACITY in the ACPI SBS driver (Itay Shem-tov and Guangshuo Li) - Add lid_init_state quirk for Razer Blade Stealth 13 (Early 2020) RZ09-0310 to the ACPI button driver (Ian Gallagher) - Add new quirks to force the native backlight on Dell OptiPlex AIO 7410 35W and Acer Nitro AN515-58 in the ACPI video bus device driver (Chitransh Mandhaniya and Dirga Yuza) * acpi-battery: ACPI: battery: Fix bogus cycle count values on systems without _BIX * acpi-sbs: ACPI: SBS: Fix NULL pointer dereference on allocation failure ACPI: SBS: report relative state of charge as CAPACITY * acpi-button: ACPI: button: Add lid_init_state quirk for Razer Blade Stealth 13 (Early 2020) RZ09-0310 * acpi-video: ACPI: video: force native backlight on Dell OptiPlex AIO 7410 35W ACPI: video: add backlight=native DMI quirk on Acer Nitro AN515-58
2026-10-19Merge branch 'acpi-driver'Rafael J. Wysocki
Merge changes related to ACPI support in device drivers for 7.4: - Switch over the users of acpi_get_first_physical_node(), that was inherently racy and therefore not really safe to use, to use its replacement acpi_bus_get_primary_device(), and eliminate the former (Rafael Wysocki) - Add !CONFIG_ACPI stubs for acpi_find_child_device() and acpi_device_uid() (Mario Limonciello and Robin Murphy) * acpi-driver: ACPI: bus: Drop acpi_get_first_physical_node() efi/dev-path-parser: Switch to use acpi_bus_get_primary_device() ALSA: hda: tas2781: Switch to use acpi_bus_get_primary_device() ALSA: hda: cs35l41: Switch to use acpi_bus_get_primary_device() iommu/arm-smmu-v3: Switch to use acpi_bus_get_primary_device() ACPI: Add stub for acpi_find_child_device() ACPI: bus: Provide !ACPI stub for acpi_device_uid() ALSA: hda: aw88399: Switch to use acpi_bus_get_primary_device() ASoC: loongson: Switch to use acpi_bus_get_primary_device() ASoC: intel: boards: Switch to use acpi_bus_get_primary_device() ASoC: amd: acp3x-es83xx: Switch to use acpi_bus_get_primary_device() ASoC: amd: acp-es8336: Switch to use acpi_bus_get_primary_device() thunderbolt: Switch to use acpi_bus_get_primary_device() platform/x86: apple-gmux: Switch to use acpi_bus_get_primary_device() platform/x86: x86-android-tablets: Use acpi_bus_get_primary_device() platform/x86: serdev_helpers: Switch to use acpi_bus_get_primary_device() platform/x86: yogabook: Switch to use acpi_bus_get_primary_device() ACPI: amba: Switch to use acpi_bus_get_primary_device() ACPI: bus: Use acpi/acpi_bus.h without CONFIG_ACPI
2026-10-19Merge branches 'acpica' and 'acpi-thermal'Rafael J. Wysocki
Merge ACPICA updates and ACPI thermal control updates for 7.4: - Add IOVT IOMMU support to ACPICA (Bibo Mao) - Fix PCC OperationRegion command offsets in ACPICA (Sudeep Holla) - Fix memory leak in acpi_ds_create_field() related to the handling of internal_pcc_buffer allocations (Breno Leitao) - Fix memory leak due to leftover devm_kcalloc() argument in the ACPI fan driver (Rafael Wysocki) - Fix backlight unregistration ordering in the ACPI video bus device driver (Rafael Wysocki) - Update the thermal core to allow the registration of thermal class cooling devices under specific parents and convert the ACPI fan, ACPI processor, and ACPI video bus device drivers to do so (Rafael Wysocki) - Adjust the ACPI thermal zone driver to use thermal class cooling device parent information for binding cooling devices to trip points in thermal zones (Rafael Wysocki) - Use cooling device data that is a better match for a given driver instread of a struct acpi_device pointer that had to be used for this purpose previously in the ACPI fan and processor drivers (Rafael Wysocki) - Fix acpi_thermal_guess_offset() in the ACPI thermal zone driver for thermal zone devices with a 273.0°K offset (Hans de Goede) - Define a free for ACPI objects allocated by ACPICA helpers and use it to simplify AML error handling in the ACPI fan driver (Rafael Wysocki) * acpica: ACPICA: actbl2.h: Add bit constants of the Flags field in the IOVT IOMMU structure ACPICA: Fix PCC OperationRegion command offsets ACPICA: Fix memory leak in acpi_ds_create_field() * acpi-thermal: ACPI: fan: Use __free() to simplify AML error handling ACPI: thermal: Fix acpi_thermal_guess_offset() for device with a 273.0°K offset ACPI: fan: Use more suitable cooling device data ACPI: fan: Store ACPI device pointer in struct acpi_fan ACPI: processor: thermal: Use more suitable cooling device data ACPI: thermal: Use cooling device parent for thermal zone binding ACPI: fan: Use thermal_cooling_device_create() ACPI: video: Use thermal_cooling_device_create() ACPI: processor: thermal: Use thermal_cooling_device_create() thermal: core: Introduce thermal_cooling_device_create() ACPI: video: Fix backlight unregistration ordering ACPI: fan: Fix memory leak due to leftover devm_kcalloc() argument
2026-10-19mm/slub: initialize the free pointer of the bootstrap kmem_cache_nodeKarl Mehltretter
With slub_debug=FZPU, validating kmem_cache_node reports BUG kmem_cache_node (Not tainted): Freepointer corrupt Object 0xffff888000140040 @offset=64 fp=0x5a5a5a5a5a5a5a5a and taints the kernel. Poisoning places the bootstrap object's free pointer outside the object, where check_object() checks it even while allocated. early_kmem_cache_node_alloc() previously took this object from a freelist with an initialized pointer. It now takes it from the slab iterator and builds the freelist only for the remaining objects, leaving its pointer filled with POISON_INUSE. Initialize the bootstrap object's free pointer to NULL. Fixes: dc795d4c0282 ("mm/slub: defer freelist construction until after bulk allocation from a new slab") Assisted-by: LLM Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Reviewed-by: Harry Yoo (Meta) <harry@kernel.org> Link: https://patch.msgid.link/20261010203906.93156-1-kmehltretter@gmail.com Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Reviewed-by: Shengming Hu <hu.shengming@zte.com.cn> Tested-by: David Rientjes <rientjes@google.com> Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
2026-10-19HID: nintendo: introduce dependency in USB_HIDJiri Kosina
hid-nintendo does depend on USB_HID. Reflect that in Kconfig. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202610171559.gZ0QBMFv-lkp@intel.com/ Signed-off-by: Jiri Kosina <jkosina@suse.com>
2026-10-19drm/panic: Accept a trailing newline in panic_screenDevin Wittmayer
Setting the panic screen through sysfs with echo fails with EINVAL, because the value ends in a newline. Ignore it when matching. Fixes: e85e9ccf3f84 ("drm/panic: Report invalid or unsupported panic modes") Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20261016052722.60051-2-lucid_duck@justthetip.ca Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2026-10-19drm/panic: Fix kmsg screen hang on a long log lineDevin Wittmayer
The kmsg panic screen reads the log back one chunk at a time. A record that does not fit in a chunk comes back empty without moving on, so the screen asks for it again forever and the panic never finishes. Every oops logs the list of loaded modules, and on my machine that list does not fit. Read into a buffer the size printk formats one record into, and stop if a read still comes back empty. Fixes: 54034bebb22f ("drm/panic: Add a kmsg panic screen") Cc: stable@vger.kernel.org Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20261016052722.60051-1-lucid_duck@justthetip.ca Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2026-10-19drm/panic: Fix the loop that causes kmsg to not display correctlyluyuantao
When kmsg_buf completes drawing the screen and yoffset is less than 0, kmsg_dump_get_buffer continues to obtain the buffer. This potential loop may cause panic_flush not to be executed immediately or even not to be executed at all, resulting in a garbled screen display instead of normal logs So, the loop should be exited immediately after drawing kmsg_buf Signed-off-by: luyuantao <luyuantao@kylinos.cn> Acked-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260126100732.365-1-luyuantao01@163.com Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2026-10-19octeontx2-af: Fix CQ enable state tracking after AQ writesAlok Tiwari
Use the CQ context's ena field when updating the CQ enable bitmap. The current code reads rq.ena, which overlaps bit 0 of the CQ base address and can leave the bitmap out of sync with the hardware context. This can cause enabled CQs to be skipped during teardown. Use sq.ena for the SQ bitmap update as well, so each queue type reads its own context. Fixes: 557dd485eaeb ("octeontx2-af: Support for disabling NIX RQ/SQ/CQ contexts") Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com> Reviewed-by: Ratheesh Kannoth <rkannoth@marvell.com> Reviewed-by: Sunil Goutham <sgoutham@marvell.com> Link: https://patch.msgid.link/20261011125508.534618-1-alok.a.tiwari@oracle.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-10-19ALSA: usb-audio: Simplify usb_audio_make_longname()Thorsten Blum
To prepare for removing strlcat() from the kernel [1], track the output length and replace strlcat() with scnprintf() and strscpy(). Replace the speed switch statement with a lookup table. No functional change. Link: https://github.com/KSPP/linux/issues/370 [1] Signed-off-by: Thorsten Blum <blum@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20261018124155.2081-4-blum@kernel.org
2026-10-19ALSA: usb-audio: Simplify usb_audio_make_shortname()Thorsten Blum
Copy the preset and quirk product names directly and remove the local char s pointer. Return after trimming the device product name and use the USB device ID as a fallback. No functional change. Signed-off-by: Thorsten Blum <blum@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20261018124155.2081-3-blum@kernel.org
2026-10-19ALSA: usb-audio: Fix missing sample-rate control for PreSonus AudioBox USBThomas Nemer
The fixed audio formats for the PreSonus AudioBox USB declare .attributes = 0, dropping UAC_EP_CS_ATTR_SAMPLE_RATE that the device advertises in its class-specific endpoint descriptors (EP_GENERAL bmAttributes 0x01 on both EP 0x01 and EP 0x82). As a result set_sample_rate_v1() bails out and the kernel never sends the UAC1 SET_CUR SAMPLING_FREQ request, leaving the device on its power-on default clock. Playback and capture then run distorted whenever the stream rate differs from that default. The device keeps the last rate set by a host as long as it stays powered, which made the regression look intermittent (e.g. it disappears after the device was initialized by a host running a kernel without this quirk entry). Restore the sample-rate attribute on both streams. Fixes: 34fe4a9df247 ("ALSA: usb-audio: Add quirk for PreSonus AudioBox USB") Cc: stable@vger.kernel.org Signed-off-by: Thomas Nemer <thomas.nemer@fortytwo.fr> Link: https://patch.msgid.link/20261018111519.191844-1-thomas.nemer@fortytwo.fr Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-10-19Merge branch 'for-next' into for-linusTakashi Iwai
Pull 7.4 merge-window stuff. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-10-19ALSA: hda/realtek: Fix headset mic on ASUS Zenbook 14 UX3402VAGeorge Christidis
The UX3402VA (1043:16a3) BIOS leaves pin 0x19 unconfigured, so the headset mic does not work. Use ALC294_FIXUP_ASUS_SPI_HEADSET_MIC like the UX3405MA, it sets up the mic and keeps the CS35L41 speaker fixup. Tested on a UX3402VA: headset mic, internal mic and speakers work. Fixes: 07058dceb038 ("ALSA: hda/realtek: Splitting the UX3402 into two separate models") Cc: stable@vger.kernel.org Signed-off-by: George Christidis <gxristidis@gmail.com> Link: https://patch.msgid.link/20261018-for-linus-v1-1-4d8e9ff27d89@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-10-19ALSA: oss: Keep emulation modules loaded until object teardownCen Zhang
OSS proc entries and notifier callbacks can remain in use without an open OSS device file. Normal snd-pcm-oss removal can therefore delete an existing PCM's OSS proc entry while late HDA codec binding repeats snd_card_register() on the same live card: OSS PCM module unload Card registration --------------------- ----------------- snd_info_free_entry(entry) proc_remove(entry->p) clear entry->p snd_info_card_register() republish linked entry unlink and free entry The new proc node retains a pointer to freed storage. Mixer OSS removal can likewise release an adapter while a card notification still uses it. Hold a snd-pcm-oss module reference for each PCM registered with its notifier and a snd-mixer-oss reference for each card adapter. Release them at final unregister or FREE, after proc and adapter cleanup. Normal module unload can no longer initiate removal while these objects exist. Track PCM OSS registration with a separate bool registered. Unlike oss.reg, this state also covers unmapped PCMs and remains set across DISCONNECT until final unregister. BUILD-state and creation-error cleanup must not drop a reference when registration never acquired one. The PCM notifier's register_mutex serialization keeps the final put ahead of notifier removal and module teardown until dispatch has finished. For mixer OSS, serialize callback publication, dispatch and withdrawal in the core so module exit waits for callbacks, including one dropping the last reference, to return. Keep card enumeration in the OSS module, with card references released after dispatch drops the mutex. Ignore duplicate REGISTER notifications so a delayed registration cannot replace an adapter retained across DISCONNECT and leak its module pin. Partial HDA codec teardown can still remove an individual PCM while the card remains registered; its object-lifetime handling is separate. Fixes: 2471b6c80a70 ("ALSA: info: Register proc entries recursively, too") Suggested-by: Takashi Iwai <tiwai@suse.de> Assisted-by: LLM Signed-off-by: Cen Zhang <zzzccc427@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/pm-pmb-26d66390a25fec9fad6c-v6-5be251a3ac8832955a31-2@gmail.com
2026-10-19ALSA: pcm: Protect the unregister notifier traversalCen Zhang
snd_pcm_free() traverses snd_pcm_notify_list and calls n_unregister without register_mutex, although snd_pcm_notify() takes that mutex to add and remove notifiers. PCM disconnect releases the mutex before the free callback runs, so it does not protect this later traversal. With no open OSS file, normal snd-pcm-oss removal can overlap PCM card teardown, for example when unbinding snd-dummy: PCM card teardown snd-pcm-oss unload ----------------- ------------------ snd_pcm_dev_disconnect() remove PCM under register_mutex unlock register_mutex snd_pcm_free() fetch notifier snd_pcm_notify(..., 1) unlink notifier under mutex free module storage read notifier->n_unregister invoke callback The free path can then read the notifier from released module storage or call its unloaded code. Hold register_mutex across the unregister traversal and its callbacks. Notifier removal must wait until both have finished. This also protects the traversal if a callback releases the last module reference: module exit cannot unlink its notifier until the free path releases the mutex. Drop the mutex before private_free and the remaining stream cleanup. Fixes: c461482c8072 ("[ALSA] Unregister device files at disconnection") Assisted-by: LLM Signed-off-by: Cen Zhang <zzzccc427@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/pm-pmb-26d66390a25fec9fad6c-v6-5be251a3ac8832955a31-1@gmail.com
2026-10-19gpiolib: cdev: don't set GPIOD_FLAG_IS_OUTAdrian Ambrozewicz
When a line is requested or reconfigured through the v2 uAPI, gpio_v2_line_config_flags_to_desc_flags() copies the requested configuration into the descriptor flags, GPIOD_FLAG_IS_OUT included, before gpiod_direction_input_nonotify() or gpiod_direction_output_nonotify() asks the driver for the direction. If the driver refuses, for instance with -EOPNOTSUPP from .direction_input() for a line that can only be an output, the ioctl fails but the flag keeps the refused direction. gpiod_free_commit() does not touch GPIOD_FLAG_IS_OUT, so this outlives the failed request, and GPIO_V2_GET_LINEINFO_IOCTL reports the line as an input while the hardware still drives it, until a request without direction flags makes gpiod_request_commit() read the direction back from the driver: GPIO_V2_GET_LINE_IOCTL, line 0, input: -EOPNOTSUPP GPIO_V2_GET_LINEINFO_IOCTL, line 0: input GPIO_V2_GET_LINE_IOCTL, line 0, no direction: ok GPIO_V2_GET_LINEINFO_IOCTL, line 0: output GPIO_V2_LINE_SET_CONFIG_IOCTL updates the flags in the same order. There the line stays requested, and since commit 92ac7de3175e ("gpiolib: don't allow setting values on input lines") GPIO_V2_LINE_SET_VALUES_IOCTL on it then fails with -EPERM, though the line is still an output. A line whose driver refuses to make it an output is likewise reported as one. gpiod_direction_input_nonotify() and gpiod_direction_output_nonotify() set or clear GPIOD_FLAG_IS_OUT themselves once the driver has accepted the direction, emulated open drain and open source included, and nothing between the copy and those calls reads the flag. Leave it to them, as the v1 uAPI already does. The other flags that the helper copies stay as they are. Active low, drive and bias are what gpiod_direction_*() applies, drive and bias possibly before the driver refuses the direction; edges and event clock are the character device's own. None of them is read back from the driver, so there is no earlier state that is more accurate to go back to. A failed request releases the line, which clears them, and a failed reconfiguration leaves the line, like the lines before it, with what was applied up to the failure. Reproduced under QEMU with a test GPIO chip whose line 0 refuses input and line 1 refuses output: both refused requests and both refused reconfigurations leave the line info with the refused direction, and setting the value of the reconfigured output fails with -EPERM. With this change the line info shows the direction of the hardware in all four cases and setting the value works. First seen on real hardware with v6.12. Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Adrian Ambrozewicz <aambrozewicz@nvidia.com> Reviewed-by: Kent Gibson <warthog618@gmail.com> Link: https://patch.msgid.link/20261016-gpiolib-cdev-direction-v2-1-aambrozewicz@nvidia.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-19gpiolib: clear the event clock flags when a line is releasedAdrian Ambrozewicz
gpiod_free_commit() clears the flags that a request sets on a line, but not GPIOD_FLAG_EVENT_CLOCK_REALTIME and GPIOD_FLAG_EVENT_CLOCK_HTE, which gpio_v2_line_config_flags_to_desc_flags() sets from the uAPI v2 line config. Once a line requested with GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME or GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE is released, GPIO_V2_GET_LINEINFO_IOCTL and the line info changed events, the "released" one included, keep reporting that event clock for the free line: GPIO_V2_GET_LINE_IOCTL, line 1, input, event clock realtime: ok close() GPIO_V2_GET_LINEINFO_IOCTL, line 1: input, event clock realtime The flags are set before edge detection is set up, so a request that fails in hte_ts_get(), for instance because no HTE provider handles the line, leaves GPIOD_FLAG_EVENT_CLOCK_HTE behind as well. The next uAPI v2 request rewrites both flags, but requests through uAPI v1, sysfs exports and in-kernel consumers do not, and the line info then shows the event clock of an earlier user for them too. Clear both flags together with the other flags of the request. Reproduced under QEMU with a test GPIO chip: after a released request with the realtime event clock, and on a kernel with CONFIG_HTE=y but no HTE provider after a failed request with the HTE event clock, the line info of the free line still reports that event clock. With this change it reports none. Fixes: 26d060e47e25 ("gpiolib: cdev: allow edge event timestamps to be configured as REALTIME") Fixes: 2068339a6c35 ("gpiolib: cdev: Add hardware timestamp clock type") Signed-off-by: Adrian Ambrozewicz <aambrozewicz@nvidia.com> Link: https://patch.msgid.link/20261012-gpiolib-event-clock-v1-1-aambrozewicz@nvidia.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-19gpiolib: fix memory leak in gpiod_set_array_value_complex() EPERM error pathKent Gibson
A drive-by review by Sashiko reports that, where the line has not been configured as an output, gpiod_set_array_value_complex() can return without freeing potentially alloced bitmaps, thus leaking memory. Cleanup the bitmaps before returning. Fixes: 92ac7de3175e ("gpiolib: don't allow setting values on input lines") Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://lore.kernel.org/linux-gpio/sashiko-outbox-168233@kernel.org/ Signed-off-by: Kent Gibson <warthog618@gmail.com> Link: https://patch.msgid.link/20261016105442.109836-1-warthog618@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-19gpiolib: acpi: Ignore GPIO 11 interrupt on Acer Nitro 16S AIAbduvaliy Abdulazizov
The Acer Nitro 16S AI (AN16S-61) has the same problem as the Acer Nitro V 16S AI: the firmware powers the internal USB camera (0408:4059) through GPIO 11 of AMDI0030, but also lists that pin in _AEI. Requesting it as an input cuts the power, so the camera never enumerates. On this model the same rail also powers the internal microphones, so they do not work either. Booting with gpiolib_acpi.ignore_interrupt=AMDI0030:00@11 fixes both the camera and the microphones. Add a DMI quirk for this family too. Tested-by: Trijan Koju <trijankoju11@gmail.com> Assisted-by: LLM Signed-off-by: Abduvaliy Abdulazizov <abduvaliy.hbai@gmail.com> Acked-by: Mika Westerberg <westeri@kernel.org> Link: https://patch.msgid.link/20261007120944.1705014-1-abduvaliy.hbai@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-19gpio: lpc32xx: check devm_gpiochip_add_data() return valueJayaraj Devaraj
lpc32xx_gpio_probe() registers each gpio chip with devm_gpiochip_add_data() but ignores the return value. If registering a chip fails, probe still returns 0, so the driver binds with a chip missing and no error is reported. Check the return value, print an error naming the failing chip and return the error code. Chips registered earlier in the loop are devm managed and are removed automatically on failure. Signed-off-by: Jayaraj Devaraj <jayarajdmit@gmail.com> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Link: https://patch.msgid.link/20261016154209.23193-1-jayarajdmit@gmail.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-10-19Merge tag 'v7.3' of ↵Bartosz Golaszewski
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-current Linux 7.3
2026-10-19docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tupleAntony Antony
Document mark as part of the EEXIST tuple and update the SA lookup description to match. Fixes: c13c0cc6f52e ("xfrm: add documentation for XFRM_MSG_MIGRATE_STATE") Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: pass extack through to xfrm_init_replay() from xfrm_init_state()Antony Antony
xfrm_init_state() takes an extack parameter but doesn't pass it to xfrm_init_replay(), so replay-window errors can't be reported via extack. Fixes: 231a1744dc43 ("xfrm: add extack to xfrm_init_state") Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: include mark in MIGRATE_STATE SA collision checkAntony Antony
The SA lookup tuple is (daddr, spi, proto, family, mark), but the EEXIST pre-check and the xfrm_state_insert() vs xfrm_state_add() decision only considered daddr and family, ignoring mark. A migration that only changes the mark inserts a duplicate SA tuple into the hash tables. The collision check is implemented as xfrm_state_mark_collides(), which walks the SPI hash bucket for the target tuple and excludes the state being migrated by pointer, rather than doing a separate exact-match lookup followed by a wildcard lookup and comparing the result against self. Before: root@west:~# ip xfrm state add src 10.1.1.1 dst 10.1.1.2 proto esp \ spi 0x1000 reqid 100 mode tunnel aead "rfc4106(gcm(aes))" \ 0x1111111111111111111111111111111111111111 96 \ mark 0x1 mask 0xff root@west:~# ip xfrm state add src 10.1.1.1 dst 10.1.1.2 proto esp \ spi 0x1000 reqid 100 mode tunnel aead "rfc4106(gcm(aes))" \ 0x1111111111111111111111111111111111111111 96 \ mark 0x2 mask 0xff root@west:~# ip xfrm state migrate dst 10.1.1.2 proto esp spi 0x1000 \ mark 0x1 mask 0xff \ new-dst 10.1.1.2 new-src 10.1.1.1 new-reqid 100 \ new-mark 0x2 mask 0xff ip x s src 10.1.1.1 dst 10.1.1.2 proto esp spi 0x00001000 reqid 100 mode tunnel replay-window 0 mark 0x2/0xff aead rfc4106(gcm(aes)) 0x1111111111111111111111111111111111111111 96 anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000 src 10.1.1.1 dst 10.1.1.2 proto esp spi 0x00001000 reqid 100 mode tunnel replay-window 0 mark 0x2/0xff aead rfc4106(gcm(aes)) 0x1111111111111111111111111111111111111111 96 anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000 sel src 0.0.0.0/0 dst 0.0.0.0/0 Notice two states with same mark 0x2/0xff. After: Error: New SA tuple already occupied. Fixes: a9d155ea9b44 ("xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: fix hw offload state leak on xfrm_do_migrate_state() error pathAntony Antony
In the error path, the cloned state is dropped without removing its hardware offload, leaking the offloaded SA entry. Fixes: a9d155ea9b44 ("xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: fix use-after-free of migrated state in xfrm_do_migrate_state()Antony Antony
A concurrent delete can free the migrated state before xfrm_do_migrate_state() finishes using it. Fixes: a9d155ea9b44 ("xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: state: exact mark/mask match for SPI-keyed control-plane SA lookupsAntony Antony
Add __xfrm_state_lookup_exact(); wire it into DELSA/GETSA, GETAE/NEWAE, EXPIRE, MIGRATE_STATE. xfrm_state_update() (UPDSA) keeps wildcard match because ALLOCSPI's larval state may be unmarked (mark 0/0), so an exact-match UPDSA would not find it and the ADD fallback would then fail with -EEXIST via xfrm_state_add(). Fixes: 3d6acfa7641f ("xfrm: SA lookups with mark") Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: policy: reject mark with bits outside its mask on addAntony Antony
Same issue as states: an invalid mark/mask is silently truncated on insert, so GETPOLICY and DELPOLICY can no longer find the policy by id. Reject it instead. The mark is no longer sanitized on policy insert. Fixes: 0b91fda3a1f0 ("xfrm: Sanitize marks before insert") Cc: <stable+noautosel@kernel.org> # avoid breaking existing userspace ABI Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: state: reject mark with bits outside its mask on ALLOCSPIAntony Antony
Like state add and policy add in this series, ALLOCSPI rejects a mark whose value has bits outside its mask. Fixes: bd55775c8dd6 ("xfrm: SA lookups signature with mark") Cc: <stable+noautosel@kernel.org> # avoid breaking existing userspace ABI Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19xfrm: state: reject mark with bits outside its mask on addAntony Antony
A mark/mask like 0x101/0xff is silently truncated to 0x01/0xff on insert, so the exact-match lookups added later in this series (DELSA, GETSA, GETAE, NEWAE, EXPIRE, MIGRATE_STATE) could not find the SA. Reject it instead. The mark is no longer sanitized on state add. Also reject an invalid XFRMA_MARK (the new mark) in XFRM_MSG_MIGRATE_STATE. Fixes: 0b91fda3a1f0 ("xfrm: Sanitize marks before insert") Cc: <stable+noautosel@kernel.org> # needs exact-match SA lookups from this series Signed-off-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-10-19bpf: Refuse the prologue for an extension if callers keep packet pointersAlexei Starovoitov
An extension that writes to the packet of a tc, lwt_xmit or sk_skb program starts with bpf_unclone_prologue(). If the skb is cloned, that gives it a new head. It does not count as changing packet data. changes_pkt_data goes by the helpers and kfuncs that a program calls, and whether it gets a prologue is known only after it has been compared with its target. So the extension can replace a global function that leaves the packet alone, and the callers of that function keep their packet pointers across the call. These point into the old head, which is left to the other clone. Once that is freed, by the reader of a packet socket for example: BUG: KASAN: slab-use-after-free in bpf_prog_53bc21b9810cadbc_t_read+0x2e8/0x36e Read of size 1 at addr ffff888107bfe73c by task tt11/102 Freed by task 112: kfree+0x161/0x500 skb_release_data+0x2dc/0x340 consume_skb+0xa6/0x1c0 packet_recvmsg+0x4b3/0xa20 Nothing is wrong if the target program writes to the packet too: its own prologue has uncloned the skb, and that of the extension does nothing. Nor if the callers hold no packet pointers, like a dispatcher, or if the main function is replaced. Note for every global function that leaves the packet alone if it is called while packet pointers, or slices of the dynptr of a packet, are held. What the callers of a global function hold is not known while it is verified, so the functions that it calls are taken for such as well. Refuse an extension with a prologue for such a function, unless the target program has a prologue, both when the extension is loaded and when it is attached to another target. Functions can share a type id in func_info. The first of them is the one that is replaced, so look it up in one place. Fixes: 7e40781cc8b7 ("bpf: verifier: Use target program's type for access verifications") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20261019011328.1843764-1-alexei.starovoitov@gmail.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-19selftests/bpf: Run the cpumask map insert tests only for the test taskQiliang Yuan
verify_success() attaches each cpumask test program to task_newtask, forks a single child, and expects err to be 0 afterwards. Most programs return right away for other tasks than the test one. test_insert_leave and test_insert_remove_release don't, and insert a cpumask into the single entry of __cpumask_map for every task created in the system while they are attached. test_insert_leave leaves its cpumask in the map, so a second task created, for instance by a test running in parallel, fails to insert one and sets err to 3. Two tasks created at the same time can do the same to test_insert_remove_release. Return early for other tasks than the test one in both programs, as the other programs do. Fixes: 7b6abcfa15cd ("selftests/bpf: Add selftest suite for cpumask kfuncs") Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com> Link: https://lore.kernel.org/bpf/20261009-selftests-bpf-cpumask-insert-filter-v1-1-3249218594d7@gmail.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-19Merge branch 'bpf-enforce-trusted-btf-id-argument-provenance'Kumar Kartikeya Dwivedi
Yiyang Chen says: ==================== bpf: Enforce trusted BTF ID argument provenance A global subprogram parameter tagged __arg_trusted is verified with PTR_TRUSTED, but its call-site type check also accepts bare PTR_TO_BTF_ID and MEM_RCU registers. This lets a callee use a pointer with weaker provenance under the trusted-pointer contract, including passing it to a non-KF_RCU kfunc. Encode the trusted-pointer requirement in generated kfunc prototypes and drive the shared provenance check from the argument contract. A KF_RCU kfunc additionally permits MEM_RCU, while a global __arg_trusted argument requires a referenced or trusted pointer. Normalize nullability when the argument contract permits it. Add rejection coverage for bare and RCU-protected global-subprogram arguments and acceptance coverage for a nullable kfunc receiving a trusted nullable pointer. A separate scx_cake caller fix has been prepared but is not yet submitted. The current veristat-scx pin still uses the old caller, which this series rejects. Changes in v4: - Rebase onto bpf-next and use the shared argument checker. - Reject MEM_RCU for global __arg_trusted arguments. - Encode trusted and KF_RCU provenance in generated kfunc prototypes. - Add nullable-kfunc coverage and use a 12-character Fixes SHA. - Link to v3: https://lore.kernel.org/r/20261006-a3-arg-trusted-v4-v3-0-4619daf30e1c@mails.tsinghua.edu.cn Changes in v3: - Preserve RCU-protected arguments accepted by existing sched-ext programs. - Make the MEM_RCU case a positive regression test. - Use the preferred multi-line comment style. - Link to v2: https://lore.kernel.org/r/20261005-a3-arg-trusted-v4-v2-0-319ce2936949@mails.tsinghua.edu.cn Changes in v2: - Retarget the fix to btf_check_func_arg_match(), where the subprogram argument check lives in this tree, instead of check_func_arg(). - Run the check after check_reg_type() and check_func_arg_reg_off() so type and offset diagnostics keep their wording. v1: https://lore.kernel.org/bpf/20261005-a3-arg-trusted-v4-v1-0-50ee0268fd39@mails.tsinghua.edu.cn/ --- ==================== Link: https://patch.msgid.link/20261007-a3-arg-trusted-v4-v4-0-253ef3a1a69a@mails.tsinghua.edu.cn Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-19selftests/bpf: Cover trusted BTF ID argument provenanceYiyang Chen
Extend verifier_global_ptr_args.c with calls that pass bare and RCU-protected task pointers to a global __arg_trusted parameter. Both calls must be rejected because neither pointer is referenced or trusted. Add paired test-module kfuncs that return and accept a nullable trusted task pointer. Passing the return value directly must succeed, covering PTR_TRUSTED | PTR_MAYBE_NULL handling in the common argument checker. Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn> Reviewed-by: Amery Hung <ameryhung@gmail.com> Link: https://lore.kernel.org/bpf/20261007-a3-arg-trusted-v4-v4-2-253ef3a1a69a@mails.tsinghua.edu.cn Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-19bpf: Enforce trusted BTF ID argument provenanceYiyang Chen
A global subprogram parameter tagged __arg_trusted is verified with PTR_TRUSTED, but the common call-site type check accepts bare PTR_TO_BTF_ID and MEM_RCU registers. The callee can consequently pass a pointer with weaker provenance to a kfunc that does not accept RCU-protected pointers. RCU protection only guarantees that the object remains allocated through a grace period. It does not guarantee that an object's refcount is nonzero, so an RCU-protected pointer cannot satisfy the trusted-pointer contract. For example, an RCU-protected bpf_cpumask loaded from a map may have a zero refcount. Passing it through __arg_trusted lets the callee pass it to bpf_cpumask_acquire(), whose plain refcount_inc() can retain an object that will be freed after the grace period. Make the existing provenance check contract-driven. Mark generated BTF ID kfunc argument types with PTR_TRUSTED, and add MEM_RCU only for KF_RCU kfuncs. Normalize PTR_MAYBE_NULL when the argument contract permits it. Then use the argument flags to require trusted or referenced provenance and allow MEM_RCU only when the contract says so. Split is_trusted_reg() so the normalized type is used for type and modifier checks while reference lookup still uses the original register. Conversion of scalar-struct BTF ID arguments to fixed-size memory continues to construct a new ARG_PTR_TO_MEM type without PTR_TRUSTED. Fixes: e2b3c4ff5d18 ("bpf: add __arg_trusted global func arg tag") Suggested-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn> Reviewed-by: Amery Hung <ameryhung@gmail.com> Link: https://lore.kernel.org/bpf/20261007-a3-arg-trusted-v4-v4-1-253ef3a1a69a@mails.tsinghua.edu.cn Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-19selftests/bpf: Add bpf_proactive_reclaim testHui Zhu
bpf_proactive_reclaim() performs one bounded reclaim pass per call and, unlike a write to memory.reclaim, does not retry until the goal is reached. Charge 32 MiB of page cache to a cgroup, ask for all of it in one call, and check that the result is positive but well below the request: one pass is capped at MEMCG_CHARGE_BATCH pages, far short of 32 MiB on both 4K and 64K page kernels. The test deliberately covers only the kfunc itself. A full example of the intended asynchronous use, where a BPF program watches one cgroup's workingset refaults and reclaims another one from bpf_wq callbacks, is maintained out of tree at [1], released under GPLv2. Add CONFIG_MEMCG to the config fragment, without which mm/bpf_memcontrol.c is not built at all. [1] https://github.com/teawater/memcg-async-reclaim Signed-off-by: Hui Zhu <zhuhui@kylinos.cn> Reviewed-by: Barry Song <baohua@kernel.org> Link: https://lore.kernel.org/bpf/20261009062637.176005-1-hui.zhu@linux.dev Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-10-18Linux 7.3v7.3Linus Torvalds
2026-10-18Merge branch 'bpf-fix-incorrect-handling-of-user-flags-by-percpu-map-updates'Alexei Starovoitov
Masoud Aghasi says: ==================== bpf: Fix incorrect handling of user flags by percpu map updates For BPF_MAP_TYPE_PERCPU_ARRAY map, bpf_percpu_array_update() is not considering the possibility of a combination of (BPF_NOEXIST, BPF_EXIST) flags with (BPF_F_CPU, BPF_F_ALL_CPUS) flags. This causes the (BPF_NOEXIST, BPF_EXIST) flags to lose their effect in some cases. For BPF_MAP_TYPE_PERCPU_HASH and BPF_MAP_TYPE_LRU_PERCPU_HASH maps, htab_map_check_update_flags() and check_flags() are not considering the possibility of a combination of (BPF_NOEXIST, BPF_EXIST) flags with (BPF_F_CPU, BPF_F_ALL_CPUS) flags. This causes the (BPF_NOEXIST, BPF_EXIST) flags to lose their effect in some cases. For example, when using (BPF_F_CPU | BPF_EXIST) flag combination with bpf_map_update_elem() on a BPF_MAP_TYPE_PERCPU_HASH map, the BPF_EXIST flag does not prevent new insertions as expected. This series fixes the bug by adding proper flag validations and checks and adds regression tests. V6 changes: - Improve the style and structure of the selftest V5 changes: https://lore.kernel.org/bpf/20261006084604.780456-1-maghasi@disroot.org/T/ - Simplify flag validations by introducing new macros in bpf.h - Add helpers to verify the values after updates in the new tests - Improve the style and structure of the new tests V4 changes: https://lore.kernel.org/bpf/20261004111007.3216186-1-maghasi@disroot.org/T/ - Edit selftest to use proper value_sz in the new cgroup map test - Edit selftest to pin the current pid to the current cpu for LRU map - Edit commit messages to include user-visible changes V3 changes: https://lore.kernel.org/bpf/20261003160213.2641506-1-maghasi@disroot.org/T/ - Split the fix into two separate patches for array map and hash maps - Extend the selftest to cover all percpu map types - Extend the selftest to cover all applicable flag combinations - Extend the selftest to cover the unnecessary delete issue of LRU map V2 changes: https://lore.kernel.org/bpf/20260930135753.1063495-1-maghasi@disroot.org/T/ - Fix a BPF_EXIST flag check in __htab_lru_percpu_map_update_elem() - Add additional test for BPF_MAP_TYPE_LRU_PERCPU_HASH map - Add check for BPF_EXIST, BPF_NOEXIST combination in percpu array map V1: https://lore.kernel.org/bpf/20260928102821.995214-1-maghasi@disroot.org/T/ ==================== Link: https://patch.msgid.link/20261008120734.1565972-1-maghasi@disroot.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-10-18selftests/bpf: Add tests for percpu map flags combinationMasoud Aghasi
All possible combinations of (BPF_EXIST, BPF_NOEXIST) and (BPF_F_ALL_CPUS, BPF_F_CPU) flags are covered for all percpu map types. As BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE does not support BPF_NOEXIST and also in order to reduce the amount of code duplicates, I added its new test scenarios to the existing cpu_flag_percpu_cgroup_storage test. But for other percpu map types, I added new tests to be able to exercise all flag combinations and the edge cases such as percpu LRU unnecessary deletion issue. Signed-off-by: Masoud Aghasi <maghasi@disroot.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Leon Hwang <leon.hwang@linux.dev> Link: https://patch.msgid.link/20261008120734.1565972-4-maghasi@disroot.org
2026-10-18bpf: Fix incorrect handling of user flags by percpu hash map updatesMasoud Aghasi
For BPF_MAP_TYPE_PERCPU_HASH and BPF_MAP_TYPE_LRU_PERCPU_HASH maps, htab_map_check_update_flags() and check_flags() are not considering the possibility of a combination of (BPF_NOEXIST, BPF_EXIST) flags with (BPF_F_CPU, BPF_F_ALL_CPUS) flags. This causes the (BPF_NOEXIST, BPF_EXIST) flags to lose their effect in some cases. For example, when using (BPF_F_CPU | BPF_EXIST) or (BPF_F_CPU | BPF_NOEXIST) flag combinations with bpf_map_update_elem() on a percpu hash map, the BPF_EXIST flag does not prevent new insertions as expected and BPF_NOEXIST flag does not prevent modification of existing entries as expected. This patch fixes the bug by adding proper flag validations and checks. Before this patch, htab_map_check_update_flags() rejected (BPF_F_ALL_CPUS | BPF_EXIST) and (BPF_F_ALL_CPUS | BPF_NOEXIST) with -EINVAL. After the patch those combinations are accepted. This patch also starts returning -EINVAL for (BPF_EXIST | BPF_NOEXIST), with or without BPF_F_CPU, which was previously accepted. Fixes: c6936161fd55 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_hash and lru_percpu_hash maps") Signed-off-by: Masoud Aghasi <maghasi@disroot.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Leon Hwang <leon.hwang@linux.dev> Link: https://patch.msgid.link/20261008120734.1565972-3-maghasi@disroot.org
2026-10-18bpf: Fix incorrect handling of user flags in bpf_percpu_array_updateMasoud Aghasi
For BPF_MAP_TYPE_PERCPU_ARRAY map, bpf_percpu_array_update() is not considering the possibility of a combination of (BPF_NOEXIST, BPF_EXIST) flags with (BPF_F_CPU, BPF_F_ALL_CPUS) flags. This causes the (BPF_NOEXIST, BPF_EXIST) flags to lose their effect in some cases. For example, using the (BPF_F_ALL_CPUS | BPF_EXIST) flag combination with bpf_map_update_elem() results in an incorrect EINVAL error response, even though the flag combination is valid. This patch fixes the bug by adding proper flag validations and checks. Before this patch, bpf_percpu_array_update() rejected BPF_F_ALL_CPUS | BPF_EXIST and BPF_F_ALL_CPUS | BPF_NOEXIST with -EINVAL. Also the BPF_F_CPU | BPF_NOEXIST were accepted. After the patch BPF_F_ALL_CPUS | BPF_EXIST is accepted and BPF_F_ALL_CPUS | BPF_NOEXIST and BPF_F_CPU | BPF_NOEXIST result in -EEXIST. This patch also starts returning -EINVAL for (BPF_EXIST | BPF_NOEXIST), with or without BPF_F_CPU, which was previously accepted. Fixes: 8eb76cb03f0f ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_array maps") Signed-off-by: Masoud Aghasi <maghasi@disroot.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Leon Hwang <leon.hwang@linux.dev> Link: https://patch.msgid.link/20261008120734.1565972-2-maghasi@disroot.org
2026-10-18Merge branch 'selftests-bpf-fix-selftests-fails-with-clang23'Alexei Starovoitov
KaFai Wan says: ==================== selftests/bpf: Fix selftests fails with clang23 Building with clang/LLVM 23 breaks several selftests. Patches #1 to #4 fix those failures. Changes in v3: - Remove the patch already applied. Changes in v2: - https://lore.kernel.org/bpf/20261014113043.640435-1-kafai.wan@linux.dev/ - Collect the selftest fixes from the two patches in v1 patches: #1, #5, #6 and #7. - Add three new patches: #2, #3 and #4. Changes in v1: - https://lore.kernel.org/bpf/20261012135624.2749743-1-kafai.wan@linux.dev/T/ - https://lore.kernel.org/bpf/20261012140202.2754552-1-kafai.wan@linux.dev/T/ --- ==================== Link: https://patch.msgid.link/20261018005348.2195130-1-kafai.wan@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-10-18selftests/bpf: Use _exit() in uprobe_multi_test clone-ed childKaFai Wan
child_func() terminates with exit(), but spawn_child_flag() also starts it via clone(CLONE_VM), which shares the parent's address space. That exit() then runs atexit handlers and static destructors against globals the parent is still using. LLVM commit `3c3ed59c6a2a ("[llvm] Add format check for MCSubtargetFeatures")` [1], included in the LLVM 23.1 releases, added Target::isValidFeatureListFormat() with a function-local static holding the compiled regex: static const llvm::Regex pattern("^([+-][^,]+)(,[+-][^,]+)*,?$"); return pattern.match(Features); The child exit destroys that static while its guard variable still marks it as initialized, so the regex is never rebuilt in the parent. From that point on, get_jited_program_text() gets NULL from LLVMCreateDisasmCPUFeatures(), so every jited program text check in the tests running after filter_clone_vm fails, e.g. "verifier_jit_convergence", "verifier_private_stack", "verifier_tailcall_jit" and "verifier_jit_inline". Use _exit(), which runs neither atexit handlers nor static destructors, as uprobe_syscall.c already does for its own CLONE_VM child. [1] https://github.com/llvm/llvm-project/pull/180943 Fixes: d2520bdb1932f ("selftests/bpf: Add uprobe multi pid filter test for clone-ed processes") Signed-off-by: KaFai Wan <kafai.wan@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261018005348.2195130-5-kafai.wan@linux.dev
2026-10-18selftests/bpf: Fix stack arg pruning test JOIN log expectationKaFai Wan
Commit f414d20879ae ("bpf: Save DFS postorder numbers for program instructions") changed bpf_compute_postorder() to use a real DFS, which changes the postorder of this test's instructions and thus the insn edge the arg track join at insn 10 is reported on: arg JOIN insn 8 -> 10 r1: _ + fp0-8 => fp0-8|fp0+0 arg JOIN insn 8 -> 10 sa0: _ + fp0-8 => fp0-8|fp0+0 Update the r1 and sa0 expectations to the new output. Fixes: f414d20879ae ("bpf: Save DFS postorder numbers for program instructions") Signed-off-by: KaFai Wan <kafai.wan@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261018005348.2195130-4-kafai.wan@linux.dev
2026-10-18selftests/bpf: Fix stack_arg precision backtracking log expectationKaFai Wan
Commit 147400e9c27c ("bpf: Compute parameters liveness in bpf_compute_live_registers()") stopped assuming that a call to a static subprogram reads r1..r5 and now uses the callee's entry live-in. R1-R5 are not live at these call insns, so __clean_func_state() clears them from the caller state and the backtracked parent state prints as: mark_precise: frame0: parent state regs= stack=: R10=fp0 Update both expectations accordingly. Fixes: 147400e9c27c ("bpf: Compute parameters liveness in bpf_compute_live_registers()") Signed-off-by: KaFai Wan <kafai.wan@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261018005348.2195130-3-kafai.wan@linux.dev
2026-10-18bpf: Determine freplace staticness from BTF linkageKaFai Wan
bpf_check_attach_target() rejects a freplace whose target is a static function, using the subprog "unreliable" flag as a proxy for "static". That flag is raised whenever a subprogram's BTF prototype disagrees with the registers at its call site. `147400e9c27c ("bpf: Compute parameters liveness in bpf_compute_live_registers()")` made that work for static callees: a static function with an unused argument no longer matches its BTF prototype at the call site and is marked unreliable. Since LLVM commit `29b36a16f111 ("[BPF] Emit ABI-accurate BTF prototypes for DW_CC_nocall")` in 23.1 [1] that premise is gone: BTFDebug may now drop arguments removed by the optimizer, so for __noinline static int subprog(struct __sk_buff *ctx) { return bpf_ktime_get_ns(); } compiled with clang 23 the BTF describes subprog() as [75] FUNC_PROTO '(anon)' ret_type_id=2 vlen=0 [76] FUNC 'subprog' type_id=75 linkage=static There is then no argument left to compare, the subprog stays reliable, and the check in bpf_check_attach_target() is skipped. The freplace is then rejected by the later linkage check instead, reporting "subprog() is not a global function", and the selftest "exceptions" fails. Determine staticness from the BTF linkage instead, and keep the unreliable check for global functions whose BTF does not match their call site. There is no functional change: freplacing a static function was rejected before and is still rejected with the same -EINVAL. Selftest "exceptions" is updated to match. [1] https://github.com/llvm/llvm-project/pull/198426 Fixes: 147400e9c27c ("bpf: Compute parameters liveness in bpf_compute_live_registers()") Signed-off-by: KaFai Wan <kafai.wan@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261018005348.2195130-2-kafai.wan@linux.dev