From 7e49c161b76c687f5813e81305ca6697a397478a Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Thu, 13 Oct 2022 14:25:43 +0100 Subject: Add some system tests for KDAlloc --- test/DeterministicAllocation/nullpage-read.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/DeterministicAllocation/nullpage-read.c (limited to 'test/DeterministicAllocation/nullpage-read.c') diff --git a/test/DeterministicAllocation/nullpage-read.c b/test/DeterministicAllocation/nullpage-read.c new file mode 100644 index 00000000..15bdfd7d --- /dev/null +++ b/test/DeterministicAllocation/nullpage-read.c @@ -0,0 +1,20 @@ +// RUN: %clang %s -emit-llvm -g -c -o %t.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee -kdalloc -kdalloc-quarantine=1 -output-dir=%t.klee-out %t.bc -exit-on-error >%t.output 2>&1 +// RUN: FileCheck %s -input-file=%t.output + +#include +#include + +int main() { + struct { + int x; + int y; + } *ptr = NULL; + + // CHECK: null page access + int y; + memcpy(&y, &ptr->y, sizeof(ptr->y)); + + return 0; +} -- cgit 1.4.1