[lxc-users] lxc-usernsexec completely unexpected behaviour, reproducible on trunk?
Serge Hallyn
serge.hallyn at ubuntu.com
Tue Oct 13 21:14:18 UTC 2015
Quoting Fiedler Roman (Roman.Fiedler at ait.ac.at):
> Hello List,
>
> I've accidentally destroyed some files due to following unexpected
> behaviour. Is this also reproducible on trunk?
It is.
> # echo "content" > file
> # cat file
> content
> # lxc-usernsexec -m u:0:851968:65536 -m g:0:851968:65536 -- /bin/echo xxx <
> file
> # cat file
> xxx
> ent
>
> It seems, that the bad magic at least on Ubuntu trusty version is from:
>
> readlink("/proc/self/fd/0", "/tmp/file", 256) = 40 # don't know why, but stdin link is copied
Because we explicitly opentty(ttyname) on the result (ttyname) of
readlink on /proc/self/fd/0, where opentty re-opens the tty for
fds 0-2.
I guess we should open fds 1 and 2 separately, as I can certainly see
"... < script" as something you'd want to do without wiping out script.
-serge
More information about the lxc-users
mailing list