Skip to content

schedule: zephyr_ll: read task priv_data once in sem syscalls - #11343

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-sched-sem-priv-data
Open

kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202610-sched-sem-priv-data

Conversation

@kv2019i

@kv2019i kv2019i commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

The validators of zephyr_ll_task_sem_alloc() and _free() checked that task->priv_data points to user-writable memory, but the implementation read the pointer again from the user-owned task. A thread on another core could swap it in between, and the kernel would then write the new semaphore pointer to an address of its choice.

Copy priv_data once with k_usermode_from_copy() in the validator and pass the validated pointer to the implementation.

The validators of zephyr_ll_task_sem_alloc() and _free() checked that
task->priv_data points to user-writable memory, but the implementation
read the pointer again from the user-owned task. A thread on another
core could swap it in between, and the kernel would then write the new
semaphore pointer to an address of its choice.

Copy priv_data once with k_usermode_from_copy() in the validator and
pass the validated pointer to the implementation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Both syscall paths consistently use the captured, validated pointer, with no unresolved findings.

No open issues 🎉

What changed in this PR

This PR closes a user-memory pointer race in the Zephyr low-latency scheduler’s semaphore syscalls by ensuring the validated priv_data pointer is the one used by the implementation.

Changes:

  • Copy task->priv_data once in a shared validator and validate the captured pointer.
  • Pass that pointer directly to allocation and free helpers while preserving kernel-call behavior.
File Description
src/​schedule/​zephyr_ll.c Refactors semaphore helpers and validators to avoid rereading the user-controlled pointer.

Review effort: Balanced

@intel-sofci

intel-sofci commented Oct 23, 2026 •

Copy link
Copy Markdown

PR 11343: test results

Run date: 2026-10-23 11:22 UTC

Tested commit: 7a7e037854e01974dfeb25559888bd20fed42066

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants