-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Nodejs] initial integration. #3860
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8429ade
Nodejs initial integration.
DavidKorczynski 40e3ac1
Added headers to fix Travis.
DavidKorczynski fd19b07
A lot of simplifications to build script. LDFLAGS is the key here.
DavidKorczynski 939f015
More simplifications to build script.
DavidKorczynski ac40fd5
Fix Travis.
DavidKorczynski 3e52e5b
Remove msan.
DavidKorczynski c3417d9
Generalise and simplify build script.
DavidKorczynski f030d23
utilise all cores and a bit nicer structure in build.
DavidKorczynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2020 Google Inc. | ||
# | ||
# 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 | ||
MAINTAINER david@adalogics.com | ||
RUN apt-get update && apt-get install -y make | ||
RUN apt-get install -y flex bison build-essential | ||
RUN git clone --recursive --depth 1 https://github.com/nodejs/node | ||
WORKDIR $SRC | ||
COPY build.sh $SRC/ | ||
|
||
COPY fuzz_url.cc $SRC/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash -eu | ||
# Copyright 2020 Google Inc. | ||
# | ||
# 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. | ||
# | ||
################################################################################ | ||
cd $SRC/node | ||
|
||
# Build node | ||
export LDFLAGS="$CXXFLAGS" | ||
export LD="$CXX" | ||
./configure --without-intl --without-node-code-cache --without-dtrace --without-snapshot --without-ssl | ||
make -j$(nproc) | ||
|
||
# Gather static libraries | ||
cd $SRC/node/out | ||
rm -rf ./library_files && mkdir library_files | ||
find . -name "*.a" -exec cp {} ./library_files/ \; | ||
|
||
# Build the fuzzers | ||
CMDS="-D__STDC_FORMAT_MACROS -D__POSIX__ -DNODE_HAVE_I18N_SUPPORT=1 \ | ||
-DNODE_ARCH=\"x64\" -DNODE_PLATFORM=\"linux\" -DNODE_WANT_INTERNALS=1" | ||
INCLUDES="-I../src -I../deps/v8/include -I../deps/uv/include" | ||
|
||
# Compilation | ||
$CXX -o fuzz_url.o $SRC/fuzz_url.cc $CXXFLAGS $CMDS $INCLUDES \ | ||
-pthread -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -c | ||
|
||
# Linking | ||
$CXX -o $OUT/fuzz_url $LIB_FUZZING_ENGINE $CXXFLAGS \ | ||
-rdynamic -Wl,-z,noexecstack,-z,relro,-z,now \ | ||
-pthread -Wl,--start-group \ | ||
./Release/obj.target/cctest/src/node_snapshot_stub.o \ | ||
./Release/obj.target/cctest/src/node_code_cache_stub.o \ | ||
fuzz_url.o ./library_files/*.a \ | ||
-latomic -lm -ldl -Wl,--end-group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright 2020 Google Inc. | ||
|
||
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. | ||
*/ | ||
#include <stdlib.h> | ||
|
||
#include "node.h" | ||
#include "node_internals.h" | ||
#include "node_url.h" | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | ||
node::url::URL url2((char*)data, size); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
homepage: "https://nodejs.org" | ||
primary_contact: "security@nodejs.org" | ||
language: c++ | ||
sanitizers: | ||
- address | ||
auto_ccs: | ||
- "david@adalogics.com" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this target is pretty basic. do you have plans for targets that test more core nodejs functionality?