summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2019-12-10 11:40:29 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-10 11:42:03 -0800
commit769e1cdcbe539ca2347ad5ccd2706ae17777aed9 (patch)
tree953ce558c48288d581adef8aecfc30ae24efdb2c
parentf6e87be82f189d7d2176dc2ca4a2d261481a032a (diff)
Re-enable execveat test that was causing files in /bin to be deleted.
Test now no longer deletes files incorrectly, due to a fix in fs utils used by TempPath (github.com/google/gvisor/pull/1368). Fixes #1366 PiperOrigin-RevId: 284814605
-rw-r--r--test/syscalls/linux/exec.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/syscalls/linux/exec.cc b/test/syscalls/linux/exec.cc
index e402d5b27..b5e0a512b 100644
--- a/test/syscalls/linux/exec.cc
+++ b/test/syscalls/linux/exec.cc
@@ -696,6 +696,15 @@ TEST(ExecveatTest, SymlinkNoFollowAndEmptyPath) {
ArgEnvExitStatus(0, 0), absl::StrCat(path, "\n"));
}
+TEST(ExecveatTest, SymlinkNoFollowIgnoreSymlinkAncestor) {
+ TempPath parent_link =
+ ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateSymlinkTo("/tmp", "/bin"));
+ std::string path_with_symlink = JoinPath(parent_link.path(), "echo");
+
+ CheckExecveat(AT_FDCWD, path_with_symlink, {path_with_symlink}, {},
+ AT_SYMLINK_NOFOLLOW, ArgEnvExitStatus(0, 0), "");
+}
+
TEST(ExecveatTest, SymlinkNoFollowWithNormalFile) {
const FileDescriptor dirfd =
ASSERT_NO_ERRNO_AND_VALUE(Open("/bin", O_DIRECTORY));