Commit graph zephyr/subsys
Author SHA1 Message Date
Emil Gydesen
f96bff2581 Bluetooth: CAP: Shell: Fix issues with cap_ac_11
The command did not count correctly in the unicast_streams
array, and the number of streams support did not match the
audio configuration.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:42 -04:00
Emil Gydesen
9ff372b74f Bluetooth: BAP: Shell: Clear USB data when stream disconnects
When a stream that is currently being used for incoming
data and sends that data to the USB host disconnects or
otherwise stops, we now clear any data that may be stored
for that stream.

The reason for this is that if another stream takes it place
we should start from a clean slate to avoid any issues with
mixing audio data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:11 -04:00
Emil Gydesen
11f67a007a Bluetooth: BAP: Shell: Modify how PACS and ASCS are registered
Move PACS out from CONFIG_BT_BAP_UNICAST_SERVER as the broadcast
sink shall also register PACS.

Modified the code for PACS a bit to clean it up and collect it in
one place.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:17:02 -04:00
Emil Gydesen
0a710bdce2 Bluetooth: GMAP: Add missing gmap_cb != NULL checks
Add missing NULL checks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:16:21 -04:00
Emil Gydesen
85acd7af27 Bluetooth: GMAP: Fix reset issue in GMAP client
The gmap_reset function also reset the gmap_cli->flags
which made the atomic_test_and_set_bit for
GMAP_CLIENT_FLAG_BUSY useless.

Modified the reset function to not clear that flag.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-25 06:16:21 -04:00
Anas Nashif
e1b7047ce1 testsuite: ztest: restore external linkage of ztest_thread_stack
Commit b1add060ac ("testsuite: ztest: address MISRA Rule 2.7 and 8.4")
gave ztest_thread_stack internal linkage to satisfy Rule 8.4. That broke
the userspace memory-protection test, which references the symbol from a
different translation unit to inspect the runner thread's stack, so the
test failed to link.

Restore external linkage and instead satisfy Rule 8.4 by declaring the
stack in ztest_test.h before its definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 13:59:32 -04:00
Aleksandr Khromykh
2a802163c1 bluetooth: mesh: offload ECDH from system workqueue
Move the ECDH P-256 key generation during mesh provisioning from the
system workqueue to the dedicated long workqueue (bt_long_wq). The ECDH
computation can take several seconds on platforms with software ECC,
blocking all other system workqueue users for the duration.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-24 13:58:56 -04:00
Aleksandr Khromykh
9eafde2649 bluetooth: common: move bt_long_wq from host to common
Move the long workqueue implementation (long_wq.c, long_wq.h) and its
Kconfig options from subsys/bluetooth/host/ to subsys/bluetooth/common/.
This makes the dedicated workqueue API available to other Bluetooth
subsystems beyond the host, such as Bluetooth Mesh, without relying on
internal host headers.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-24 13:58:56 -04:00
Sohan Kumar
26f811ee9d Bluetooth: shell: fix l2cap metrics command argument count
Fix the 'l2cap metrics' command argument definition.
It accepts a single parameter ("metrics") to print throughput,
but was incorrectly set to require two arguments, preventing output.

Update SHELL_CMD_ARG to min=1 and max=1 to allow enabling,
disabling, and printing throughput metrics.

Signed-off-by: Sohan Kumar <sohan.kumar@nxp.com>
2026-06-24 07:44:55 -04:00
Anas Nashif
26c4ab419f net: ocpp: NUL-terminate idtag after strncpy
parse_remote_start_txn_msg() used strncpy(idtag, payload.val2, CISTR50)
without forcing NUL termination, so a source string >= 50 bytes left
idtag unterminated. Use CISTR50 - 1 as the bound and set idtag[CISTR50 -
1] = '\0'.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:41:33 -04:00
Anas Nashif
4d8a9eb144 net: ocpp: guard strtok_r return before atoi
ocpp_process_server_msg() called atoi(strtok_r(uid, "-", &tmp)) without
checking for NULL. When the CALLRESULT uid contains no '-' delimiter
strtok_r returns NULL and atoi(NULL) is undefined behaviour.

