Skip to content

Commit

Permalink
Drone: Report errors when failing to change KASLR
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Nov 28, 2024
1 parent d6ccde9 commit 4f83a5d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .drone/drone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ set +x
echo '==================================> INSTALL'

if [[ $(uname) == "Linux" ]]; then
# Temporarily allow failures changing those values as the job might not need them
set +e
# Avoid ASAN "DEADLYSIGNAL" errors
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
# Avoid TSAN "FATAL: ThreadSanitizer: unexpected memory mapping" errors
sudo sysctl vm.mmap_rnd_bits=28
set -e
error=0
if ! { echo 0 | sudo tee /proc/sys/kernel/randomize_va_space > /dev/null; } && [[ -n ${B2_ASAN:-} ]]; then
echo -e "\n\nWARNING: Failed to disable KASLR. ASAN might fail with 'DEADLYSIGNAL'."
error=1
fi
# sysctl just ignores some failures and does't return an error, only output
if { ! out=$(sudo sysctl vm.mmap_rnd_bits=28) || [[ "$out" == *"ignoring:"* ]]; } && [[ -n ${B2_TSAN:-} ]]; then
echo -e "\n\nWARNING: Failed to change KASLR. TSAN might fail with 'FATAL: ThreadSanitizer: unexpected memory mapping'."
error=1
fi
if ((error == 1)); then
[[ "${DRONE_EXTRA_PRIVILEGED:-0}" == "True" ]] || echo 'Try passing `privileged=True` to the job in .drone.star'
echo -e "\n"
fi
fi

scripts=(
Expand Down

0 comments on commit 4f83a5d

Please sign in to comment.