mount regression test: convert mount test to use MS_NODEV

The mount regression test passes MS_MANDLOCK to the mount(2) syscall in
the test program. When the kernel is configured without
CONFIG_MANDATORY_FILE_LOCKING set, attempting to mount a filesystem with
this option always fails with EPERM. To fix, convert the test program to
use the MS_NODEV option instead.

(cherry picked from commit 49ba6af2bf)

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>

Bug: https://bugs.launchpad.net/apparmor/+bug/1765025
PR: https://gitlab.com/apparmor/apparmor/merge_requests/109
This commit is contained in:
Steve Beattie 2018-04-27 15:33:11 -07:00
parent 3f657164f2
commit e3e01943d4
Failed to generate hash of commit

View file

@ -24,7 +24,7 @@ int main(int argc, char *argv[])
} }
if (strcmp(argv[1], "mount") == 0) { if (strcmp(argv[1], "mount") == 0) {
if (mount(argv[2], argv[3], "ext2", 0xc0ed0000 | MS_MANDLOCK, NULL ) == -1) { if (mount(argv[2], argv[3], "ext2", 0xc0ed0000 | MS_NODEV, NULL ) == -1) {
fprintf(stderr, "FAIL: mount %s on %s failed - %s\n", fprintf(stderr, "FAIL: mount %s on %s failed - %s\n",
argv[2], argv[3], argv[2], argv[3],
strerror(errno)); strerror(errno));