Return -EINVAL when the delimiter is absent.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:41:33 -04:00
Anas Nashif
afbf880b04 net: ocpp: bound GetConfiguration key copy
parse_getconfig_msg() copied the attacker-controlled "key" JSON field
into the caller's CISTR50 buffer with strcpy(), allowing an OCPP server
(or MITM) to smash the stack with an oversized field.

Use strncpy bounded to CISTR50 and NUL-terminate, matching the sibling
handlers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:41:33 -04:00
Emil Gydesen
cb2329e090 Bluetooth: HAS: Add check for has.registered in security cb
If we had a bond with a device and the flags were non-zero,
and we power cycled but where bt_has_register was not called
before the bonded device reconnected then in the
security_changed we would call notify_work_reschedule which
would then notify_work_handler would access uninitialized values
like hearing_aid_features_attr or the other attributes (they would
be NULL), causing an assert when calling bt_gatt_is_subscribed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-24 07:40:02 -04:00
Cristian Bulacu
54736ee1ee openthread: border_router: set mDNS hostname from application layer
This commit adds the option to externally manage the mDNS hostname
creation from application layer which runs alongside border router
sample.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-06-24 07:39:53 -04:00
Krzysztof Chruściński
04accb118e ipc: ipc_service: Remove new line from logs
Remove redundant new lines from logs in the ipc_service API file.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-24 07:39:22 -04:00
Anas Nashif
f270f4bd0e fs: ext2: bound superblock block size on mount
ext2_verify_disk_superblock() never validated s_log_block_size. A
crafted image could set it so that 1024 << s_log_block_size overflows
the shift or exceeds CONFIG_EXT2_MAX_BLOCK_SIZE, corrupting the static
block slab and leading to heap overflow on the first block read.

Reject block sizes that overflow the shift or exceed the configured
maximum.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:38:36 -04:00
Anas Nashif
b1add060ac testsuite: ztest: address MISRA Rule 2.7 and 8.4
Make the ztest runner conform to MISRA C:2012 without changing behaviour:

  - Rule 2.7 (unused parameters): mark the unused 'suite' parameter of
    run_test_functions() and the unused 'suite'/'test' parameters of the
    default z_ztest_should_test_run() with ARG_UNUSED(). The 'shuffle' and
    'suite_iter' parameters of z_ztest_run_test_suite_ptr() are only used
    when CONFIG_ZTEST_SHUFFLE is enabled, so mark them unused otherwise.

  - Rule 8.4 (declaration before definition): give the test execution API
    (ztest_api and the z_ztest_run_all()/z_ztest_should_suite_run()/
    z_ztest_should_test_run() default hooks) a shared declaration in
    ztest_test.h, so the per-backend definitions have a visible prototype,
    and drop the now-redundant local extern in ztest.c. Give the
    file-local cur_phase variable and ztest_thread_stack internal linkage.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:38:28 -04:00
Anas Nashif
f348f5a2d5 testsuite: ztest: address MISRA Rule 13.4, 15.7 and 17.7
Make the ztest runner conform to MISRA C:2012 without changing behaviour:

  - Rule 17.7: explicitly discard the return value of k_thread_create(),
    k_thread_name_set(), k_thread_join(), k_msleep() and
    ztest_run_test_suites() with a (void) cast where it is intentionally
    ignored.

  - Rule 13.4: do not use the result of an assignment. Split the chained
    'passrate_major = passrate_minor = 0' assignment and convert the
    'while ((test = z_ztest_get_next_test(...)) != NULL)' loops into
    equivalent for loops.

  - Rule 15.7: terminate the flagged if ... else if chains with an else
    clause and replace the empty ';' else body with an explanatory comment.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:38:28 -04:00
