Skip to content

zephyr: vregion: stop logging spurious "read access denied" on free p… - #11163

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202609-fix-spurious-access-warnings
Open

zephyr: vregion: stop logging spurious "read access denied" on free p…#11163
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202609-fix-spurious-access-warnings

Conversation

@kv2019i

@kv2019i kv2019i commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

…aths

vregion_verify() asserts that the vregion metadata object is NOT accessible to the userspace context. It did this with

K_OOPS(!K_SYSCALL_MEMORY_READ(vr, sizeof(*vr)));

but K_SYSCALL_MEMORY_READ() emits an "os.vregion_verify: ... Memory region (size 88) read access denied" error via LOG_ERR precisely when the region is inaccessible - i.e. in the expected, correct case for a kernel-only vregion.

Probe the mapping directly with arch_buffer_validate(), which performs the same check without logging, and oops only if the userspace context can actually read the metadata. No functional change to the security check; only the false-positive error logging is removed.

…aths

vregion_verify() asserts that the vregion metadata object is NOT
accessible to the userspace context. It did this with

	K_OOPS(!K_SYSCALL_MEMORY_READ(vr, sizeof(*vr)));

but K_SYSCALL_MEMORY_READ() emits an "os.vregion_verify: ... Memory
region <addr> (size 88) read access denied" error via LOG_ERR precisely
when the region is inaccessible - i.e. in the expected, correct case for
a kernel-only vregion.

Probe the mapping directly with arch_buffer_validate(), which performs
the same check without logging, and oops only if the userspace context
can actually read the metadata. No functional change to the security
check; only the false-positive error logging is removed.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 12:53

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

The change is narrowly scoped to suppress expected-denial logging while retaining the same access validation behavior.

Pull request overview

Removes false-positive “read access denied” logging in vregion_verify() by replacing K_SYSCALL_MEMORY_READ() with a direct arch_buffer_validate() probe, preserving the security check semantics while avoiding expected-denial error logs in userspace syscall verification paths.

Changes:

  • Replace K_SYSCALL_MEMORY_READ() with arch_buffer_validate() in vregion_verify() to avoid spurious LOG_ERR output.
  • Expand inline comments to document why the syscall helper is not appropriate here.
File summaries
File Description
zephyr/lib/vregion.c Switches vregion metadata accessibility verification to a non-logging probe to prevent expected “access denied” errors from being logged.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread zephyr/lib/vregion.c
* expected (good) case for a kernel-only vregion. Omit false
* error messages by using arch_buffer_validate() directly.
*/
K_OOPS(arch_buffer_validate((void *)vr, sizeof(*vr), 0) == 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to be pedantic we should #include <zephyr/arch/arch_interface.h> but it's guaranteed that it's included via zephyr/internal/syscall_handler.h, so, I'd say it isn't a requirement. Compilation won't fail.

Comment thread zephyr/lib/vregion.c
* expected (good) case for a kernel-only vregion. Omit false
* error messages by using arch_buffer_validate() directly.
*/
K_OOPS(arch_buffer_validate((void *)vr, sizeof(*vr), 0) == 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to be pedantic we should #include <zephyr/arch/arch_interface.h> but it's guaranteed that it's included via zephyr/internal/syscall_handler.h, so, I'd say it isn't a requirement. Compilation won't fail.

@intel-sofci

Copy link
Copy Markdown

PR 11163: test results

Run date: 2026-09-03 13:54 UTC

Tested commit: 360be17109e0cd5ab6d1cb2cf08e75f2038ec6dd

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.

5 participants