[NTOS:PS] Add the missing privilege check to NtSetInformationThread:ThreadPriority

This fixes the remaining failure in the NtSetInformationThread test.
This commit is contained in:
Eric Kohl 2021-05-02 15:28:26 +02:00
parent 4d7062abb6
commit 9fa31e0f9b

View file

@ -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,