On Sun, Apr 04, 2021 at 06:40:40PM +0200, Christian Brauner wrote: > > Very interesting. What happens if you call loop() twice? And now I wonder > > whether it's root or cwd, actually... Hmm... > > > > How about this: > > fd = open("/proc/self/mountinfo", 0); > > mkdir("./newroot/foo", 0777); > > mount("./newroot/foo", "./newroot/foo", 0, MS_BIND, NULL); > > chroot("./newroot"); > > chdir("/foo"); > > while (1) { > > static char buf[4096]; > > int n = read(fd, buf, 4096); > > if (n <= 0) > > break; > > write(1, buf, n); > > } > > close(fd); > > drop_caps(); > > loop(); > > as the end of namespace_sandbox_proc(), instead of > > chroot("./newroot"); > > chdir("/"); > > drop_caps(); > > loop(); > > sequence we have there? > > Uhum, well then we oops properly with a null-deref. Cute... Could you dump namei.o (ideally - with namei.s) from your build someplace public?