Skip to contentSkip to conversation

syscalls/mprotect01: map /dev/zero instead of /etc/passwd

PATCH RESEND New Sandeep Patil 2 participants 2 messages Mar 27, 2018 – Apr 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 syscalls/mprotect01: map /dev/zero instead of /etc/passwd

The test creates a read-only map for /etc/passwd to test against errors returned by mprotect with PROT_WRITE. This doesn't work in Android systems (no /etc/passwd)

More portable solution is to replace /etc/passwd with /dev/zero instead. That fixes the problem for Android systems

---
 testcases/kernel/syscalls/mprotect/mprotect01.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/mprotect/mprotect01.c +2 -2
index 7c4f10e02..be4d982ea 100644
@@ -137,8 +137,8 @@ static void setup2(struct test_case *self)
 
 static void setup3(struct test_case *self)
 {
-	fd = SAFE_OPEN(cleanup, "/etc/passwd", O_RDONLY);
-	
+	fd = SAFE_OPEN(cleanup, "/dev/zero", O_RDONLY);
+
 	self->len = getpagesize();
 
 	/*
Signature · 1 line
2.17.0.rc0.231.g781580f067-goog