Skip to content

fuzz: fix filesystem bug, use std::__fs::filesystem#7507

Merged
htuch merged 5 commits intoenvoyproxy:masterfrom
asraa:fsbug
Jul 10, 2019
Merged

fuzz: fix filesystem bug, use std::__fs::filesystem#7507
htuch merged 5 commits intoenvoyproxy:masterfrom
asraa:fsbug

Conversation

@asraa
Copy link
Copy Markdown
Contributor

@asraa asraa commented Jul 9, 2019

Since OSS-Fuzz minijail prohibits mkdir calls, we use std::__fs::filesystem namespace which implements filesystem.

The OSS-Fuzz image was taking the mkdir branch, since neither filesystem nor experimental/filesystem was found. However, we are able to use std::__fs::filesystem branch in the OSS-Fuzz image and the std::experimental::filesystem branch locally.

Risk Level: Low
Testing: Add RELEASE_ASSERT(1==0, "") under the #if defined(_LIBCPP_VERSION) && TEST_STD_VER < 17 branch to verify that branch is taken in oss-fuzz docker. run_fuzzer with oss-fuzz docker is successful.
Fixes OSS-Fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15414

Signed-off-by: Asra Ali asraa@google.com

asraa added 3 commits July 9, 2019 10:41
…lesystem is not available

Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
#ifdef __cpp_lib_filesystem
std::filesystem::create_directories(dirname);
#if defined(_LIBCPP_VERSION) && TEST_STD_VER < 17 && !defined(__APPLE__)
std::__fs::filesystem::create_directories(dirname);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens if someone is building under a C++17 compiler option? Do they just fallback to mkdir rather than the std::filesystem implementation? Should Envoy build cleanly under C++17 (even if we are only using C++14 features)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Actually, that branch should be good for C++17, they shouldn't fall back to mkdir. Will update / recheck.

http://clang-developers.42468.n3.nabble.com/Filesystem-has-Landed-in-Libc-td4061350.html

@htuch htuch added the waiting label Jul 9, 2019
Signed-off-by: Asra Ali <asraa@google.com>
load("//bazel:repositories.bzl", "GO_VERSION", "envoy_dependencies")
load("//bazel:cc_configure.bzl", "cc_configure")

envoy_dependencies()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You probably didn't want this one. Also, format needs fixing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that, should be good now.

Signed-off-by: Asra Ali <asraa@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks!

@htuch htuch merged commit 08dc244 into envoyproxy:master Jul 10, 2019
lizan added a commit that referenced this pull request Jul 11, 2019
Description:
Cherry-picking latest commit of #7329 before release. To unbreak fuzz build. Address #7507 that bring real c++fs dependency.

Risk Level: Low
Testing: local fuzz, CI
Docs Changes:
Release Notes:

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
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