Skip to content

G3P-22238: Revert to opt-in privilege model in osThreadNew - #15

Merged
nickfritz33 merged 1 commit into
mainfrom
nick/G3P-22238/revert-to-opt-in-priv
May 8, 2026
Merged

G3P-22238: Revert to opt-in privilege model in osThreadNew#15
nickfritz33 merged 1 commit into
mainfrom
nick/G3P-22238/revert-to-opt-in-priv

Conversation

@nickfritz33

Copy link
Copy Markdown

Summary

  • Restore the original opt-in check (osThreadPrivileged must be explicitly set) instead of the opt-out inversion. With CREATE_PRIVILEGED_THREAD_ATTRIBUTES setting osThreadPrivileged on all service threads and CREATE_THREAD_ATTRIBUTES leaving it unset for unprivileged tasks, opt-in is the correct and cleaner default.

Context

This work supports G3P-22238, which creates an unprivileged FreeRTOS task on STM32H573 (Cortex-M33 with TrustZone). The CMSIS-RTOS2 wrapper previously had no mechanism to create unprivileged tasks via the `osThreadNew` API — all threads were created privileged regardless of the `osThreadUnprivileged` attribute flag.

Test plan

  • Branch firmware (STM32H573, `configENABLE_MPU=1`) builds clean
  • Counter task runs as unprivileged on Branch hardware without MPU faults
  • System regression tests completed without issue

🤖 Generated with Claude Code

Restore the original opt-in check (osThreadPrivileged must be explicitly
set) instead of the opt-out inversion. With CREATE_PRIVILEGED_THREAD_ATTRIBUTES
setting osThreadPrivileged on all service threads and CREATE_THREAD_ATTRIBUTES
leaving it unset for unprivileged tasks, opt-in is the correct and cleaner
default.
@nickfritz33 nickfritz33 self-assigned this May 7, 2026
@nickfritz33

nickfritz33 commented May 7, 2026

Copy link
Copy Markdown
Author

Here's an output from GDB showing the task continuously executing the unprivileged thread.
G3P-22238 UPL task running (GDB bp confirmed).rtf

@austinladshaw austinladshaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

good catch

@nickfritz33
nickfritz33 merged commit accadff into main May 8, 2026
1 check failed
@nickfritz33
nickfritz33 deleted the nick/G3P-22238/revert-to-opt-in-priv branch May 19, 2026 19:24
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.

2 participants