[tor-commits] [tor/main] test: Skip sandbox/stat_filename where "stat64" syscall defined

ahf at torproject.org ahf at torproject.org
Mon Nov 8 14:13:25 UTC 2021


commit d59f63f1c40771e80638bac447947e51c07e3ad4
Author: Simon South <simon at simonsouth.net>
Date:   Wed Nov 3 12:21:35 2021 -0400

    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.
---
 src/test/test_sandbox.c | 8 ++++----
 1 file 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),





More information about the tor-commits mailing list