u-root: init project (#8911)

Following the addition of some fuzzing tests
([#1](https://github.com/u-root/u-root/pull/2528),
[#2](https://github.com/u-root/u-root/pull/2535),
[#3](https://github.com/u-root/u-root/pull/2536)) in the u-root project
and [preparations for this
integration](https://github.com/u-root/u-root/pull/2543).
You can check out its [website](https://u-root.org/) for more info on
the project.

Signed-off-by: Fabian Wienand <fabian.wienand@9elements.com>

Signed-off-by: Fabian Wienand <fabian.wienand@9elements.com>
This commit is contained in:
Fabian Wienand 2022-11-07 17:15:55 +01:00 committed by GitHub
parent 3f14b420ef
commit d149cddfad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# Copyright 2022 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-go
RUN git clone --depth 1 https://github.com/u-root/u-root
WORKDIR u-root
COPY build.sh $SRC/

80
projects/u-root/build.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash -eu
# Copyright 2022 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.
#
################################################################################
# cpio pkg
cd $SRC/u-root/pkg/cpio
go mod init cpio
go mod tidy
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes
go get github.com/AdamKorcz/go-118-fuzz-build/utils
cp $SRC/u-root/pkg/cpio/testdata/fuzz/*.dict $SRC/u-root/pkg/cpio/testdata/fuzz/*.options $OUT
## FuzzReadWriteNewc
zip -j $OUT/fuzz_read_write_newc_seed_corpus.zip $SRC/u-root/pkg/cpio/testdata/fuzz/corpora/*
compile_native_go_fuzzer $SRC/u-root/pkg/cpio FuzzReadWriteNewc fuzz_read_write_newc
## FuzzWriteReadInMemArchive
compile_native_go_fuzzer $SRC/u-root/pkg/cpio FuzzWriteReadInMemArchive fuzz_write_read_in_mem_archive
# grub pkg
cd $SRC/u-root/pkg/boot/grub
go mod init grub
go mod tidy
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes
go get github.com/AdamKorcz/go-118-fuzz-build/utils
cp $SRC/u-root/pkg/boot/grub/testdata/fuzz/*.dict $SRC/u-root/pkg/boot/grub/testdata/fuzz/*.options $OUT
## FuzzParseEnvFile
compile_native_go_fuzzer $SRC/u-root/pkg/boot/grub FuzzParseEnvFile fuzz_parse_env_file
## FuzzParseGrubConfig
find $SRC/u-root/pkg/boot/grub/testdata_new -name "grub.cfg" -exec zip $OUT/fuzz_parse_grub_config_seed_corpus.zip {} +
compile_native_go_fuzzer $SRC/u-root/pkg/boot/grub FuzzParseGrubConfig fuzz_parse_grub_config
# localboot pkg
cd $SRC/u-root/cmds/boot/localboot
go mod init localboot
go mod tidy
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes
go get github.com/AdamKorcz/go-118-fuzz-build/utils
cp $SRC/u-root/pkg/boot/grub/testdata/fuzz/*.dict $SRC/u-root/cmds/boot/localboot/testdata/fuzz/*.options $OUT
## FuzzParseGrubCfg
find $SRC/u-root/pkg/boot/grub/testdata_new -name "grub.cfg" -exec zip $OUT/fuzz_parse_grub_cfg_seed_corpus.zip {} +
compile_native_go_fuzzer $SRC/u-root/cmds/boot/localboot FuzzParseGrubCfg fuzz_parse_grub_cmd_cfg
# syslinux pkg
cd $SRC/u-root/pkg/boot/syslinux
go mod init syslinux
go mod tidy
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testingtypes
go get github.com/AdamKorcz/go-118-fuzz-build/utils
cp $SRC/u-root/pkg/boot/syslinux/testdata/fuzz/*.dict $SRC/u-root/pkg/boot/syslinux/testdata/fuzz/*.options $OUT
## FuzzParseSyslinuxConfig
find $SRC/u-root/pkg/boot/syslinux/testdata -name "isolinux.cfg" -exec zip $OUT/fuzz_parse_syslinux_config_seed_corpus.zip {} +
compile_native_go_fuzzer $SRC/u-root/pkg/boot/syslinux FuzzParseSyslinuxConfig fuzz_parse_syslinux_config

View File

@ -0,0 +1,12 @@
homepage: "https://u-root.org/"
main_repo: "https://github.com/u-root/u-root.git"
primary_contact: "rminnich@gmail.com"
auto_ccs:
- "fabian.wienand@9elements.com"
language: go
architectures:
- x86_64
fuzzing_engines:
- libfuzzer
sanitizers:
- address