From 99fd58ee09fea3337cbfe2148207f4da958da38a Mon Sep 17 00:00:00 2001 From: John Johansen Date: Mon, 7 Apr 2025 03:07:06 -0700 Subject: [PATCH] parser: Fix special casing for detached move mounts MR: 1561 Added the ability to specify special a keyword to allow detached mounts. Unfortunately it updated remount to use the device and devbuffer when remounts current encoding doesn't support it. This caused the mount.sh regression test to fail in the following way. ``` $ sudo bash mount.sh [sudo] password for jj: using mount rules ... Error: mount failed. Test 'MOUNT (confined cap bind mount remount rprivate conflict)' was expected to 'pass'. Reason for failure 'FAIL: mount /tmp/sdtest.358520-12403-ASaOnn/mountpoint2 on /tmp/sdtest.358520-12403-ASaOnn/mountpoint failed - Permission denied' not supported by parser - skipping mount options=(nodirsync), Error: mount failed. Test 'MOUNT (confined cap mount remount option)' was expected to 'pass'. Reason for failure 'FAIL: mount /dev/loop40 on /tmp/sdtest.358520-12403-ASaOnn/mountpoint failed - Permission denied' Error: mount failed. Test 'MOUNT (confined cap mount remount)' was expected to 'pass'. Reason for failure 'FAIL: mount /dev/loop40 on /tmp/sdtest.358520-12403-ASaOnn/mountpoint failed - Permission denied' Error: mount passed. Test 'MOUNT (confined cap mount remount deny option)' was expected to 'fail' ``` Revert the change to remount. This fixes the regression failure. fa0746f2e parser: add special casing for detached move mounts Signed-off-by: John Johansen (cherry picked from commit 89e8fe9c1c1546177d3b9b0401b10e974c4518ea) Signed-off-by: John Johansen --- parser/mount.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/parser/mount.cc b/parser/mount.cc index 4eb1614e6..ca10b0804 100644 --- a/parser/mount.cc +++ b/parser/mount.cc @@ -775,17 +775,8 @@ int mnt_rule::gen_policy_remount(Profile &prof, int &count, goto fail; vec[0] = mntbuf.c_str(); } else { - if (device && strcmp(device, "detached") == 0) { - /* if (features_supports_detached_mount) ... - * not needed because this is equiv to "" - * which was preivously supported - * - * match nothing - */ - devbuf.clear(); - } else if (!clear_and_convert_entry(devbuf, device)) { + if (!convert_entry(mntbuf, device)) goto fail; - } vec[0] = mntbuf.c_str(); } /* skip device */