aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_sandbox.c
diff options
context:
space:
mode:
authorSimon South <simon@simonsouth.net>2021-11-03 12:21:35 -0400
committerSimon South <simon@simonsouth.net>2021-11-05 10:30:51 -0400
commitd59f63f1c40771e80638bac447947e51c07e3ad4 (patch)
tree327ddcbed39b14ad138f5f9b51024d17e93a8dcd /src/test/test_sandbox.c
parentf5980e60ed519cb8c5ceded7e04f8e63c842c782 (diff)
downloadtor-d59f63f1c40771e80638bac447947e51c07e3ad4.tar.gz
tor-d59f63f1c40771e80638bac447947e51c07e3ad4.zip
test: Skip sandbox/stat_filename where "stat64" syscall defined
On 32-bit architectures where Linux provides the "stat64" system call, including i386, the sandbox is unable to filter calls to stat() as glibc uses this system call itself internally and the sandbox must allow it without restriction. Update the sandbox unit tests to skip the "sandbox/stat_filename" test on systems where the "stat64" system call is defined and the test is certain to fail. Also reorder the "#if" statement's clauses to correspond with the comment preceding it, for clarity.
Diffstat (limited to 'src/test/test_sandbox.c')
-rw-r--r--src/test/test_sandbox.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_sandbox.c b/src/test/test_sandbox.c
index e5064c58ec..ab3356771f 100644
--- a/src/test/test_sandbox.c
+++ b/src/test/test_sandbox.c
@@ -331,13 +331,13 @@ struct testcase_t sandbox_tests[] = {
SANDBOX_TEST_IN_SANDBOX(rename_filename),
/* Currently the sandbox is unable to filter stat() calls on systems where
- * glibc implements this function using the legacy "stat" system call, or where
- * glibc version 2.33 or later is in use and the newer "newfstatat" syscall is
- * available.
+ * glibc implements this function using either of the legacy "stat" or "stat64"
+ * system calls, or where glibc version 2.33 or later is in use and the newer
+ * "newfstatat" syscall is available.
*
* Skip testing sandbox_cfg_allow_stat_filename() if it seems the likely the
* function will have no effect and the test will therefore not succeed. */
-#if !defined(__NR_newfstatat) && (!defined(__NR_stat) || defined(__NR_stat64))
+#if !defined(__NR_stat) && !defined(__NR_stat64) && !defined(__NR_newfstatat)
SANDBOX_TEST_IN_SANDBOX(stat_filename),
#else
SANDBOX_TEST_SKIPPED(stat_filename),