Anas Nashif
451007e720 testsuite: ztest: align test wrapper parameter names
The forward declaration of the generated _<suite>_<fn>_wrapper() function
named its parameter "data" while the definition named it "wrapper_data".
MISRA C:2012 Rule 8.3 requires all declarations of a function to use the
same parameter names. Rename the parameter in the declarations to
"wrapper_data" to match the definitions, in both Z_TEST_P() and Z_TEST().

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-24 07:38:28 -04:00
Emil Gydesen
6eef6fa417 Bluetooth: CAP: Handover: Expand stream ctx checks
Add a specific check for getting the broadcast streaming
context, and log the individual values for unicast and
broadcast if they differ.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-24 11:44:06 +02:00
Emil Gydesen
9cd9a897c7 Bluetooth: BAP: SD: Shell: Fix conn_cb issue
There is a test case for the shell to build with
CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n. Registering the conn
callbacks dynamically in the cmd_bap_scan_delegator_init
fails that test.

Change to use BT_CONN_CB_DEFINE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-24 11:42:53 +02:00
Fabio Baltieri
4e40145031 ztest: use snprintk instead of snprintf
This file introduced a couple of snprintf since 1d7d9341d12b, this
resulted in a flash usage blowup of about 28kB for some of our
downstream platform due to a cascade of string parsing libraries that
are brought in by snprintf. Looks like snprintk does not have that
problem and is already used in this file, switch to that instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-06-23 21:17:22 -04:00
Paul Würtz
58f319b766 debug: Add Kconfig option to enable GCC to export callgraph files
Adding CALLGRAPH_INFO to allow to export compilation unit level callgraph
files from GCC. Complementing the existing STACK_USAGE options to follow
the initial intention to use both options together for stack use analysis.

Signed-off-by: Paul Würtz <paulwuertz@posteo.de>
2026-06-23 21:15:59 -04:00
Robert Lubos
10a9d2a1a3 net: ipv4: Fix commented out if NET_IPV4_AUTO in Kconfig
Must've been commented out by mistake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-06-23 17:40:42 -04:00
Robert Lubos
b8bd9c05ae net: mqtt: Fix commented out if MQTT_VERSION_5_0 in Kconfig
Must've been commented out by mistake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-06-23 17:40:42 -04:00
Emil Gydesen
9ebec0ef0d Bluetooth: BAP: SD: Add missing bt_conn_drop
If using past, we may take a reference to the ACL, but that
reference was never returned.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-23 17:38:40 -04:00
Emil Gydesen
18d9cd7a16 Bluetooth: BAP: Shell: Change codec_cap max frame size to 155
155 is the largest size defined by BAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-23 17:38:22 -04:00
Lyle Zhu
704998b85d bluetooth: classic: obex: Prevent requests after final bit is set
Add validation to prevent sending additional OBEX requests if the
SRM has been enabled after the final bit has been set in PUT or GET
operations on the Client side.

When the SRM has been enabled Without the waiting flag, if the final
bit of the request has been set in the last packet in a multi-packet
operation, the following request packet should not be set.

This ensures proper OBEX protocol sequencing by preventing clients
from sending additional requests if the SRM has been enabled once
they have indicated the final request in a multi-packet operation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
23955bb5df bluetooth: classic: obex: Add SRM and SRMP checking for Server
Check Single Response Mode (SRM) and SRM Parameters (SRMP) for
OBEX PUT and GET operations on the Server side to avoid the responses
that violate the GOEP specification.

Changes include:
- Add BT_OBEX_REQ_RECV and BT_OBEX_REQ_F_BIT flag definitions for
  tracking request reception and final bit state
- Implement obex_server_parse_srm() for parsing and validating SRM
  headers in both requests and responses
- Add obex_server_parse_req_srm() and obex_server_parse_rsp_srm()
  to handle SRM headers with first request tracking
- Implement obex_server_parse_srmp() for parsing and validating SRMP
  headers with proper sequencing checks
- Add obex_server_rsp_check() to validate response sequencing when
  SRM is enabled, ensuring responses are only sent when required
- Update obex_server_put_common() and obex_server_get_common() to
  parse SRM/SRMP headers and track request state
