kern: fix working dir after ns clone
After sending the "clone" request to /proc/$pid/ns, the current process will be moved to the working directory of $pid. Otherwise the current process could still access the file and folders on the service providing its dot, even if such service was not visible to $pid. Also, keeping the original working directory means that the 'cd' line of the current process's ns file would be different from that of $pid: the two ns files must match since the command asked for a "clone". See also https://marc.info/?l=9fans&m=150893734909969&w=2
This commit is contained in:
parent
2836ae4d66
commit
26bd1d8dc4
|
@ -1281,6 +1281,11 @@ procwrite(Chan *c, void *va, long n, int64_t off)
|
||||||
pgrpcpy(up->pgrp, p->pgrp);
|
pgrpcpy(up->pgrp, p->pgrp);
|
||||||
/* inherit noattach */
|
/* inherit noattach */
|
||||||
up->pgrp->noattach = p->pgrp->noattach;
|
up->pgrp->noattach = p->pgrp->noattach;
|
||||||
|
/* inherit dot */
|
||||||
|
if(up->dot != nil)
|
||||||
|
cclose(up->dot);
|
||||||
|
up->dot = p->dot;
|
||||||
|
incref(&up->dot->r);
|
||||||
closepgrp(opg);
|
closepgrp(opg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue