-
Notifications
You must be signed in to change notification settings - Fork 1
/
atheris-nix-bash.patch
56 lines (54 loc) · 2.42 KB
/
atheris-nix-bash.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/setup.py b/setup.py
index 68ecaa5..3529c18 100644
--- a/setup.py
+++ b/setup.py
@@ -73,7 +73,7 @@ def check_libfuzzer_version(libfuzzer):
current_path = os.path.dirname(os.path.realpath(__file__))
try:
version = subprocess.check_output(
- [current_path + "/setup_utils/check_libfuzzer_version.sh", libfuzzer])
+ ["bash",current_path + "/setup_utils/check_libfuzzer_version.sh", libfuzzer])
except subprocess.CalledProcessError as e:
sys.stderr.write("Failed to check libFuzzer version: %s" % e.stderr)
sys.stderr.write("Assuming libFuxzzer is up-to-date.")
@@ -87,7 +87,7 @@ def upgrade_libfuzzer(libfuzzer):
current_path = os.path.dirname(os.path.realpath(__file__))
try:
new_libfuzzer = subprocess.check_output(
- [current_path + "/setup_utils/upgrade_libfuzzer.sh", libfuzzer])
+ ["bash",current_path + "/setup_utils/upgrade_libfuzzer.sh", libfuzzer])
except subprocess.CalledProcessError as e:
sys.stderr.write("libFuzzer upgrade failed: %s" % e.stderr)
return libfuzzer
@@ -103,7 +103,7 @@ def get_libfuzzer_lib():
current_path = os.path.dirname(os.path.realpath(__file__))
try:
libfuzzer = subprocess.check_output(
- [current_path + "/setup_utils/find_libfuzzer.sh"])
+ ["bash",current_path + "/setup_utils/find_libfuzzer.sh"])
except subprocess.CalledProcessError as e:
sys.stderr.write(no_libfuzzer_error + "\n")
raise RuntimeError(no_libfuzzer_error)
@@ -424,7 +424,7 @@ class BuildExt(build_ext):
"""Generate a .so that contains both libFuzzer and a sanitizer."""
current_path = os.path.dirname(os.path.realpath(__file__))
- new_sanitizer = subprocess.check_output([
+ new_sanitizer = subprocess.check_output(["bash",
os.path.join(current_path, "setup_utils/merge_libfuzzer_sanitizer.sh"),
libfuzzer, sanitizer, strip_preinit
])
diff --git a/setup_utils/merge_libfuzzer_sanitizer.sh b/setup_utils/merge_libfuzzer_sanitizer.sh
index 81be4c7..a5d6232 100755
--- a/setup_utils/merge_libfuzzer_sanitizer.sh
+++ b/setup_utils/merge_libfuzzer_sanitizer.sh
@@ -30,9 +30,9 @@ if [ -z "$CXX" ]; then
export CXX="g++"
fi
fi
-
+chmod 755 "$tmpdir"
cp "$sanitizer" "$tmp_sanitizer"
-
+chmod 666 "$tmp_sanitizer"
ar d "$tmp_sanitizer" $strip_preinit # Intentionally not quoted
"$CXX" -Wl,--whole-archive "$libfuzzer" "$tmp_sanitizer" -Wl,--no-whole-archive -lpthread -ldl -shared -o "$tmp_merged"