PsCreateSystemThreadEx: OPTIONAL is on the wrong parameter
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
Read the PsCreateSystemThreadEx declaration in lib/xboxkrnl/xboxkrnl.h and compare its OPTIONAL annotations with the kernel behavior described in the issue. Update the annotations so SystemRoutine is required and StartRoutine is optional; the issue says nxdk’s CreateThread in lib/winapi/thread.c passes both. Done when the declaration reflects that contract.
Written by the indexing model from the issue text.
Description
In lib/xboxkrnl/xboxkrnl.h, PsCreateSystemThreadEx marks SystemRoutine as OPTIONAL and StartRoutine as required. The kernel uses them the other way round:
- The new thread always starts by calling
SystemRoutine, so it must not be NULL. See for example nboxkrnl,src/ke/thread.cpp(call ecx // SystemRoutine should never return). StartRoutineandStartContextare only passed on toSystemRoutineas arguments, soStartRoutinemay be NULL when the system routine doesn't use it.
RadWolfie reported this in the xbox_kernel_test_suite (Cxbx-Reloaded/xbox_kernel_test_suite#130).
nxdk's own CreateThread (lib/winapi/thread.c) always passes both, so no existing nxdk caller is affected. Only the annotation is wrong:
IN PKSTART_ROUTINE StartRoutine OPTIONAL,
IN PVOID StartContext,
IN BOOLEAN CreateSuspended,
IN BOOLEAN DebuggerThread,
IN PKSYSTEM_ROUTINE SystemRoutine
- Dominant language
- C
- Stars
- 600
- Forks
- 97
- Avg merge
- 11h 48m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from XboxDev/nxdk
-
Use faster memcpyOpen
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 38/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
libsndfile/libsndfile#1239 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100