- Enhance bt_obex_put_rsp() and bt_obex_get_rsp() to validate
  response conditions, parse SRM/SRMP headers, and handle state
  rollback on failure
- Move opcode validation before buffer allocation to prevent
  resource leaks
- Improve error handling with proper flag restoration on failure

This implementation ensures the server properly validates SRM/SRMP
headers and enforces protocol rules for when responses must be sent,
complementing the existing client-side SRM/SRMP support.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
5da550f853 bluetooth: classic: obex: Add SRM and SRMP checking for Client
Check Single Response Mode (SRM) and SRM Parameters (SRMP) for
OBEX PUT and GET operations on the Client side to avoid the requests
that violate the GOEP specification.

Changes include:
- Parse and validate SRM/SRMP headers in client requests and responses
- Track SRM/SRMP state using client flags (BT_OBEX_REQ_1ST,
  BT_OBEX_REQ_SRM, BT_OBEX_REQ_SRMP, BT_OBEX_RSP_SRM, BT_OBEX_RSP_SRMP,
  BT_OBEX_RSP_RECV)
- Add request validation to ensure proper sequencing when SRM is
  enabled or disabled
- Refactor client request completion handling into
  obex_client_req_complete(), add obex_client_save_last_operation(),
  and obex_client_clear_active_state() helper
- Add obex_client_req_check() to validate request state before sending
- Restore client state on error in PUT and GET operations
- Move bt_obex flags enum from header to implementation file

SRM allows multiple requests to be sent without waiting for responses,
while SRMP provides flow control when the receiver needs the sender to
wait. This implementation ensures proper validation of SRM/SRMP headers
and enforces protocol rules for when responses must be received.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
58c670adfa bluetooth: classic: obex: fix inconsistent data types of if statement
Standardize pointer and error code comparisons throughout the OBEX
implementation to follow Zephyr coding guidelines:

- Replace implicit pointer checks (!ptr) with explicit NULL
  comparisons (ptr == NULL)
- Replace implicit error checks (!err) with explicit zero
  comparisons (err != 0 or err == 0)
- Update length checks to use explicit comparisons (len > 0
  instead of len, len == 0 instead of !len)

This improves code readability and consistency across the obex.c file
with the project's coding standards without changing any functional
behavior.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Nicolas Pitre
97fac4b782 kernel: mmu: remove LINKER_USE_PINNED_SECTION and __pinned_* tagging
CONFIG_LINKER_USE_PINNED_SECTION is the second half of the selective
kernel-pinning model removed in issue #108773. With the kernel image
now always resident at boot (previous commit), the __pinned_*
attribute family is a no-op: every page they would have segregated is
already pinned by z_mem_manage_init()'s whole-image loop, so the
tagging contract neither adds safety nor remains maintainable.

Drop it.

Mechanical removals:

* All ~219 in-tree uses of __pinned_text, __pinned_rodata,
  __pinned_data, __pinned_bss, __pinned_noinit, and __pinned_func
  across arch/x86, drivers/interrupt_controller, drivers/timer,
  arch/common, kernel, lib/libc, subsys/portability/posix, tests, and
  the syscall code generator (scripts/build/gen_syscalls.py).

