Bug 1376653 - Fix handling of architecture differences for getdents. r?gcp draft
authorJed Davis <jld@mozilla.com>
Tue, 11 Jul 2017 17:03:06 -0600
changeset 610047 42a5721caa961bcf485479e4a6bd38dfd7944bf6
parent 610046 611b3ee0879063f1885845a575e02fdcc796d9af
child 637750 d6bbd7d597ac04016c5d25d11631f82f28efa04d
push id68770
push userbmo:jld@mozilla.com
push dateMon, 17 Jul 2017 20:57:18 +0000
reviewersgcp
bugs1376653
milestone56.0a1
Bug 1376653 - Fix handling of architecture differences for getdents. r?gcp MozReview-Commit-ID: ArGStWwkJAg
security/sandbox/linux/SandboxFilterUtil.h
--- a/security/sandbox/linux/SandboxFilterUtil.h
+++ b/security/sandbox/linux/SandboxFilterUtil.h
@@ -100,34 +100,38 @@ public:
 #ifdef __NR_stat64
 #define CASES_FOR_stat   case __NR_stat64
 #define CASES_FOR_lstat   case __NR_lstat64
 #define CASES_FOR_fstat   case __NR_fstat64
 #define CASES_FOR_fstatat   case __NR_fstatat64
 #define CASES_FOR_statfs   case __NR_statfs64: case __NR_statfs
 #define CASES_FOR_fstatfs   case __NR_fstatfs64: case __NR_fstatfs
 #define CASES_FOR_fcntl   case __NR_fcntl64
-// We're using the 32-bit version on 32-bit desktop for some reason.
-#define CASES_FOR_getdents   case __NR_getdents64: case __NR_getdents
 // FIXME: we might not need the compat cases for these on non-Android:
 #define CASES_FOR_lseek   case __NR_lseek: case __NR__llseek
 #define CASES_FOR_ftruncate   case __NR_ftruncate: case __NR_ftruncate64
 #else
 #define CASES_FOR_stat   case __NR_stat
 #define CASES_FOR_lstat   case __NR_lstat
 #define CASES_FOR_fstatat   case __NR_newfstatat
 #define CASES_FOR_fstat   case __NR_fstat
 #define CASES_FOR_fstatfs   case __NR_fstatfs
 #define CASES_FOR_statfs   case __NR_statfs
 #define CASES_FOR_fcntl   case __NR_fcntl
-#define CASES_FOR_getdents   case __NR_getdents
 #define CASES_FOR_lseek   case __NR_lseek
 #define CASES_FOR_ftruncate   case __NR_ftruncate
 #endif
 
+// getdents is not like the other FS-related syscalls with a "64" variant
+#ifdef __NR_getdents
+#define CASES_FOR_getdents   case __NR_getdents64: case __NR_getdents
+#else
+#define CASES_FOR_getdents   case __NR_getdents64
+#endif
+
 #ifdef __NR_sigprocmask
 #define CASES_FOR_sigprocmask   case __NR_sigprocmask: case __NR_rt_sigprocmask
 #define CASES_FOR_sigaction   case __NR_sigaction: case __NR_rt_sigaction
 #define CASES_FOR_sigreturn   case __NR_sigreturn: case __NR_rt_sigreturn
 #else
 #define CASES_FOR_sigprocmask   case __NR_rt_sigprocmask
 #define CASES_FOR_sigaction   case __NR_rt_sigaction
 #define CASES_FOR_sigreturn   case __NR_rt_sigreturn