previous: >>108597697
#define __NR_pivot_root 155
#define __NR_chroot 161
https://man7.org/linux/man-pages/man2/pivot_root.2.html
https://man7.org/linux/man-pages/man2/chroot.2.html
tl;dr:
change your filesystem/mount root
these syscalls are pretty neat. i think most people are probably familiar (or at least more familiar) with chroot. pivot_root seems a bit more esoteric, and it took me a few attempts at reading through the manpage before i started to fully understand it. the pivot portion of it really is key.
chroot, despite its manpage explicitly advising against it, is often used for security/sandboxing purposes. it's also pretty handy for fixing a fucked up install via live USB, or for acting within a qemu container, etc.
pivot_root feels more like what i used to think chroot did, where it's actually pivoting your root mount point
https://man7.org/linux/man-pages/man7/mount_namespaces.7.html is probably also worth reading, if you're interested
anyway, i know chroot has definitely saved my ass before. anyone else ever used it? if so, what for?
relevant resources:
man man
man syscalls
https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/