File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3146,7 +3146,7 @@ main (int argc,
31463146
31473147 if (umount2 ("oldroot" , MNT_DETACH ))
31483148 die_with_error ("unmount old root" );
3149-
3149+ #if 0
31503150 /* This is our second pivot. It's like we're a Silicon Valley startup flush
31513151 * with cash but short on ideas!
31523152 *
@@ -3177,7 +3177,7 @@ main (int argc,
31773177 if (chdir ("/" ) != 0 )
31783178 die_with_error ("chdir /" );
31793179 }
3180-
3180+ #endif
31813181 if (opt_userns2_fd > 0 && setns (opt_userns2_fd , CLONE_NEWUSER ) != 0 )
31823182 die_with_error ("Setting userns2 failed" );
31833183
@@ -3229,7 +3229,15 @@ main (int argc,
32293229 if (res == 0 )
32303230 die ("creation of new user namespaces was not disabled as requested" );
32313231 }
3232-
3232+ #if 1
3233+ /* Now make /newroot the real root */
3234+ if (chdir ("/newroot" ) != 0 )
3235+ die_with_error ("chdir newroot" );
3236+ if (chroot ("/newroot" ) != 0 )
3237+ die_with_error ("chroot /newroot" );
3238+ if (chdir ("/" ) != 0 )
3239+ die_with_error ("chdir /" );
3240+ #endif
32333241 /* All privileged ops are done now, so drop caps we don't need */
32343242 drop_privs (!is_privileged , TRUE);
32353243
You can’t perform that action at this time.
0 commit comments