Set perf_event_paranoid=1 in WSL init to fix rr debugger on WSL 6.18#40937
Draft
Copilot wants to merge 2 commits into
Draft
Set perf_event_paranoid=1 in WSL init to fix rr debugger on WSL 6.18#40937Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix rr debugger failure with versions 2.7.8 and 2.7.9
Set perf_event_paranoid=1 in WSL init to fix rr debugger on WSL 6.18
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rr5.9.0 fails on WSL 2.7.8/2.7.9 (kernel 6.18). Kernel 6.18 addedMADV_GUARD_INSTALL(102); glibc 2.42+ (Ubuntu 26.04) calls it for thread stack guards viapthread_create. rr 5.9.0 intercepts it, expectsEINVAL(unknown advise), gets0(success), assertion fires, process crashes. Fixed in rr 5.9.1+.Summary of the Pull Request
Set
perf_event_paranoid=1in the WSL init, which is the standard requirement forrron WSL2. Previously users had to set this manually via/etc/sysctl.d/.PR Checklist
Detailed Description of the Pull Request / Additional comments
perf_event_paranoid=2(kernel default) blocks hardware perf counter access for unprivileged users.rrneeds level<=1to openPERF_TYPE_HARDWAREevents for traced processes. WSL init now sets this automatically sorrworks out-of-the-box whenwsl2.hardwarePerformanceCounters=true(the default on x86-64).The
MADV_GUARD_INSTALLcrash in rr 5.9.0 is a rr bug fixed upstream in rr 5.9.1. Users on WSL 2.7.8+ should upgrade to rr 5.9.1+.Change:
src/linux/init/main.cpp— addedWriteToFile("/proc/sys/kernel/perf_event_paranoid", "1\n")inInitialize().Validation Steps Performed
perf_event_paranoidsysctl exists and is writable at init time.WriteToFilesysctl pattern inInitialize().