Hm, more problems with the chdir+mount approach - the susequent attempt to fix up readonly bind mounts results in
[pid 30540] mount(".", ".", 0x7fffca438669, MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = -1 EINVAL (Invalid argument)
(with a fix to the posted patch to mount mountentry onto itself rather than fsname in the REMOUNT case)
So I'm really tempted to suggest going with the simpler patch in comment #17
Hm, more problems with the chdir+mount approach - the susequent attempt to fix up readonly bind mounts results in
[pid 30540] mount(".", ".", 0x7fffca438669, MS_RDONLY| MS_REMOUNT| MS_BIND, NULL) = -1 EINVAL (Invalid argument)
(with a fix to the posted patch to mount mountentry onto itself rather than fsname in the REMOUNT case)
So I'm really tempted to suggest going with the simpler patch in comment #17