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: 382eba4354 ("Support recursive mount attrs ("rro", "rnosuid", "rnodev", ...)")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2023-11-16 17:27:27 +11:00
parent cdff09ab87
commit 7795ca4668
+2
View File
@@ -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."