mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-02 23:35:37 +00:00
Check for newer mount options in regression test
The mount options MS_LAZYTIME and MS_NOSYMFOLLOW were added in
kernels 4.0 and 5.10, respectively. Update the mount test script
and helper to skip testing those options if they are not available.
Signed-off-by: Jon Tourville <jon.tourville@canonical.com>
(cherry picked from commit 9a760def8d
)
Signed-off-by: Jon Tourville <jon.tourville@canonical.com>
This commit is contained in:
@@ -328,6 +328,9 @@ unix_fd_client: unix_fd_client.c unix_fd_common.o
|
||||
attach_disconnected: attach_disconnected.c unix_fd_common.o
|
||||
${CC} ${CFLAGS} ${LDFLAGS} $^ -o $@ ${LDLIBS}
|
||||
|
||||
mount: mount.c
|
||||
${CC} ${CFLAGS} -std=gnu99 ${LDFLAGS} $^ -o $@ ${LDLIBS}
|
||||
|
||||
build-dep:
|
||||
@if [ `whoami` = "root" ] ;\
|
||||
then \
|
||||
|
@@ -56,8 +56,11 @@ static struct mnt_keyword_table mnt_opts_table[] = {
|
||||
{ "nostrictatime", 0, MS_STRICTATIME }, /* kernel default atime */
|
||||
{ "strictatime", MS_STRICTATIME, 0 }, /* strict atime semantics */
|
||||
|
||||
/* MS_LAZYTIME added in 4.0 kernel */
|
||||
#ifdef MS_LAZYTIME
|
||||
{ "nolazytime", 0, MS_LAZYTIME },
|
||||
{ "lazytime", MS_LAZYTIME, 0 }, /* update {a,m,c}time on the in-memory inode only */
|
||||
#endif
|
||||
|
||||
{ "acl", MS_POSIXACL, 0 },
|
||||
{ "noacl", 0, MS_POSIXACL },
|
||||
@@ -68,8 +71,11 @@ static struct mnt_keyword_table mnt_opts_table[] = {
|
||||
{ "dirsync", MS_DIRSYNC, 0 }, /* synchronous directory modifications */
|
||||
{ "nodirsync", 0, MS_DIRSYNC },
|
||||
|
||||
/* MS_NOSYMFOLLOW added in 5.10 kernel */
|
||||
#ifdef MS_NOSYMFOLLOW
|
||||
{ "nosymfollow", MS_NOSYMFOLLOW, 0 },
|
||||
{ "symfollow", 0, MS_NOSYMFOLLOW },
|
||||
#endif
|
||||
|
||||
{ "bind", MS_BIND, 0 }, /* remount part of the tree elsewhere */
|
||||
{ "rbind", MS_BIND | MS_REC, 0 }, /* idem, plus mounted subtrees */
|
||||
|
@@ -111,10 +111,14 @@ options=(
|
||||
"noiversion,iversion"
|
||||
"diratime,nodiratime"
|
||||
"nostrictatime,strictatime"
|
||||
"nolazytime,lazytime"
|
||||
"norelatime,relatime"
|
||||
"nodirsync,dirsync"
|
||||
"noacl,acl"
|
||||
)
|
||||
|
||||
# Options added in newer kernels
|
||||
new_options=(
|
||||
"nolazytime,lazytime"
|
||||
"symfollow,nosymfollow"
|
||||
)
|
||||
|
||||
@@ -270,6 +274,17 @@ setup_mnt
|
||||
runchecktest "UMOUNT (unconfined)" pass umount ${loop_device} ${mount_point}
|
||||
remove_mnt
|
||||
|
||||
# Check mount options that may not be available on this kernel
|
||||
for i in "${new_options[@]}"; do
|
||||
default="${i%,*}"
|
||||
if "$bin/mount" mount ${loop_device} ${mount_point} -o $default > /dev/null 2>&1; then
|
||||
remove_mnt
|
||||
options+=($i)
|
||||
else
|
||||
echo " not supported by kernel - skipping mount options=($i),"
|
||||
fi
|
||||
done
|
||||
|
||||
for i in "${options[@]}"; do
|
||||
default="${i%,*}"
|
||||
nondefault="${i#*,}"
|
||||
|
Reference in New Issue
Block a user