From 7795ca46684518143af3df8d8eb69457753db932 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Thu, 16 Nov 2023 17:27:27 +1100 Subject: [PATCH] specconv: handle recursive attribute clearing more consistently If a user specifies a configuration like "rro, rrw", we should have similar behaviour to "ro, rw" where we clear the previous flags so that the last specified flag takes precendence. Fixes: 382eba4354d7 ("Support recursive mount attrs ("rro", "rnosuid", "rnodev", ...)") Signed-off-by: Aleksa Sarai --- libcontainer/specconv/spec_linux.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcontainer/specconv/spec_linux.go b/libcontainer/specconv/spec_linux.go index 90275043e..5dc6ec79f 100644 --- a/libcontainer/specconv/spec_linux.go +++ b/libcontainer/specconv/spec_linux.go @@ -1036,8 +1036,10 @@ func parseMountOptions(options []string) *configs.Mount { } else if f, exists := recAttrFlags[o]; exists { if f.clear { recAttrClr |= f.flag + recAttrSet &= ^f.flag } else { recAttrSet |= f.flag + recAttrClr &= ^f.flag if f.flag&unix.MOUNT_ATTR__ATIME == f.flag { // https://man7.org/linux/man-pages/man2/mount_setattr.2.html // "cannot simply specify the access-time setting in attr_set, but must also include MOUNT_ATTR__ATIME in the attr_clr field."