-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hw: sanitize Kernel::Cpu::Context aka Kernel::Cpu_context #5319
Labels
Comments
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 13, 2024
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 13, 2024
* Rename Kernel::Cpu_job to Kernel::Cpu_context (alias Kernel::Cpu::Context) * State first Cpu affinity of Cpu::Context at construction time * Move cpu affinity argument from kernel syscall create_thread to start_thread * Ensure that Cpu pointer is always valid Fix genodelabs#5319
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 13, 2024
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 13, 2024
* Rename Kernel::Cpu_job to Kernel::Cpu_context (alias Kernel::Cpu::Context) * State first Cpu affinity of Cpu::Context at construction time * Move cpu affinity argument from kernel syscall create_thread to start_thread * Ensure that Cpu pointer is always valid Fix genodelabs#5319
chelmuth
changed the title
hw: sanitze Kernel::Cpu::Context aka Kernel::Cpu_context
hw: sanitize Kernel::Cpu::Context aka Kernel::Cpu_context
Aug 14, 2024
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 16, 2024
skalk
added a commit
to skalk/genode
that referenced
this issue
Aug 16, 2024
* Rename Kernel::Cpu_job to Kernel::Cpu_context (alias Kernel::Cpu::Context) * State first Cpu affinity of Cpu::Context at construction time * Move cpu affinity argument from kernel syscall create_thread to start_thread * Ensure that Cpu pointer is always valid Fix genodelabs#5319
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current class Kernel::Cpu_job shall be named Kernel::Cpu::Context consistently (like Kernel::Scheduler::Context). Unfortunately, we cannot define it as inner class of Kernel::Cpu, because of inheritance relations of Thread to Cpu::Context and Cpu::Idle_thread to Thread.
Anyway, at least we can name it Kernel::Cpu_context and provide a Cpu::Context alias.
More important, this class contains a pointer to a Kernel::Cpu object. This needs to be a pointer in case the affinity of the context change. Nonetheless, the pointer is directly useable by its class derivates, and heavily de-referenced without any check. Instead of using a lot of pointer sanity checks (or lambda for it), we should ensure that the Cpu pointer is set correctly at construction time, and always stays valid. Therefore, the Cpu affinity needs to be given with the Thread creation syscall, and not via the Thread start syscall.
The text was updated successfully, but these errors were encountered: