Skip to content

Commit

Permalink
[libFuzzer] Fix guided-fuzzing-daemon installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwartzentruber committed Nov 4, 2024
1 parent 061637d commit 88c58d6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
20 changes: 6 additions & 14 deletions services/libfuzzer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@ FROM ubuntu:22.04

LABEL maintainer Jesse Schwartzentruber <[email protected]>

ENV LOGNAME worker
ENV HOSTNAME taskcluster-worker
ARG DEBIAN_FRONTEND=noninteractive

RUN useradd -d /home/worker -s /bin/bash -m worker

COPY recipes/linux/ /tmp/recipes/
COPY services/libfuzzer/setup.sh /tmp/recipes/
COPY services/fuzzing-decision /tmp/fuzzing-tc
COPY base/linux/etc/pip.conf /etc/pip.conf
RUN /tmp/recipes/setup.sh \
&& rm -rf /tmp/recipes /tmp/fuzzing-tc

COPY services/libfuzzer/launch.sh /home/worker/
COPY services/libfuzzer/libfuzzer.sh /home/worker/
COPY services/libfuzzer/coverage.sh /home/worker/
COPY services/libfuzzer/setup-target.sh /home/worker/
&& rm -rf /tmp/recipes /tmp/fuzzing-tc

ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
COPY services/libfuzzer/launch.sh \
services/libfuzzer/libfuzzer.sh \
services/libfuzzer/coverage.sh \
services/libfuzzer/setup-target.sh \
/home/worker/

WORKDIR /home/worker
ENTRYPOINT ["/usr/local/bin/fuzzing-pool-launch"]
Expand Down
4 changes: 2 additions & 2 deletions services/libfuzzer/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ EOF
cd /src/guided-fuzzing-daemon || exit 1
retry git fetch origin main
git reset --hard origin/main
pip3 install .
PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin retry pipx upgrade guided-fuzzing-daemon
)
then
echo "Failed to install guided fuzzing daemon!"
Expand Down Expand Up @@ -128,4 +128,4 @@ then
exit 0
else
exit $exit_code
fi
fi
2 changes: 1 addition & 1 deletion services/libfuzzer/libfuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source ~/.local/bin/common.sh

gcs-cat () {
# gcs-cat bucket path
python3 - "$1" "$2" << "EOF"
/opt/pipx/venvs/guided-fuzzing-daemon/bin/python - "$1" "$2" << "EOF"
import os
import sys
from google.cloud import storage
Expand Down
30 changes: 15 additions & 15 deletions services/libfuzzer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set -e
set -x
set -o pipefail

DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND

# shellcheck source=recipes/linux/common.sh
source "${0%/*}/common.sh"

Expand All @@ -24,14 +27,21 @@ SRCDIR=/tmp/fuzzing-tc ./fuzzing_tc.sh
./llvm-symbolizer.sh
./nodejs.sh
./taskcluster.sh
./worker.sh

packages=(
apt-utils
binutils
bzip2
chromium-codecs-ffmpeg-extra
curl
git
gpg-agent
gstreamer1.0-gl
gstreamer1.0-libav
gstreamer1.0-plugins-base
gstreamer1.0-plugins-ugly
gstreamer1.0-vaapi
jshon
lbzip2
less
Expand All @@ -41,33 +51,25 @@ packages=(
locales
nano
openssh-client
pipx
psmisc
python3-pip
ripgrep
screen
software-properties-common
subversion
ubuntu-restricted-addons
unzip
wget # used by oss-fuzz/infra/helper.py
xvfb
zip
)
package_recommends=(
subversion
ubuntu-restricted-addons
# used by oss-fuzz/infra/helper.py
wget
)

sys-embed "${packages[@]}"
# want recommends for these packages
retry apt-get install -y -qq "${package_recommends[@]}"
apt-install-depends firefox
apt-get remove --purge -qq xul-ext-ubufox

#### Base System Configuration

# Generate locales
locale-gen en_US.utf8

# Ensure the machine uses core dumps with PID in the filename
# https://github.com/moby/moby/issues/11740
cat << EOF | tee /etc/sysctl.d/60-fuzzos.conf > /dev/null
Expand Down Expand Up @@ -108,9 +110,7 @@ git remote add origin "https://github.com/MozillaSecurity/guided-fuzzing-daemon"
retry git fetch origin main
git checkout main
cd -
# install then uninstall so only dependencies remain
retry pip3 install google-cloud-storage /src/guided-fuzzing-daemon
pip3 uninstall -y guided-fuzzing-daemon
PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin retry pipx install /src/guided-fuzzing-daemon

/home/worker/.local/bin/cleanup.sh

Expand Down

0 comments on commit 88c58d6

Please sign in to comment.