From d288c9ae86da545372518a68e973174ba3e9b6df Mon Sep 17 00:00:00 2001 From: Catena cyber <35799796+catenacyber@users.noreply.github.com> Date: Thu, 16 Jun 2022 10:57:54 +0200 Subject: [PATCH] gonids: recompile go to hunt bug (#7876) cf https://github.com/golang/go/issues/49075 Try to git bisect this unreproducible bug --- projects/gonids/Dockerfile | 2 ++ projects/gonids/build.sh | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/projects/gonids/Dockerfile b/projects/gonids/Dockerfile index 00fd7f2f9..4bd495611 100644 --- a/projects/gonids/Dockerfile +++ b/projects/gonids/Dockerfile @@ -15,6 +15,8 @@ ################################################################################ FROM gcr.io/oss-fuzz-base/base-builder-go +RUN git clone --depth 1 https://github.com/catenacyber/gobughunt +RUN git clone https://go.googlesource.com/go goroot RUN git clone --depth 1 https://github.com/google/gonids ADD https://rules.emergingthreats.net/open/suricata/emerging.rules.zip emerging.rules.zip diff --git a/projects/gonids/build.sh b/projects/gonids/build.sh index 1d75419a9..5a179290c 100755 --- a/projects/gonids/build.sh +++ b/projects/gonids/build.sh @@ -15,15 +15,20 @@ # ################################################################################ -# Test to fix https://github.com/golang/go/issues/49075 -# with fix of https://github.com/golang/go/issues/49961 -# ie https://go-review.googlesource.com/c/go/+/369098/ +# recompile go from git ( -cd /root/.go -git apply $SRC/372f9bd.diff || true +cd $SRC/goroot/src +export bisect_good=`cat $SRC/gobughunt/good` +export bisect_bad=`cat $SRC/gobughunt/bad` +git log $bisect_good..$bisect_bad --oneline --reverse > gitlog.txt +# take one commit in the range good..bad based on the day of the month +expr `date +"%d"` '*' `wc -l gitlog.txt | cut -d' ' -f1` / 31 > logline.txt +cat gitlog.txt | sed -n `cat logline.txt`p | cut -d' ' -f1 | xargs git checkout +./make.bash ) +rm -Rf /root/.go/ +mv $SRC/goroot /root/.go -export GODEBUG=cpu.all=off compile_go_fuzzer github.com/google/gonids FuzzParseRule fuzz_parserule cd $SRC