* The assembly aliases PINNED_TEXT/RODATA/DATA/BSS/NOINIT used in
  arch/x86/core/ia32/*.S and drivers/interrupt_controller/
  intc_loapic_spurious.S become plain TEXT/RODATA/DATA/BSS/NOINIT.

* K_KERNEL_PINNED_STACK_DEFINE, K_KERNEL_PINNED_STACK_ARRAY_DEFINE,
  K_KERNEL_PINNED_STACK_ARRAY_DECLARE, K_THREAD_PINNED_STACK_DEFINE,
  and K_THREAD_PINNED_STACK_ARRAY_DEFINE are removed. The few
  in-tree callers (kernel/init.c, arch/arm/core/cortex_a_r/smp.c,
  arch/arm64/core/fatal.c, arch/rx/core/prep_c.c,
  arch/x86/core/prep_c.c, kernel/include/kernel_internal.h,
  tests/bluetooth/hci_uart_async) move to the corresponding
  non-pinned macros.

Machinery removals:

* Kconfig.zephyr drops CONFIG_LINKER_USE_PINNED_SECTION.
  qemu_x86_tiny and qemu_x86_atom_virt drop their =y overrides.

* include/zephyr/linker/section_tags.h drops the __pinned_* macro
  definitions (both arms). __isr collapses to an empty macro since
  its only purpose was to alias __pinned_func.

* include/zephyr/linker/sections.h drops PINNED_TEXT_SECTION_NAME,
  PINNED_BSS_SECTION_NAME, etc. and the bare PINNED_TEXT/RODATA/etc.
  forwarders, plus the _APP_SMEM_PINNED_SECTION_NAME constant.

* include/zephyr/linker/linker-defs.h drops the lnkr_pinned_*
  externs, the _app_smem_pinned_* externs, and the lnkr_is_pinned()
  / lnkr_is_region_pinned() inline helpers.

* include/zephyr/linker/utils.h drops the lnkr_pinned_rodata branch
  in linker_is_in_rodata().

* include/zephyr/linker/app_smem_pinned{,_aligned,_unaligned}.ld
  are deleted; cmake/linker/ld/target_configure.cmake stops
  configuring them.

* boards/qemu/x86/qemu_x86_tiny.ld and
  include/zephyr/arch/x86/ia32/linker.ld drop their pinned-section
  blocks and the now-redundant #ifndef CONFIG_LINKER_USE_PINNED_SECTION
  conditionals throughout the body. The
  LIB_KERNEL_IN_SECT / LIB_ARCH_X86_IN_SECT / LIB_ZEPHYR_IN_SECT /
  LIB_C_IN_SECT / LIB_DRIVERS_IN_SECT / LIB_SUBSYS_LOGGING_IN_SECT /
  LIB_ZEPHYR_OBJECT_FILE_IN_SECT / ZEPHYR_KERNEL_FUNCS_IN_SECT macros
  in qemu_x86_tiny.ld are deleted; they existed only to feed the
  pinned text/rodata/data/bss/noinit sections.

* kernel/mmu.c drops the mark_linker_section_pinned(lnkr_pinned_start,
  ...) call. The mark_linker_section_pinned() helper survives but is
  now gated only on CONFIG_LINKER_USE_BOOT_SECTION.

* arch/common/init.c and include/zephyr/arch/common/init.h drop
  arch_bss_zero_pinned(); arch/x86/core/ia32/crt0.S drops the call
  to it.

* arch/x86/core/userspace.c drops the eager k_mem_page_in() of the
  thread's privileged stack on user-mode entry. With the kernel
  image fully resident the stack is already mapped.

* arch/x86/gen_mmu.py drops map_region("lnkr_pinned") and the
  set_region_perms() calls for lnkr_pinned_text / lnkr_pinned_rodata.

* CMakeLists.txt drops the LINKER_USE_PINNED_SECTION block that
  generated APP_SMEM_PINNED_* variables and the
  pinned_partitions target property feeding gen_app_partitions.py.
  cmake/modules/extensions.cmake removes the PINNED_RODATA /
  PINNED_RAM_SECTIONS / PINNED_DATA_SECTIONS zephyr_linker_sources()
  location keywords and their snippet files.
  scripts/build/gen_app_partitions.py drops --pinoutput /
  --pinpartitions arguments and the pinned-output branch.
  subsys/testsuite/coverage/CMakeLists.txt drops its
  CONFIG_DEMAND_PAGING-conditional fork.

* scripts/build/gen_kobject_list.py drops the
  app_smem_pinned_start / _end fallback for kobject placement
  validation.

* tests/arch/x86/pagetables and tests/kernel/mem_protect/userspace
  drop their lnkr_pinned_text / lnkr_pinned_rodata branches.

* include/zephyr/arch/x86/ia32/arch.h folds IRQSTUBS_TEXT_SECTION
  to the unconditional ".text.irqstubs" form.

* tests/subsys/llext/src/syscalls_ext.c drops a stale comment about
  syscalls landing in .pinned_text.

Targeted retentions:

* arch/x86/core/bootargs.c keeps multiboot_cmdline and efi_bootargs
  in .noinit (was __pinned_noinit, which decayed to __noinit when
  LINKER_USE_PINNED_SECTION was unset). The multiboot and zefi loader
  paths write these buffers before Zephyr's BSS-zero step, so
  zeroing them at boot loses the cmdline.

* arch/x86/core/ia32/fatal.c keeps _df_esf and _df_stack in .noinit.
  They are scratch space written by the double-fault handler and have
  no zero-init requirement; keeping them in .noinit also preserves
  the historical post-noinit alignment that gen_mmu.py relies on
  (z_mapped_size is computed before CMake-injected iterable sections
  are appended to the linker script, so the post-noinit page padding
  is what keeps those sections within the mapped region).

* include/zephyr/arch/x86/ia32/syscall.h and
  include/zephyr/arch/x86/arch.h wrap the per-arch
  arch_syscall_invoke* / arch_is_user_context / arch_k_cycle_get_*
  implementations in @cond INTERNAL_HIDDEN. The public Doxygen
  contract lives on the prototypes in
  include/zephyr/arch/arch_interface.h; the per-arch implementations
  are internal. Without this, removing the __pinned_func attribute
  exposes the implementations to the doxygen-coverage delta check
  as 10 newly-undocumented APIs.

Documentation updates are deferred to a separate commit.

Issue: #108773

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-06-23 09:11:08 -04:00
Nicolas Pitre
86c6923e12 kernel: mmu: remove LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT
With qemu_x86_tiny moved off the =n side of this knob in the previous
commit, no in-tree configuration sets
CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT=n anymore. The mode it
selected is also unsafe by construction (issue #108773), so there is
nothing to deprecate -- drop the Kconfig symbol and every #ifdef on
it.

Consequences:

* z_mem_manage_init() pins the whole Zephyr image unconditionally and
  no longer calls arch_bss_zero() after demand-paging init. The
  pinning loop's TODO about "we will need linker regions for a subset
  of kernel code/data pages which are pinned in memory and may not be
  evicted" is replaced with a brief note that the kernel image is
  always resident now and that pageable kernel regions go through
  __ondemand_*.

* arch/x86/core/ia32/crt0.S always calls arch_bss_zero() once
  arch_bss_zero_boot and arch_bss_zero_pinned have run.

* kernel/kheap.c and kernel/userspace/userspace.c drop the
  pre-kernel/post-kernel "skip non-pinned" dance and zero/init each
  heap and app-shmem partition unconditionally at PRE_KERNEL_1.

* arch/x86/core/userspace.c drops the eager k_mem_page_in() of the
  thread's privileged stack before dropping to user mode -- with the
  full kernel image resident the stack is already mapped.

* arch/x86/gen_mmu.py always maps the Zephyr image with FLAG_P set
  (and lnkr_boot_* / lnkr_pinned_* regions just inherit that).

* CMakeLists.txt no longer force-pins z_libc_partition into
  pinned_partitions for app_smem.

* The EVICTION_LRU gate
  "depends on LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT" goes away;
  LRU is now safe by construction on any DEMAND_PAGING board and
  becomes the default whenever ARCH_SUPPORTS_EVICTION_TRACKING.

* DEMAND_PAGING_PAGE_FRAMES_RESERVE loses its conditional default of
  32 frames; the new model needs no reserve.

* boards/qemu/x86/qemu_x86_tiny.ld drops the FLASH MEMORY region and
  the flash_load_offset block that arranged the demand-paged
  generic-section layout. boards/qemu/x86/board.cmake drops the
  8 MB-RAM bump and the --map flash gen_mmu argument that paired with
  that mode.

* tests/arch/x86/pagetables and tests/kernel/fatal/exception drop the
  code paths that were guarded on =n.

* tests/kernel/mem_protect/demand_paging/mem_map.lru replaces its
  CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT=y override with an
  explicit CONFIG_EVICTION_LRU=y, since the symbol it relied on is
  gone.

The __pinned_* tagging convention still expands to its actual linker
sections under CONFIG_LINKER_USE_PINNED_SECTION; that symbol and the
~219 in-tree __pinned_* annotations are cleaned up in the following
commit.

Issue: #108773

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-06-23 09:11:08 -04:00
Siratul Islam
085e11acf0 authenticaion: fido2: fix HID timeout abort
Fix to allow all channels to trigger timeout check
and clear blocked transaction.

Signed-off-by: Siratul Islam <siratul.islam@linux.dev>
2026-06-23 08:36:24 +02:00
Rishav Chakraborty
64fdf2bb93 Bluetooth: audio: check bt_conn_ref return value in LE Audio APIs
bt_conn_ref can return NULL if the application passes a stale conn
pointer. Check the return value in all public LE Audio discover APIs
and return -ENOTCONN on failure.

Signed-off-by: Rishav Chakraborty <reshav01@gmail.com>
2026-06-22 15:48:19 +02:00
Aleksandr Khromykh
c5cee2130c bluetooth: mesh: shell: fix BLOB transfer progress calculation
The get_progress() function in the BLOB shell had two bugs:

1. The loop iterated over byte count (DIV_ROUND_UP(total_blocks, 8))
   instead of total block count, and the bit indexing used i % 8
   for both the byte index and bit position, meaning it only ever
   inspected the first byte of the missing_blocks array.

2. The final calculation (total_blocks - blocks_not_rxed) / total_blocks
   performed integer division without scaling, always yielding 0 or 1
   instead of a percentage.

Fix the loop to iterate over all block bits using proper byte/bit
indexing, and multiply the numerator by 100 to produce a correct
0-100 percentage result.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-22 14:30:48 +02:00
Ashutosh Kumar Singh
0f81a8a7b2 sd: fix out-of-bounds memcpy for unaligned buffer reads/writes
When card_read_blocks() or card_write_blocks() is called with an
unaligned buffer and the number of requested blocks is not a multiple
of the internal card_buffer capacity, the final loop iteration uses
the full rlen/wlen value instead of the remaining block count.

For example, with card_buffer holding 8 blocks and num_blocks == 3:
- rlen is set to 8 before the loop
- The single iteration reads 8 blocks from disk and copies
  8 * block_size bytes into the caller's 3-block-sized buffer,
  writing 5 * block_size bytes past the end of that buffer.

The same overrun occurs in card_write_blocks, where the memcpy reads
5 * block_size bytes beyond the caller's source buffer before passing
the corrupted card_buffer to card_write().

Fix: clamp rlen/wlen to the remaining block count at the top of each
loop iteration using MIN().

Fixes #108627

Signed-off-by: Ashutosh Kumar Singh <ahutoshhjp1067@gmail.com>
2026-06-22 14:25:27 +02:00
Pieter De Gendt
96e06d3a6a net: coap_client: wake poll() on cancel instead of sleeping
coap_client_cancel_requests() slept COAP_PERIODIC_TIMEOUT (~500 ms) per
client to let the recv thread's poll() unwind, stalling the caller for
that whole period. Interrupt the poll() via an eventfd and wait for the
recv thread to ack, keeping the timeout only as a fallback.

Update the coap_client unit test to mock the cancel-wakeup eventfd via
its poll() stub so the wakeup/ack path is exercised.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Assisted-by: Claude:claude-opus-4.8
2026-06-22 14:24:42 +02:00
Benjamin Cabé
3d3e110d8f posix: pthread: fix mutex pool slot reuse
Mutex sentinel asserts reject k_mutex_init() on held mutexes. The POSIX
pool was re-initializing slots on allocation while destroy could return
them still held, tripping assertions in pthread and C11 thread tests.

Re-init pool slots in pthread_mutex_destroy() instead of to_posix_mutex(),
and return EBUSY when destroy is called on a locked mutex. Fix timedlock
tests to unlock before worker threads exit.

Assisted-by: Cursor:composer-2.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-21 07:40:00 -04:00
Yago Fontoura do Rosario
779a3b3bd2 bluetooth: host: Add function to resolve Bluetooth LE addresses
* Adds a public host API to resolve LE addresses into identity addresses

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2026-06-19 22:48:04 +02:00
Torsten Rasmussen
b425d7a375 kconfig: cleanup ZEPHYR_BASE usage
Remove `$(ZEPHYR_BASE)` from `source "<file>"`.
Source is always relative to ZEPHYR_BASE, so no need to specify it.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-06-19 22:40:14 +02:00
Aleksandr Khromykh
407ba2cc63 bluetooth: mesh: delayable_msg: fix chunk allocation
Use buf->len (actual data length) instead of buf->size (buffer
capacity) when calculating the number of chunks to allocate in
bt_mesh_delayable_msg_manage(). Using buf->size causes over-allocation
when the buffer capacity is much larger than the payload, starving
the chunk pool for other delayable messages.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-19 14:55:18 +02:00
Fin Maaß
44bea3754d net: if: change return type of net_if_tx to void
the static function net_if_tx returns a bool,
but we don't use that, so change it to void.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-19 14:55:06 +02:00
Robert Lubos
589eadc74e net: ip: Enforce forward lifetime in net_route_packet_if()
On-link cross-interface forwarding did not decrement TTL or hop
limit, unlike the explicit-route path. Apply the shared helpers so
both routing paths enforce packet lifetime consistently.

Assisted-by: Cursor:Composer
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-06-19 13:20:18 +02:00
Robert Lubos
7ece2c28b0 net: route: Extract IPv4 and IPv6 forward lifetime helpers
Add helper functions to decrement TTL/hop limit and decide whether to
drop the packet.

Assisted-by: Cursor:Composer
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-06-19 13:20:18 +02:00
Fin Maaß
17faac05a2 net: ethernet: remove redundant capability check
remove redundant capability checks, as
these are also checked inside net_mgmt
with the same return code

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-19 13:19:53 +02:00
Fin Maaß
aeb22a4a90 drivers: ethernet: use net_eth_carrier_set
use the new function
net_eth_carrier_set().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-19 11:09:59 +02:00
Fin Maaß
891969b1b1 net: ethernet: add net_eth_carrier_set
add a net_eth_carrier_set function, that
uses atomic_test_and_set_bit_to.

make net_eth_carrier_on and
net_eth_carrier_off inline and
based on net_eth_carrier_set.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-19 11:09:59 +02:00
Holt Sun
85a2085172 pm: make IRQ-locked state-set the default
Replace the opt-in locked marker with a legacy unlocked marker. With
this, SoC PM hooks use the locked IRQ contract by default, and only
legacy SoCs that still unmask interrupts from PM hooks select
PM_STATE_SET_IRQ_UNLOCKED.

Drop the old locked marker selections from already migrated NXP SoCs and
update the PM test expectation accordingly.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-06-19 11:09:51 +02:00
Johan Hedberg
8cdc2c8c4c Bluetooth: host: enable the long workqueue for BT_ECC via a default
BT_LONG_WQ was enabled for BT_GATT_CACHING through a "default y if" on the
option itself, but for BT_ECC through an "imply BT_LONG_WQ" on BT_ECC.
Use a consistent mechanism for both by replacing the implication with a
"default y if BT_ECC" on BT_LONG_WQ.

Besides being more consistent, this makes the BT_ECC driven enablement
overridable through a configdefault: an "imply" sets a weak reverse
dependency that a (config)default cannot turn off, whereas a plain default
can. This allows platforms to disable the long workqueue (and fall back to
running the long-running operations on the system workqueue) via a
configdefault in their Kconfig.defconfig, which a subsequent change makes
use of on nRF51.

This change has no functional effect on its own: BT_ECC continues to enable
BT_LONG_WQ by default.

Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-18 14:39:50 -04:00