[PATCH] root-hopping for pre-2.3.41-3

almesber en lrc.di.epfl.ch almesber en lrc.di.epfl.ch
Mie Ene 26 15:22:18 CST 2000


Horst von Brand wrote:
> What about mounts under the (now old) root? What if /new_root/usr doesn't
> exist, is not a directory, has something else mounted? What happens with
> open /dev/whatever?

Wrong approach: too complex, too intrusive, too unreliable.

Just changing root and cwd if they are exactly at the root of the file
system covers 99.9% of the useful cases. Things that access anything else
are likely to have a strong dislike to being "rerouted", because then you
also have to touch the inode. Think of /var/log/syslog becoming
/elsewhere/var/log/syslog, or subtle cases like
ln /dev/tty0 /dev/console  vs.  cd /elsewhere/dev; ln ttyS0 console

No, let's keep this simple. If you try to root-hop a fully running
system, you're almost guaranteed that something will get in the way, or
that you'll screw up something's assumptions in a subtle but
disastrous way. So it's not worth even trying.

On the other hand, changing root and cwd iff at the old root, while
already a bit hackish, still gives predictable semantics, e.g. from the
perspective of the process experiencing the forced chroot, this is
pretty much equivalent to root doing an  rm -rf /  followed by
re-populating / with some other content. A bit rude perhaps, but
something that could happen in the real world. (Unlike a VC becoming a
serial port, file, etc.)

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger en ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda