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

Use sio2jail on WSL #265

Merged
merged 3 commits into from
Dec 8, 2024
Merged

Use sio2jail on WSL #265

merged 3 commits into from
Dec 8, 2024

Conversation

j4b6ski
Copy link
Contributor

@j4b6ski j4b6ski commented Dec 8, 2024

WSL2 (released 2019) is based on a Linux VM. In general its behavior is consistent with any other Linux system running in a VM, so there should be no reason to discriminate WSL under util.is_linux().

In the future, we might want to check for specific features such as perf counters being supported, but that is an orthogonal concern.

I have tested with several people using WSL across relatively modern laptops (Intel 8th gen and up) and in all cases the Intel PMU driver passed through enough perf counters for sio2jail to work.

If we wanted to test support for sio2jail more thoroughly, I suspect the best method might be to actually try running sio2jail or the perf tool.

WSL2 (released 2019) is based on a Linux VM. In general its behavior is
consistent with any other Linux system running in a VM, so there should
be no reason to discriminate WSL under `util.is_linux()`.

In the future, we might want to check for specific features such as
perf counters being supported, but that is an orthogonal concern.

I have tested with several people using WSL across relatively modern
laptops (Intel 8th gen and up) and in all cases the Intel PMU driver
passed through enough perf counters for sio2jail to work.

If we wanted to test support for sio2jail more thoroughly, I suspect the
best method might be to actually try running sio2jail or the perf tool.
@MasloMaslane
Copy link
Member

In the future, we might want to check for specific features such as perf counters being supported, but that is an orthogonal concern.

There is a test if perf counters are enabled, isn't there? I don't remember exactly how it works, so I may be wrong:

def check_perf_counters_enabled():

@j4b6ski
Copy link
Contributor Author

j4b6ski commented Dec 8, 2024

In the future, we might want to check for specific features such as perf counters being supported, but that is an orthogonal concern.

There is a test if perf counters are enabled, isn't there? I don't remember exactly how it works, so I may be wrong:

def check_perf_counters_enabled():

Ah, that's right, that's perfect.
It is probably a bit too expensive to put inside sio2jail_supported().
But I can see it's already called before sinol-make run which seems like a good compromise.

@j4b6ski
Copy link
Contributor Author

j4b6ski commented Dec 8, 2024

My only issue with check_perf_counters_enabled() is the comment/help text is not entirely accurate.

From my testing, setting kernel.perf_event_paranoid=2, which allows accessing perf counters on the user's processes, is enough. Note that this is the maximum documented setting, but at least ubuntu/debian provide an even more restrictive default of 3, which no longer allows perf at all.

This sio2jail check could also fail with some other issue, such as lack lacking intel PMU driver entirely, or it not supporting enough perf counters. In which case changing perf_event_paranoid won't help.

@j4b6ski
Copy link
Contributor Author

j4b6ski commented Dec 8, 2024

New diagnostic, depending on perf_event_paranoid setting:
{CCACAF99-A796-410F-9361-A0F005ACB503}
{953D8001-9CA9-483B-85DB-67AAB3FE0882}

@MasloMaslane MasloMaslane merged commit 5bebd72 into sio2project:main Dec 8, 2024
6 of 8 checks passed
@j4b6ski j4b6ski deleted the sio2jail-wsl branch December 8, 2024 18:57
MasloMaslane added a commit that referenced this pull request Jan 18, 2025
MasloMaslane added a commit that referenced this pull request Jan 18, 2025
MasloMaslane added a commit that referenced this pull request Jan 18, 2025
* Revert "Use sio2jail on WSL (#265)"

This reverts commit 5bebd72.

* Bump version
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

Successfully merging this pull request may close these issues.

2 participants