Conversation
|
Nice, will look at this today. The alternative approach that runc takes (although I'd need to remember why, the likely answer is security or correctness) is to make the pty in the "container" (during the setup, but definitely after all the namespaces are up), and then send the fd via a unix domain socket, although we could use pidfd as well, to the parent. That'd be a much more involved change however. |
If the pty device originated from a devpts instance outside the containers mount namespace resolving that pty will fail with ENODEV in various libc functions confusing some tools. There's other very security relevant aspects but those only come into play once you start allocating pty FDs when spawning a shell or process in the container. Doing that correctly is a bit more involved as allocating ptys from inside the container must be done via rather involved special purpose APIs. |
|
yeah like @brauner said I wasn't looking at that too much but I think there are some allocating the pty in the container would avoid working with the container's |
Makes sense okay @elijah-wright Here is what I'm mentioning https://github.com/opencontainers/runc/blob/b1722d790214952e8a20d4ddd6a83451b9b665a1/libcontainer/init_linux.go#L370. The tricky part is like you'd mentioned, the setup for IO for our process type assumes we |
Yep! |
|
do you want me to change the PR to match |
|
@elijah-wright Yes, I think it's the right approach. |
b5afb60 to
523bf42
Compare
|
@dcantah can you look at my new changes |
|
@elijah-wright Will look at the new push tomorrow morning (or tonight possibly), but can you run |
|
oh ok ty. I'm at work but I can do it in a few hours |
|
@dcantah I think I fixed the build problems |
|
@dcantah I'm stuck on the |
|
@elijah-wright I'll take a look, let me pull this locally |
|
@elijah-wright Seems Swift can't generate bindings for variadic c functions is the problem 😔, so I've written us some wrappers here we can use for this. This should be checked in tomorrow morning I imagine #189. You're going to want to rebase here also as it seems a little behind |
48f6cec to
b409314
Compare
b409314 to
958a83b
Compare
19d1fa1 to
afe1122
Compare
|
Ok you should be set to rebase on main and grab the new wrappers |
52633b3 to
f473aaf
Compare
f473aaf to
141deea
Compare
|
@dcantah ok after some trial and error I think it's good, I did some work getting it ready for the new wrappers yesterday but rebase kept unsigning the commits |
|
@dcantah I haven't looked at your changes yet, do you want to implement them here? I can do it in a few hours if not |
|
Yea I can fool around with it and post a patch we can apply here |
|
Sorry for delay, the long weekend consumed me 😂. I have this almost functioning and will push a patch here you can apply and we can work together on |
|
no that's ok! do you want me to squash these commits together and then you can apply the patch yourself? if not that's ok. I want you to get credit for what you did |
|
Squashing now would help, but we can just put a "co-authored by" line on the final commit so it doesn't matter much |
|
@elijah-wright I ended up posting a separate PR with you as a co-author here #248. I realized we needed quite a bit of reworking on the IO types to get systemd happy (which this change was aimed at originally) which made the patches diverge so much that review would be confusing here. Thanks so much for working on this so far! |
|
yea np! I think I learned a lot from this lol. do you want me to close this? |
|
Yea I can close it out. I couldn't add you as a reviewer over on #248 but please do review if you want to, curious on your insight! |
fixes #145
this PR changes
configureConsole()to bind mount/dev/consoleifprocess.terminalis true. I couldn't think of a better way to get the pty path so I usedreadlink. most OCI images don't have/dev/consolebecause they don't havemknodanddevtmpfswon't create/dev/consolewithout a physical console in the namespace, so it also creates/dev/console@dcantah