rootfs: use empty src for MS_REMOUNT

The kernel ignores these arguments, and passing them can lead to
confusing error messages (the old source is irrelevant for MS_REMOUNT),
as well as causing issues for a future patch where we switch to
move_mount(2).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2023-08-02 12:33:14 +10:00
committed by Kir Kolyshkin
parent 20b95f23ca
commit 5c7839b503
+2 -2
View File
@@ -1105,7 +1105,7 @@ func writeSystemProperty(key, value string) error {
func remount(m mountEntry, rootfs string, noMountFallback bool) error {
return utils.WithProcfd(rootfs, m.Destination, func(dstFD string) error {
flags := uintptr(m.Flags | unix.MS_REMOUNT)
err := mountViaFDs(m.Source, m.srcFD, m.Destination, dstFD, m.Device, flags, "")
err := mountViaFDs("", nil, m.Destination, dstFD, m.Device, flags, "")
if err == nil {
return nil
}
@@ -1129,7 +1129,7 @@ func remount(m mountEntry, rootfs string, noMountFallback bool) error {
}
// ... and retry the mount with flags found above.
flags |= uintptr(int(s.Flags) & checkflags)
return mountViaFDs(m.Source, m.srcFD, m.Destination, dstFD, m.Device, flags, "")
return mountViaFDs("", nil, m.Destination, dstFD, m.Device, flags, "")
})
}