Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: add script to capture replayable commands #12608

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

DavidKorczynski
Copy link
Collaborator

@DavidKorczynski DavidKorczynski commented Oct 16, 2024

Giving #12592 (comment) a go using bashlex

Will place a script in /out/replay-build-script.sh with the script that can be used for replaying.

This is still poc and will need some adjustments, e.g. we need some more handling on the bash script's ast to reason about loops.

@DavidKorczynski
Copy link
Collaborator Author

Examples:

libtiff, which relies on redirection:

libtiff:

############################################################                                                                                                                                            pushd "$SRC/zlib"                                                                                                                                                                                       
make -j$(nproc) CFLAGS="$CFLAGS -fPIC"                                                                                                                                                                  
make install                                                                                                                                                                                            
popd                                                                                                                                                                                                    
pushd "$SRC/libjpeg-turbo"                                                                                                                                                                              
make -j$(nproc)                                                                                                                                                                                         
make install                                                                                                                                                                                            
popd                                                                                                
pushd "$SRC/jbigkit"                                                                                                                                                                                    
mv "$SRC"/jbigkit/libjbig/*.a "$WORK/lib/"                                                                                                                                                              
mv "$SRC"/jbigkit/libjbig/*.h "$WORK/include/"                                                      
popd                                                                                                                                                                                                    
make -j$(nproc)                                                                                                                                                                                         
make install                                                                                        
mkdir afl_testcases                                                                                                                                                                                     
mkdir tif                                                                                                                                                                                               
find afl_testcases -type f -name '*.tif' -exec mv -n {} tif/ \;                                                                                                                                         
zip -rj tif.zip tif/                                                                                                                                                                                    
cp tif.zip "$OUT/tiff_read_rgba_fuzzer_seed_corpus.zip"                                                                                                                                                 
cp "$SRC/tiff.dict" "$OUT/tiff_read_rgba_fuzzer.dict"                                                                                                                                                   
                                                                                                                                                                                                        
                                                                                                                                                                                                        
############################################################  

htslib:

make -j$(nproc) libhts.a test/fuzz/hts_open_fuzzer.o                                                                                                                                                    
$CXX $CXXFLAGS -o "$OUT/hts_open_fuzzer" test/fuzz/hts_open_fuzzer.o $LIB_FUZZING_ENGINE libhts.a -lz -lbz2 -llzma -lcurl -lcrypto -lpthread       

Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
Copy link
Collaborator

@oliverchang oliverchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Can you put this logic into https://github.com/google/oss-fuzz/tree/master/infra/experimental/chronos instead and follow the conventions there? (e.g. /usr/local/bin/recompile) ? that way we can easily build cached images with this at scale with existing machinery.

@DavidKorczynski
Copy link
Collaborator Author

nice!

Can you put this logic into https://github.com/google/oss-fuzz/tree/master/infra/experimental/chronos instead and follow the conventions there? (e.g. /usr/local/bin/recompile) ? that way we can easily build cached images with this at scale with existing machinery.

yeah, It'll need some more work but will move to the dir once it's ready.

Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants