diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:18:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:18:14 +0000 |
commit | 67c5de60daa85b91fa68be4157e248fa31e75316 (patch) | |
tree | 7d567f3360f705ac21600343ef7f7cea645a9222 /src/test | |
parent | Adding upstream version 256.1. (diff) | |
download | systemd-67c5de60daa85b91fa68be4157e248fa31e75316.tar.xz systemd-67c5de60daa85b91fa68be4157e248fa31e75316.zip |
Adding upstream version 256.2.upstream/256.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-cgroup.c | 2 | ||||
-rw-r--r-- | src/test/test-execute.c | 2 | ||||
-rw-r--r-- | src/test/test-mountpoint-util.c | 30 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/test/test-cgroup.c b/src/test/test-cgroup.c index 8bd4af9..040e9e9 100644 --- a/src/test/test-cgroup.c +++ b/src/test/test-cgroup.c @@ -159,6 +159,8 @@ TEST(id) { if (ERRNO_IS_NEG_PRIVILEGE(fd2)) log_notice("Skipping open-by-cgroup-id test because lacking privs."); + else if (ERRNO_IS_NEG_NOT_SUPPORTED(fd2)) + log_notice("Skipping open-by-cgroup-id test because syscall is missing or blocked."); else { assert_se(fd2 >= 0); diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 4b8daa4..56f5e34 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -832,6 +832,8 @@ static void test_exec_systemcallfilter(Manager *m) { return; } + test(m, "exec-systemcallfilter-writing-handoff-timestamp.service", 0, CLD_EXITED); + test(m, "exec-systemcallfilter-not-failing.service", 0, CLD_EXITED); test(m, "exec-systemcallfilter-not-failing2.service", 0, CLD_EXITED); test(m, "exec-systemcallfilter-not-failing3.service", 0, CLD_EXITED); diff --git a/src/test/test-mountpoint-util.c b/src/test/test-mountpoint-util.c index 85c0859..07c0480 100644 --- a/src/test/test-mountpoint-util.c +++ b/src/test/test-mountpoint-util.c @@ -10,6 +10,7 @@ #include "fileio.h" #include "hashmap.h" #include "log.h" +#include "missing_syscall.h" #include "mountpoint-util.h" #include "path-util.h" #include "rm-rf.h" @@ -317,6 +318,35 @@ TEST(fd_is_mount_point) { r = fd_is_mount_point(fd, NULL, 0); assert_se(IN_SET(r, 0, -ENOTDIR)); /* on old kernels we can't determine if regular files are mount points if we have no directory fd */ assert_se(fd_is_mount_point(fd, "", 0) == -EINVAL); + + if (!mount_new_api_supported()) + return; + + /* Symlinks can be mount points with new mount API */ + _cleanup_close_ int mfd = -EBADF, rfd = -EBADF; + _cleanup_free_ char *t = NULL; + struct stat st; + + safe_close(fd); + ASSERT_OK_ERRNO(fd = open(tmpdir, O_DIRECTORY|O_PATH|O_CLOEXEC)); + + ASSERT_OK_ERRNO(symlinkat("/usr", fd, "symlink")); + + mfd = open_tree(fd, "symlink", AT_SYMLINK_NOFOLLOW|OPEN_TREE_CLONE|OPEN_TREE_CLOEXEC); + if (mfd < 0 && ERRNO_IS_PRIVILEGE(errno)) + return; + ASSERT_OK_ERRNO(mfd); + + ASSERT_OK_ERRNO(rfd = openat(fd, "regular", O_CLOEXEC|O_CREAT|O_EXCL, 0644)); + + ASSERT_OK_ERRNO(move_mount(mfd, "", rfd, "", MOVE_MOUNT_F_EMPTY_PATH|MOVE_MOUNT_T_EMPTY_PATH)); + + ASSERT_OK_ERRNO(fstatat(fd, "regular", &st, AT_SYMLINK_NOFOLLOW)); + ASSERT_OK(stat_verify_symlink(&st)); + ASSERT_OK(readlinkat_malloc(fd, "regular", &t)); + ASSERT_STREQ(t, "/usr"); + + ASSERT_OK(fd_is_mount_point(fd, "regular", 0)); } TEST(ms_nosymfollow_supported) { |