Skip to content

!proc: add schedGet and schedSet syscalls#806

Draft
adamgreloch wants to merge 5 commits into
masterfrom
adamgreloch/RTOS-1364
Draft

!proc: add schedGet and schedSet syscalls#806
adamgreloch wants to merge 5 commits into
masterfrom
adamgreloch/RTOS-1364

Conversation

@adamgreloch

Copy link
Copy Markdown
Member

TASK: RTOS-1364

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the schedGet and schedSet system calls, refactors proc_threadPriority to support targeting arbitrary threads, and updates syscalls_schedInfo to allow querying other processes. However, several critical issues were identified in the review: a potential kernel crash due to a NULL pointer dereference in syscalls_schedGet when a thread is not found; ready queue corruption in proc_threadPriority when modifying the priority of a non-running READY thread; a potential kernel panic in proc_schedGet caused by writing to a user-space pointer while holding a spinlock; and logical errors in both syscalls_schedGet and syscalls_schedSet where the calling thread is incorrectly targeted instead of the foreign process's main thread when tid is zero.

Comment thread syscalls.c Outdated
Comment thread proc/threads.c
Comment thread proc/threads.c
Comment thread syscalls.c Outdated
Comment thread syscalls.c Outdated
@adamgreloch
adamgreloch force-pushed the adamgreloch/RTOS-1364 branch from 57db788 to 64ae66f Compare July 13, 2026 14:37
@adamgreloch
adamgreloch marked this pull request as ready for review July 13, 2026 14:45
@adamgreloch
adamgreloch requested a review from a team July 13, 2026 14:46
Comment thread proc/threads.c Fixed
Comment thread proc/threads.c Fixed
@adamgreloch
adamgreloch force-pushed the adamgreloch/RTOS-1364 branch from 64ae66f to cbb5a53 Compare July 13, 2026 14:52
@github-actions

Copy link
Copy Markdown

Unit Test Results

10 890 tests  ±0   10 220 ✅ ±0   53m 47s ⏱️ + 1m 17s
   680 suites ±0      670 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit cbb5a53. ± Comparison against base commit 4b8784b.

Comment thread syscalls.c
Comment thread syscalls.c
Comment thread proc/threads.c
Comment thread proc/threads.c
Comment thread proc/threads.c
@adamgreloch

Copy link
Copy Markdown
Member Author

reverting to draft for now - will need to rethink the pid/tid relationship in the kernel for the libphoenix changes first.

@adamgreloch
adamgreloch marked this pull request as draft July 16, 2026 10:08
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.

3 participants