This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][utils] Note read only mount and ptrace permission in container script
ClosedPublic

Authored by DavidSpickett on Oct 1 2021, 7:51 AM.

Diff Detail

Event Timeline

DavidSpickett created this revision.Oct 1 2021, 7:51 AM
DavidSpickett requested review of this revision.Oct 1 2021, 7:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 7:51 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Thanks for the scripts and dockerfile btw, very easy to use bar these 2 details.

ldionne requested changes to this revision.Oct 4 2021, 10:26 AM

Is the mount really read-only? I'm pretty sure I can modify files from within the Docker image and vice-versa, and everything works. Am I misunderstanding what you mean by read-only mounted?

Also, is there a reason to not always pass --cap-add=SYS_PTRACE?

Requesting changes so it shows up in my review queue.

This revision now requires changes to proceed.Oct 4 2021, 10:26 AM

Add ptrace cap always.

You were right it's not docker that's making the mount read only,
it's that the user in the container doesn't have permissions to
write to the folder in general.

I don't expect being a different user would change a CI result
too much but it would change paths and that can be noise if you're trying
to match up logs.

So added a note for a couple of ways you can fix that if you need
r/w from inside the container.

For what I was doing I just went to /tmp and did the build there,
it's not like you can't write anywhere at all.

ldionne added inline comments.Oct 6 2021, 8:51 AM
libcxx/utils/ci/run-buildbot-container
16–20

This actually doesn't match my experience. I'm able to modify the mount from within the docker container, and the user that created the monorepo on my mac (ldionne) isn't called libcxx-builder. I'm a bit confused. Is it possible that this is only on Linux?

I don't have push back against this change, except I would like to make sure the comment above is accurate.

ldionne accepted this revision.Oct 6 2021, 8:51 AM

Accepting but I would like to get to the bottom of the situation if we add the comment about r/w permissions!

This revision is now accepted and ready to land.Oct 6 2021, 8:51 AM

You're right the volume permissions are different for Linux vs Mac.
(probably Mac and Windows but I haven't tried Windows)

The legacy mode of docker for Mac uses osxfs:

All processes in containers can access the same objects in the same way as the Docker user who started the containers.

https://docker-docs.netlify.app/docker-for-mac/osxfs/

Couldn't find any docs on the gRPC FUSE that it uses now but I assume it would behave
the same way for compatibility reasons.