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

Support sysfs mounts from workspaces #4897

Merged
merged 3 commits into from
Aug 2, 2021
Merged

Support sysfs mounts from workspaces #4897

merged 3 commits into from
Aug 2, 2021

Conversation

csweichel
Copy link
Contributor

This PR enables mounting sysfs from within a workspace, much the same way we mount proc. We use seccomp-notify to intercept the mount call and delegate the mount to ws-daemon's in-workspace-service (IWS).

How to test

mkdir test
sudo mount -t sysfs sysfs test

also Docker container now use a "proper" sysfs mount

docker run --rm -it alpine:latest

I hope this will help with #4889 where k3s attempts to mount sysfs.

@roboquat roboquat requested a review from rl-gitpod July 21, 2021 20:47
@csweichel csweichel requested review from fntlnz and leodido and removed request for rl-gitpod July 21, 2021 20:47
Copy link
Contributor

@leodido leodido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through this in a call with the author and it looks mostly fine to me.

There's only thing (at the moment) I'd suggest to think a bit more about: the concept of "tagged" directories in sysfs.

In fact, any sysfs directory can have a (1) "tag" that identifies which type of namespace controls how that directory is viewed.

Meaning that while /sys/class/net has a tag identifying the net namespace subsystem, the /sys/kernel/uids directory (for example) wants to be managed by the user namespace subsystem if I don't remember it wrong.

Basically, it's a Kernel mechanism to enable sysfs to present different views of various parts depending on the namespace tag.

But we should check the existence of this mechanism against specific Kernel versions (the ones Gitpod is intended to run on).

Also, we should verify whether we need and have things like /sys/kernel.

Edit

I was remembering correctly about /sys/kernel/uids tag, but it has been removed long ago.

Regarding the namespace tags I'm referring to kobject->sd (which is a kernfs_node that contains the namespace tag ns).

@fntlnz
Copy link
Contributor

fntlnz commented Jul 22, 2021

/werft run

👍 started the job as gitpod-build-cw-mount-sysfs.5

@fntlnz
Copy link
Contributor

fntlnz commented Jul 28, 2021

/werft run

👍 started the job as gitpod-build-cw-mount-sysfs.6

@csweichel
Copy link
Contributor Author

@leodido @fntlnz
What is missing from this PR/can I do to make this merged?

@codecov
Copy link

codecov bot commented Aug 1, 2021

Codecov Report

Merging #4897 (d2e1aec) into main (dbb9d9f) will increase coverage by 25.78%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##            main    #4897       +/-   ##
==========================================
+ Coverage   6.53%   32.32%   +25.78%     
==========================================
  Files          3       42       +39     
  Lines        979    10102     +9123     
==========================================
+ Hits          64     3265     +3201     
- Misses       911     6540     +5629     
- Partials       4      297      +293     
Flag Coverage Δ
components-image-builder-mk3-app ?
components-local-app-app-darwin ?
components-local-app-app-linux ?
components-local-app-app-windows ?
components-supervisor-app 36.77% <ø> (?)
components-workspacekit-app 7.69% <ø> (?)
components-ws-daemon-api-go-lib ∅ <ø> (?)
components-ws-daemon-app 23.02% <ø> (?)
components-ws-daemon-nsinsider-app ∅ <ø> (?)
components-ws-manager-app 36.32% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ents/image-builder-mk3/pkg/orchestrator/monitor.go
...image-builder-mk3/pkg/orchestrator/orchestrator.go
components/image-builder/pkg/resolve/resolve.go
...s/ws-manager/pkg/manager/internal/grpcpool/pool.go 74.46% <0.00%> (ø)
components/workspacekit/cmd/lift.go 18.18% <0.00%> (ø)
components/supervisor/pkg/supervisor/git.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/metrics.go 11.26% <0.00%> (ø)
components/ws-daemon/pkg/content/service.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/manager.go 24.89% <0.00%> (ø)
...-manager/pkg/manager/internal/workpool/workpool.go 100.00% <0.00%> (ø)
... and 35 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbb9d9f...d2e1aec. Read the comment docs.

@roboquat
Copy link
Contributor

roboquat commented Aug 2, 2021

LGTM label has been added.

Git tree hash: 318a4edf13e2f31f6f35dd8d3cc672b3b3f30591

@roboquat
Copy link
Contributor

roboquat commented Aug 2, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csweichel, leodido

Associated issue: #4889

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit 0e91076 into main Aug 2, 2021
@roboquat roboquat deleted the cw/mount-sysfs branch August 2, 2021 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants