You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pussuw (via GitHub)" <gi...@apache.org> on 2023/06/06 12:20:58 UTC
[GitHub] [nuttx] pussuw opened a new pull request, #9485: arch/riscv: Store user context into the kernel stack
pussuw opened a new pull request, #9485:
URL: https://github.com/apache/nuttx/pull/9485
## Summary
If a kernel stack exists, use that whenever the user process is in
privileged mode, i.e. running an exception or in system call. Previously
the exception context was stored into the user's stack, which is not ideal.
Why?
1. Because the exception entry status (REG_INT_CTX) is needed by the
kernel, and this is now in user memory which requires that the correct
user mappings are active when it is accessed.
2. The user must currently account for the exception stack frame (which
is BIG) in its own stack allocation. Moving the exception context save
to the kernel stack offloads this responsibility from the user to the
kernel, which is IMO the correct behavior.
3. The kernel access to user memory is currently allowed without condition,
however this is not ideal either. The privileged mode status CSR (MSTATUS/SSTATUS) allows
blocking access to user memory via the STATUS_SUM-bit, which should be
disabled by default and only enabled when access to user space is really
needed. This patch allows implementing such features.
Also had to fix arm_initialstate due to execution ordering: the allocated kstack pointer in xcptcontext is wiped by memset if
it is allocated before call to arm_initialstate.
## Impact
Significant, changes the kernel stack functionality entirely, but affects risc-v targets that define:
CONFIG_ARCH_ADDRENV=y
CONFIG_ARCH_KERNEL_STACK=y
Others are not affected by this.
## Testing
icicle:knsh
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] anchao merged pull request #9485: arch/riscv: Store user context into the kernel stack
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao merged PR #9485:
URL: https://github.com/apache/nuttx/pull/9485
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org