Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions zephyr/lib/vregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,15 @@ bool vregion_verify(struct vregion *vr)
if (!vr)
return false;

/* vregion instances must not be accessible to the userspace. */
K_OOPS(!K_SYSCALL_MEMORY_READ(vr, sizeof(*vr)));
/*
* vregion instances must not be accessible to the userspace.
*
* Don't use K_SYSCALL_MEMORY_READ() here: it logs an "access denied"
* error whenever the region is inaccessible, which is exactly the
* 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.


size_t vr_size = 0;
uintptr_t vr_start;
Expand Down
Loading