-
-
Save LawnGnome/5230c00bb3b680a6c965a34c797aa95f to your computer and use it in GitHub Desktop.
Problematic rr patches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 7609d4522ec97f72c8f0749e17d1a41e6d09ae5a Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= <janisozaur@gmail.com> | |
Date: Fri, 10 Mar 2017 20:38:48 +0100 | |
Subject: [PATCH 1/3] Fix #2000: typos in ptrace_remote_unmap.c asserts | |
--- | |
src/test/ptrace_remote_unmap.c | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
diff --git a/src/test/ptrace_remote_unmap.c b/src/test/ptrace_remote_unmap.c | |
index 8f4c7ea..b7c83be 100644 | |
--- a/src/test/ptrace_remote_unmap.c | |
+++ b/src/test/ptrace_remote_unmap.c | |
@@ -50,13 +50,13 @@ void munmap_remote(pid_t child, uintptr_t start, size_t size) { | |
checked_ptrace(PTRACE_SYSCALL, child, 0, 0); | |
// Wait until entry trap | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret = child); | |
+ assert(wret == child); | |
assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
checked_ptrace(PTRACE_SYSCALL, child, 0, 0); | |
// Wait until exit trap | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret = child); | |
+ assert(wret == child); | |
assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
// Verify that the syscall didn't fail | |
checked_ptrace(PTRACE_GETREGSET, child, (void*)NT_PRSTATUS, &iov); | |
@@ -114,13 +114,13 @@ int main(void) { | |
// That caused another stop | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret = child); | |
+ assert(wret == child); | |
// Continue until the exec | |
checked_ptrace(PTRACE_CONT, child, 0, 0); | |
// This should be the exec stop | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret = child); | |
+ assert(wret == child); | |
assert(status >> 8 == (SIGTRAP | (PTRACE_EVENT_EXEC << 8))); | |
// On kernels with aggressive ASLR, the executable mapping may | |
From 9c0b9d511ef0f27be9019368f79089db187acab8 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= <janisozaur@gmail.com> | |
Date: Fri, 10 Mar 2017 20:59:57 +0100 | |
Subject: [PATCH 2/3] Fix broken conditions in asserts | |
--- | |
src/test/clone_vfork.c | 2 +- | |
src/test/cwd_inaccessible.c | 4 ++-- | |
src/test/ptrace_trace_clone.c | 2 +- | |
src/test/unshare.c | 2 +- | |
4 files changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/src/test/clone_vfork.c b/src/test/clone_vfork.c | |
index ecb6205..6151b10 100644 | |
--- a/src/test/clone_vfork.c | |
+++ b/src/test/clone_vfork.c | |
@@ -32,7 +32,7 @@ int main(int argc, char* argv[]) { | |
CLONE_VFORK | SIGCHLD, (void*)exe); | |
/* This should not execute until after the vfork child has execed */ | |
- test_assert(*shared = 1); | |
+ test_assert(*shared == 1); | |
test_assert(child == waitpid(child, &status, 0)); | |
test_assert(WIFEXITED(status) && 0 == WEXITSTATUS(status)); | |
diff --git a/src/test/cwd_inaccessible.c b/src/test/cwd_inaccessible.c | |
index 1518f74..3a478d8 100644 | |
--- a/src/test/cwd_inaccessible.c | |
+++ b/src/test/cwd_inaccessible.c | |
@@ -35,11 +35,11 @@ int main(void) { | |
test_assert(ret == -1 && errno == EACCES); | |
exit(77); | |
} | |
- test_assert(grandchild = waitpid(grandchild, &status, 0)); | |
+ test_assert(grandchild == waitpid(grandchild, &status, 0)); | |
test_assert(WIFEXITED(status) && WEXITSTATUS(status) == 77); | |
exit(78); | |
} | |
- test_assert(child = waitpid(child, &status, 0)); | |
+ test_assert(child == waitpid(child, &status, 0)); | |
test_assert(0 == rmdir("private")); | |
test_assert(WIFEXITED(status) && WEXITSTATUS(status) == 78); | |
atomic_puts("EXIT-SUCCESS"); | |
diff --git a/src/test/ptrace_trace_clone.c b/src/test/ptrace_trace_clone.c | |
index fc5b60b..18c1dc3 100644 | |
--- a/src/test/ptrace_trace_clone.c | |
+++ b/src/test/ptrace_trace_clone.c | |
@@ -29,7 +29,7 @@ int main(void) { | |
if (!grandchild) { | |
return 66; | |
} | |
- test_assert(grandchild = waitpid(grandchild, &status, 0)); | |
+ test_assert(grandchild == waitpid(grandchild, &status, 0)); | |
test_assert(WIFEXITED(status) && WEXITSTATUS(status) == 66); | |
pthread_create(&thread, NULL, do_thread, NULL); | |
diff --git a/src/test/unshare.c b/src/test/unshare.c | |
index 0c07714..2f3e783 100644 | |
--- a/src/test/unshare.c | |
+++ b/src/test/unshare.c | |
@@ -93,7 +93,7 @@ static void test_setns(void) { | |
test_assert(0 == setns(uts_ns, CLONE_NEWUTS)); | |
exit(76); | |
} | |
- test_assert(child = wait(&status)); | |
+ test_assert(child == wait(&status)); | |
test_assert(WIFEXITED(status) && WEXITSTATUS(status) == 76); | |
test_assert(0 == close(uts_ns)); | |
} | |
From d292fa1e9a611e858ec78d4480592202cf5d8ae4 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= <janisozaur@gmail.com> | |
Date: Fri, 10 Mar 2017 21:12:02 +0100 | |
Subject: [PATCH 3/3] Change stray assert()s in test to test_assert()s | |
--- | |
src/test/condvar_stress.c | 2 +- | |
src/test/invalid_jump.c | 2 +- | |
src/test/jit_proc_mem.c | 2 +- | |
src/test/ptrace_remote_unmap.c | 26 +++++++++++++------------- | |
src/test/sigqueueinfo.c | 2 +- | |
src/test/sigstop.c | 2 +- | |
src/test/sigstop2.c | 2 +- | |
src/test/sigsuspend.c | 2 +- | |
src/test/sysctl.c | 4 ++-- | |
9 files changed, 22 insertions(+), 22 deletions(-) | |
diff --git a/src/test/condvar_stress.c b/src/test/condvar_stress.c | |
index ca5b4b6..5b69245 100644 | |
--- a/src/test/condvar_stress.c | |
+++ b/src/test/condvar_stress.c | |
@@ -71,7 +71,7 @@ int main(void) { | |
{ | |
pthread_mutex_lock(&lock); | |
- assert(i == trial); | |
+ test_assert(i == trial); | |
test_assert(last_written == trial); | |
++trial; | |
if (i % 2) { | |
diff --git a/src/test/invalid_jump.c b/src/test/invalid_jump.c | |
index d4a31c3..b5b4a6e 100644 | |
--- a/src/test/invalid_jump.c | |
+++ b/src/test/invalid_jump.c | |
@@ -13,5 +13,5 @@ int main(void) { | |
// Just for clean exit to not worry people running the test manually ;). | |
signal(SIGSEGV, sighandler); | |
((void (*)(void))invalid_jump_here)(); | |
- assert(0 && "Shouldn't reach here"); | |
+ test_assert(0 && "Shouldn't reach here"); | |
} | |
diff --git a/src/test/jit_proc_mem.c b/src/test/jit_proc_mem.c | |
index fd56ca7..9e449e3 100644 | |
--- a/src/test/jit_proc_mem.c | |
+++ b/src/test/jit_proc_mem.c | |
@@ -29,7 +29,7 @@ int main(void) { | |
ssize_t to_write = nbytes > 4096 ? 4096 : nbytes; | |
int nwritten = | |
pwrite(memfd, (void*)template_function, to_write, (uintptr_t)space); | |
- assert(to_write == nwritten); | |
+ test_assert(to_write == nwritten); | |
int ret = ((int (*)(printf_func, char*))space)(atomic_printf, "EXIT-SUCCESS"); | |
breakpoint(); | |
diff --git a/src/test/ptrace_remote_unmap.c b/src/test/ptrace_remote_unmap.c | |
index b7c83be..4ad1cce 100644 | |
--- a/src/test/ptrace_remote_unmap.c | |
+++ b/src/test/ptrace_remote_unmap.c | |
@@ -8,7 +8,7 @@ | |
long checked_ptrace(enum __ptrace_request request, pid_t pid, void* addr, | |
void* data) { | |
long ret = ptrace(request, pid, addr, data); | |
- assert(ret != -1); | |
+ test_assert(ret != -1); | |
return ret; | |
} | |
@@ -50,20 +50,20 @@ void munmap_remote(pid_t child, uintptr_t start, size_t size) { | |
checked_ptrace(PTRACE_SYSCALL, child, 0, 0); | |
// Wait until entry trap | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret == child); | |
- assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
+ test_assert(wret == child); | |
+ test_assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
checked_ptrace(PTRACE_SYSCALL, child, 0, 0); | |
// Wait until exit trap | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret == child); | |
- assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
+ test_assert(wret == child); | |
+ test_assert(WSTOPSIG(status) == (SIGTRAP | 0x80)); | |
// Verify that the syscall didn't fail | |
checked_ptrace(PTRACE_GETREGSET, child, (void*)NT_PRSTATUS, &iov); | |
#ifdef __i386 | |
- assert(regs.eax != -1); | |
+ test_assert(regs.eax != -1); | |
#else | |
- assert(regs.rax != (uintptr_t)-1); | |
+ test_assert(regs.rax != (uintptr_t)-1); | |
#endif | |
} | |
@@ -105,8 +105,8 @@ int main(void) { | |
// Wait until stopped | |
int status; | |
pid_t wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret == child); | |
- assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP); | |
+ test_assert(wret == child); | |
+ test_assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP); | |
// Now PTRACE_SEIZE the child | |
checked_ptrace(PTRACE_SEIZE, child, NULL, | |
@@ -114,19 +114,19 @@ int main(void) { | |
// That caused another stop | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret == child); | |
+ test_assert(wret == child); | |
// Continue until the exec | |
checked_ptrace(PTRACE_CONT, child, 0, 0); | |
// This should be the exec stop | |
wret = waitpid(child, &status, __WALL | WSTOPPED); | |
- assert(wret == child); | |
- assert(status >> 8 == (SIGTRAP | (PTRACE_EVENT_EXEC << 8))); | |
+ test_assert(wret == child); | |
+ test_assert(status >> 8 == (SIGTRAP | (PTRACE_EVENT_EXEC << 8))); | |
// On kernels with aggressive ASLR, the executable mapping may | |
// not be in the same place that it is now. Find it again. | |
ssize_t path_size = readlink("/proc/self/exe", exe_path, 200); | |
- assert(path_size > 0); | |
+ test_assert(path_size > 0); | |
// First find the correct mapping in our own address space. | |
FILE* own_maps = fopen("/proc/self/maps", "r"); | |
diff --git a/src/test/sigqueueinfo.c b/src/test/sigqueueinfo.c | |
index 0478f07..c46d05c 100644 | |
--- a/src/test/sigqueueinfo.c | |
+++ b/src/test/sigqueueinfo.c | |
@@ -35,7 +35,7 @@ static void handle_signal(int sig, siginfo_t* si, | |
} else if (SIGUSR2 == sig) { | |
usr2_val = val; | |
} else { | |
- assert("Unexpected signal" && 0); | |
+ test_assert("Unexpected signal" && 0); | |
} | |
} | |
diff --git a/src/test/sigstop.c b/src/test/sigstop.c | |
index e66e190..c1e912d 100644 | |
--- a/src/test/sigstop.c | |
+++ b/src/test/sigstop.c | |
@@ -9,7 +9,7 @@ int main(void) { | |
if (0 == (child = fork())) { | |
kill(getpid(), SIGSTOP); | |
- assert(0 && "child should not resume"); | |
+ test_assert(0 && "child should not resume"); | |
return 77; | |
} | |
diff --git a/src/test/sigstop2.c b/src/test/sigstop2.c | |
index 0d6844b..6132e60 100644 | |
--- a/src/test/sigstop2.c | |
+++ b/src/test/sigstop2.c | |
@@ -10,7 +10,7 @@ int main(void) { | |
if (0 == (child = fork())) { | |
nanosleep(&ts, NULL); | |
kill(getpid(), SIGSTOP); | |
- assert(0 && "child should not resume"); | |
+ test_assert(0 && "child should not resume"); | |
return 77; | |
} | |
diff --git a/src/test/sigsuspend.c b/src/test/sigsuspend.c | |
index f683151..9b3e033 100644 | |
--- a/src/test/sigsuspend.c | |
+++ b/src/test/sigsuspend.c | |
@@ -26,7 +26,7 @@ static void handle_signal(int sig, __attribute__((unused)) siginfo_t* si, | |
} else if (SIGUSR2 == sig) { | |
++usr2_hit; | |
} else { | |
- assert("Unexpected signal" && 0); | |
+ test_assert("Unexpected signal" && 0); | |
} | |
} | |
diff --git a/src/test/sysctl.c b/src/test/sysctl.c | |
index 600915c..04ad123 100644 | |
--- a/src/test/sysctl.c | |
+++ b/src/test/sysctl.c | |
@@ -15,9 +15,9 @@ int main(void) { | |
atomic_printf("sysctl KERN_RTSIGMAX returned errno %d\n", errno); | |
atomic_puts("EXIT-SUCCESS"); | |
} else { | |
- assert(len == sizeof(sig_max)); | |
+ test_assert(len == sizeof(sig_max)); | |
atomic_printf("sysctl KERN_RTSIGMAX returned %d\n", sig_max); | |
- assert(sig_max > 0); | |
+ test_assert(sig_max > 0); | |
atomic_puts("EXIT-SUCCESS"); | |
} | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5a16d15ef348c069b82449dcdeaeea3c1eb8639b Mon Sep 17 00:00:00 2001 | |
From: Mike Frysinger <vapier@gentoo.org> | |
Date: Mon, 13 Feb 2017 16:01:52 -0500 | |
Subject: [PATCH] tests: include sys/sysmacros.h for minor/major funcs | |
Newer versions of glibc are deprecating the implicit sys/sysmacros.h | |
include via sys/types.h, so include it explicitly. | |
--- | |
src/test/rrutil.h | 1 + | |
1 file changed, 1 insertion(+) | |
diff --git a/src/test/rrutil.h b/src/test/rrutil.h | |
index 60de6e4..bb5b527 100644 | |
--- a/src/test/rrutil.h | |
+++ b/src/test/rrutil.h | |
@@ -76,6 +76,7 @@ | |
#include <sys/socket.h> | |
#include <sys/stat.h> | |
#include <sys/sysinfo.h> | |
+#include <sys/sysmacros.h> | |
#include <sys/time.h> | |
#include <sys/timerfd.h> | |
#include <sys/times.h> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment