2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-28 12:58:07 +00:00

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 49ba6af2bf49be9eff89ce760cca60f33eb8e341)

Bug: https://bugs.launchpad.net/apparmor/+bug/1765025
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>

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 313e0b4266
commit 21ffea57f6
No known key found for this signature in database
GPG Key ID: 2F099E8D005E81F4

View File

@ -24,7 +24,7 @@ int main(int argc, char *argv[])
}
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",
argv[2], argv[3],
strerror(errno));