Skip to content
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

KeSetTimer doesn't fire when there is a heavy DPC load #189

Open
Alan-Jowett opened this issue Apr 24, 2024 · 2 comments
Open

KeSetTimer doesn't fire when there is a heavy DPC load #189

Alan-Jowett opened this issue Apr 24, 2024 · 2 comments

Comments

@Alan-Jowett
Copy link
Member

Emulated DPC threads running at thread priority time critical which starves the thread pool timer threads resulting in the timers not firing.

This breaks the eBPF for Windows epoch cleanup code which requires a timer to initiate.

@mtfriesen
Copy link
Collaborator

mtfriesen commented Apr 24, 2024

Yeah, I remember worrying about this when elevating the thread priority.

Maybe KeShouldYieldProcessor should periodically (randomly?) return TRUE to require threads/DPCs cooperate to lower IRQL, allowing the timer threadpool to fire.

This would be subtly different from kernel mode, where timers fire at IRQL > dispatch and queue a DPC, but we should be able to detect broken code in user mode by requiring the yields.

@mtfriesen
Copy link
Collaborator

We may also want to put a Sleep(0) into KeLowerIrql while in a ShouldYieldProcessor window. Sleep(0) is the equivalent of sched_yield on Linux, and would prod the scheduler to let the ready thread in the timer threadpool run.

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

No branches or pull requests

2 participants