https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9fa31e0f9b137df0d13777...
commit 9fa31e0f9b137df0d13777ba153e5e9ff8dd4ab4 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sun May 2 15:28:26 2021 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sun May 2 15:28:26 2021 +0200
[NTOS:PS] Add the missing privilege check to NtSetInformationThread:ThreadPriority
This fixes the remaining failure in the NtSetInformationThread test. --- ntoskrnl/ps/query.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/ntoskrnl/ps/query.c b/ntoskrnl/ps/query.c index ea343c51eab..0d2d1cd6e41 100644 --- a/ntoskrnl/ps/query.c +++ b/ntoskrnl/ps/query.c @@ -2033,6 +2033,7 @@ NtSetInformationThread(IN HANDLE ThreadHandle, PVOID *ExpansionSlots; PETHREAD ProcThread; ULONG Alignment; + BOOLEAN HasPrivilege; PAGED_CODE();
/* Check if we were called from user mode */ @@ -2110,6 +2111,20 @@ NtSetInformationThread(IN HANDLE ThreadHandle, break; }
+ /* Check for the required privilege */ + if (Priority >= LOW_REALTIME_PRIORITY) + { + HasPrivilege = SeCheckPrivilegedObject(SeIncreaseBasePriorityPrivilege, + ThreadHandle, + THREAD_SET_INFORMATION, + PreviousMode); + if (!HasPrivilege) + { + DPRINT1("Privilege to change priority to %lx lacking\n", Priority); + return STATUS_PRIVILEGE_NOT_HELD; + } + } + /* Reference the thread */ Status = ObReferenceObjectByHandle(ThreadHandle, THREAD_SET_INFORMATION,