Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7e932d0
Add pypy3 fuzzer
StanFromIreland Apr 12, 2026
c15ad50
fix branch
StanFromIreland Apr 12, 2026
730e5c9
use pypy
StanFromIreland Apr 12, 2026
a952f0a
fix flags
StanFromIreland Apr 12, 2026
8fa887f
fix flags again
StanFromIreland Apr 12, 2026
670b1dd
fix flags again * 2
StanFromIreland Apr 12, 2026
8b915a0
fix install
StanFromIreland Apr 12, 2026
d417eb6
Build fuzzers with clang
StanFromIreland Apr 12, 2026
0eea691
try some symlinks
StanFromIreland Apr 12, 2026
262e337
fix that symlink:-/
StanFromIreland Apr 12, 2026
24da6ef
fix paths
StanFromIreland Apr 12, 2026
0739b57
link directly against the .so
StanFromIreland Apr 12, 2026
22b40a3
link during fuzzer build too
StanFromIreland Apr 12, 2026
7194bb7
Add libs
StanFromIreland Apr 12, 2026
4ce00a3
Copy libpypy3-c.so to OUT
StanFromIreland Apr 12, 2026
01091a9
actually instrument
StanFromIreland Apr 12, 2026
d9fd7f7
!fixup that last one
StanFromIreland Apr 12, 2026
799c2f7
Work around RPython
StanFromIreland Apr 12, 2026
3b8fb3d
Try w ``-shared-libsan`
StanFromIreland Apr 12, 2026
99ef0a5
ubsan_standalone to path
StanFromIreland Apr 12, 2026
fd373b5
another workaround
StanFromIreland Apr 12, 2026
4f31f7e
less rebuilding
StanFromIreland Apr 12, 2026
98113a4
Empty CFLAGS for Packaging
StanFromIreland Apr 12, 2026
ee06722
install a 'lil more
StanFromIreland Apr 12, 2026
960a700
`build_cffi_fuzz.py` uses gcc
StanFromIreland Apr 12, 2026
8c7a6c0
instrument the fuzzer itself
StanFromIreland Apr 12, 2026
9a40d37
unlimit stack for ASAN builds
StanFromIreland Apr 12, 2026
57336df
unlimit stack for ASAN builds
StanFromIreland Apr 12, 2026
6a3e6be
set ulimit and link statically
StanFromIreland Apr 13, 2026
9505c72
yay! circular dependencies :-(
StanFromIreland Apr 13, 2026
49dfef2
fixup. still trying to hit that 168
StanFromIreland Apr 13, 2026
fc025ec
revert that
StanFromIreland Apr 13, 2026
8e5b2d7
tidy up now that all works
StanFromIreland Apr 13, 2026
9e3fc74
Add Matti
StanFromIreland Apr 13, 2026
b7ae55a
Add licenses
StanFromIreland Apr 13, 2026
b2c01f8
Remove me
StanFromIreland Apr 13, 2026
eaaa53a
Update to LLC
StanFromIreland Apr 13, 2026
d7a7d7f
Fix cov; add Carl :-)
StanFromIreland Apr 13, 2026
c466480
David's review, we support all engines anyway
StanFromIreland Apr 14, 2026
e785a47
Use the `lldebug` make target
StanFromIreland Apr 14, 2026
61966cc
Merge branch 'master' into pypy3
StanFromIreland Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions projects/pypy3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################


FROM gcr.io/oss-fuzz-base/base-builder

RUN apt-get update && \
apt-get install -y gcc make libffi-dev pkg-config \
zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libexpat1-dev libssl-dev libgdbm-dev tk-dev libgc-dev \
liblzma-dev libncursesw5-dev \
pypy

RUN git clone --depth 1 --branch py3.11 https://github.com/pypy/pypy.git pypy
RUN git clone --depth 1 --branch main https://github.com/StanFromIreland/pypy-fuzz.git
WORKDIR pypy
COPY build.sh $SRC/
56 changes: 56 additions & 0 deletions projects/pypy3/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash -eu
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

case $SANITIZER in
address) SAN=-fsanitize=address ;;
Comment thread
StanFromIreland marked this conversation as resolved.
undefined) SAN=-fsanitize=undefined ;;
*) SAN="" ;;
esac

CFLAGS=$(echo "$CFLAGS" | sed 's/-f[no-]*sanitize[^ ]*//g')

cd $SRC/pypy/pypy/goal
CC=clang pypy ../../rpython/bin/rpython --opt=2 --shared --source

BUILD_DIR=$(dirname $(find /tmp/usession-py3.11-* -name 'Makefile' | head -1))
make lldebug -j$(nproc) -C $BUILD_DIR "CC=clang $SAN"
cp $BUILD_DIR/pypy3*-c $BUILD_DIR/libpypy3*-c.so .
ln -sf libpypy3.11-c.so libpypy3-c.so

export LD_LIBRARY_PATH=$SRC/pypy/pypy/goal
PYPY=$SRC/pypy/pypy/goal/pypy3.11-c

# Build fuzz targets
cd $SRC/pypy-fuzz
while read -r name; do
CC=clang CFLAGS="$SAN" LDSHARED="clang -shared $SAN" $PYPY build_cffi_fuzz.py "$name"
clang $SAN $CFLAGS -fsanitize=fuzzer-no-link fuzzer_stub.c ./_pypy_fuzz_${name}.so \
-L$SRC/pypy/pypy/goal -lpypy3-c -Wl,-rpath,'$ORIGIN' \
$LIB_FUZZING_ENGINE -rdynamic -ldl -o fuzzer-${name}

cp fuzzer-${name} _pypy_fuzz_${name}.so fuzz_${name}.py $OUT/
if [ -d "corp-${name}" ]; then
zip -j "$OUT/fuzzer-${name}_seed_corpus.zip" corp-${name}/*
fi
if [ -f "dictionaries/fuzzer-${name}.dict" ]; then
cp "dictionaries/fuzzer-${name}.dict" "$OUT/"
fi
done < fuzz_targets.txt

cp $SRC/pypy/pypy/goal/libpypy3.11-c.so $OUT/libpypy3-c.so
cp ubsan_suppressions.txt $OUT/
cp -R $SRC/pypy/lib-python $OUT/
cp -R $SRC/pypy/lib_pypy $OUT/
9 changes: 9 additions & 0 deletions projects/pypy3/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
homepage: "https://pypy.org/"
language: c
main_repo: "https://github.com/pypy/pypy"
auto_ccs:
- "stanulbrych@gmail.com"
- "matti.picus@gmail.com"
- "cfbolz@gmail.com"
sanitizers:
- undefined
Comment thread
StanFromIreland marked this conversation as resolved.
15 changes: 15 additions & 0 deletions projects/pypy3/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################