Automated rollback of commit 82c56775ef.

PiperOrigin-RevId: 328340042
Change-Id: Ib225f8012fb373c74e3f1b3e6201b2daca7da40b
This commit is contained in:
Sandboxed API Team 2020-08-25 09:00:55 -07:00 committed by Copybara-Service
parent 82c56775ef
commit e7a195ce42
26 changed files with 37 additions and 36 deletions

View File

@ -22,8 +22,8 @@
#include <vector> #include <vector>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "sandboxed_api/proto_arg.pb.h" #include "sandboxed_api/proto_arg.pb.h"
#include "sandboxed_api/util/statusor.h"
namespace sapi { namespace sapi {

View File

@ -18,11 +18,11 @@
#include <cstddef> #include <cstddef>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
#include "sandboxed_api/call.h" #include "sandboxed_api/call.h"
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/var_type.h" #include "sandboxed_api/var_type.h"
#include "sandboxed_api/util/statusor.h"
namespace sapi { namespace sapi {

View File

@ -392,7 +392,7 @@ absl::Status Sandbox::TransferFromSandboxee(v::Var* var) {
} }
sapi::StatusOr<std::string> Sandbox::GetCString(const v::RemotePtr& str, sapi::StatusOr<std::string> Sandbox::GetCString(const v::RemotePtr& str,
uint64_t max_length) { uint64_t max_length) {
if (!is_active()) { if (!is_active()) {
return absl::UnavailableError("Sandbox not active"); return absl::UnavailableError("Sandbox not active");
} }

View File

@ -102,9 +102,8 @@ class Sandbox {
absl::Status TransferToSandboxee(v::Var* var); absl::Status TransferToSandboxee(v::Var* var);
absl::Status TransferFromSandboxee(v::Var* var); absl::Status TransferFromSandboxee(v::Var* var);
sapi::StatusOr<std::string> GetCString(const v::RemotePtr& str, sapi::StatusOr<std::string> GetCString(
uint64_t max_length = 10ULL const v::RemotePtr& str, uint64_t max_length = 10ULL << 20 /* 10 MiB*/
<< 20 /* 10 MiB*/
); );
// Waits until the sandbox terminated and returns the result. // Waits until the sandbox terminated and returns the result.

View File

@ -36,7 +36,6 @@
#include "google/protobuf/message.h" #include "google/protobuf/message.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
@ -45,6 +44,7 @@
#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/statusor.h"
#ifdef MEMORY_SANITIZER #ifdef MEMORY_SANITIZER
#include "base/dynamic_annotations.h" #include "base/dynamic_annotations.h"

View File

@ -49,7 +49,6 @@ cc_binary(
"//sandboxed_api/util:flags", "//sandboxed_api/util:flags",
"//sandboxed_api/util:status", "//sandboxed_api/util:status",
"//sandboxed_api/util:statusor", "//sandboxed_api/util:statusor",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
], ],
) )

View File

@ -12,15 +12,15 @@
#include <cstring> #include <cstring>
#include "sandboxed_api/util/flag.h" #include "sandboxed_api/util/flag.h"
#include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/client.h"
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/network_proxy/client.h" #include "sandboxed_api/sandbox2/network_proxy/client.h"
#include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/fileops.h"
#include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/sandbox2/util/strerror.h"
#include "sandboxed_api/util/status.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/statusor.h"
ABSL_FLAG(bool, connect_with_handler, true, "Connect using automatic mode."); ABSL_FLAG(bool, connect_with_handler, true, "Connect using automatic mode.");

View File

@ -36,7 +36,6 @@
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/match.h" #include "absl/strings/match.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
@ -56,6 +55,7 @@
#include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/fileops.h"
#include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/sandbox2/util/strerror.h"
#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/statusor.h"
namespace { namespace {
// "Moves" the old FD to the new FD number. // "Moves" the old FD to the new FD number.

View File

@ -27,7 +27,6 @@
#include "google/protobuf/util/message_differencer.h" #include "google/protobuf/util/message_differencer.h"
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/ascii.h" #include "absl/strings/ascii.h"
#include "absl/strings/match.h" #include "absl/strings/match.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
@ -40,6 +39,7 @@
#include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/sandbox2/util/strerror.h"
#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/statusor.h"
namespace sandbox2 { namespace sandbox2 {
namespace { namespace {

View File

@ -46,7 +46,6 @@ cc_library(
"//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:status", "//sandboxed_api/util:status",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_glog//:glog", "@com_google_glog//:glog",
@ -63,7 +62,6 @@ cc_library(
"//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:status", "//sandboxed_api/util:status",
"//sandboxed_api/util:statusor", "//sandboxed_api/util:statusor",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_glog//:glog", "@com_google_glog//:glog",
], ],

View File

@ -25,9 +25,9 @@
#include <glog/logging.h> #include <glog/logging.h>
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/sandbox2/util/strerror.h"
#include "sandboxed_api/util/status.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
namespace sandbox2 { namespace sandbox2 {

View File

@ -17,9 +17,9 @@
#include <netinet/in.h> #include <netinet/in.h>
#include "absl/status/status.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/util/status.h"
namespace sandbox2 { namespace sandbox2 {

View File

@ -17,12 +17,11 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <glog/logging.h> #include <glog/logging.h>
#include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/sandbox2/util/strerror.h"
#include "sandboxed_api/util/status.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
namespace sandbox2 { namespace sandbox2 {

View File

@ -19,8 +19,8 @@
#include <memory> #include <memory>
#include "sandboxed_api/util/statusor.h"
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/util/statusor.h"
namespace sandbox2 { namespace sandbox2 {

View File

@ -29,11 +29,11 @@
#include <glog/logging.h> #include <glog/logging.h>
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "sandboxed_api/sandbox2/mounts.h" #include "sandboxed_api/sandbox2/mounts.h"
#include "sandboxed_api/sandbox2/network_proxy/filtering.h" #include "sandboxed_api/sandbox2/network_proxy/filtering.h"
#include "sandboxed_api/sandbox2/policy.h" #include "sandboxed_api/sandbox2/policy.h"
#include "sandboxed_api/util/statusor.h"
struct bpf_labels; struct bpf_labels;

View File

@ -26,7 +26,6 @@
#include <glog/logging.h> #include <glog/logging.h>
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "sandboxed_api/util/statusor.h"
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/executor.h"
#include "sandboxed_api/sandbox2/ipc.h" #include "sandboxed_api/sandbox2/ipc.h"
@ -34,6 +33,7 @@
#include "sandboxed_api/sandbox2/notify.h" #include "sandboxed_api/sandbox2/notify.h"
#include "sandboxed_api/sandbox2/policy.h" #include "sandboxed_api/sandbox2/policy.h"
#include "sandboxed_api/sandbox2/result.h" #include "sandboxed_api/sandbox2/result.h"
#include "sandboxed_api/util/statusor.h"
namespace sandbox2 { namespace sandbox2 {

View File

@ -183,8 +183,8 @@ bool CreateMemFd(int* fd, const char* name) {
} }
sapi::StatusOr<int> Communicate(const std::vector<std::string>& argv, sapi::StatusOr<int> Communicate(const std::vector<std::string>& argv,
const std::vector<std::string>& envv, const std::vector<std::string>& envv,
std::string* output) { std::string* output) {
int cout_pipe[2]; int cout_pipe[2];
posix_spawn_file_actions_t action; posix_spawn_file_actions_t action;

View File

@ -63,8 +63,8 @@ bool CreateMemFd(int* fd, const char* name = "buffer_file");
// Executes a the program given by argv and the specified environment and // Executes a the program given by argv and the specified environment and
// captures any output to stdout/stderr. // captures any output to stdout/stderr.
sapi::StatusOr<int> Communicate(const std::vector<std::string>& argv, sapi::StatusOr<int> Communicate(const std::vector<std::string>& argv,
const std::vector<std::string>& envv, const std::vector<std::string>& envv,
std::string* output); std::string* output);
// Returns signal description. // Returns signal description.
std::string GetSignalName(int signo); std::string GetSignalName(int signo);

View File

@ -219,7 +219,8 @@ absl::Status ElfParser::ReadFileHeader() {
return absl::OkStatus(); return absl::OkStatus();
} }
sapi::StatusOr<Elf64_Shdr> ElfParser::ReadSectionHeader(absl::string_view src) { sapi::StatusOr<Elf64_Shdr> ElfParser::ReadSectionHeader(
absl::string_view src) {
if (src.size() < sizeof(Elf64_Shdr)) { if (src.size() < sizeof(Elf64_Shdr)) {
return absl::FailedPreconditionError( return absl::FailedPreconditionError(
absl::StrCat("invalid section header data: got ", src.size(), absl::StrCat("invalid section header data: got ", src.size(),
@ -292,7 +293,8 @@ sapi::StatusOr<std::string> ElfParser::ReadSectionContents(
return rv; return rv;
} }
sapi::StatusOr<Elf64_Phdr> ElfParser::ReadProgramHeader(absl::string_view src) { sapi::StatusOr<Elf64_Phdr> ElfParser::ReadProgramHeader(
absl::string_view src) {
if (src.size() < sizeof(Elf64_Phdr)) { if (src.size() < sizeof(Elf64_Phdr)) {
return absl::FailedPreconditionError( return absl::FailedPreconditionError(
absl::StrCat("invalid program header data: got ", src.size(), absl::StrCat("invalid program header data: got ", src.size(),
@ -512,7 +514,7 @@ sapi::StatusOr<ElfFile> ElfParser::Parse(FILE* elf, uint32_t features) {
} }
sapi::StatusOr<ElfFile> ElfFile::ParseFromFile(const std::string& filename, sapi::StatusOr<ElfFile> ElfFile::ParseFromFile(const std::string& filename,
uint32_t features) { uint32_t features) {
std::unique_ptr<FILE, void (*)(FILE*)> elf{fopen(filename.c_str(), "r"), std::unique_ptr<FILE, void (*)(FILE*)> elf{fopen(filename.c_str(), "r"),
[](FILE* f) { fclose(f); }}; [](FILE* f) { fclose(f); }};
if (!elf) { if (!elf) {

View File

@ -34,7 +34,7 @@ class ElfFile {
}; };
static sapi::StatusOr<ElfFile> ParseFromFile(const std::string& filename, static sapi::StatusOr<ElfFile> ParseFromFile(const std::string& filename,
uint32_t features); uint32_t features);
int64_t file_size() const { return file_size_; } int64_t file_size() const { return file_size_; }
const std::string& interpreter() const { return interpreter_; } const std::string& interpreter() const { return interpreter_; }

View File

@ -46,10 +46,10 @@ constexpr absl::string_view kHeaderProlog =
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "sandboxed_api/sandbox.h" #include "sandboxed_api/sandbox.h"
#include "sandboxed_api/vars.h" #include "sandboxed_api/vars.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/statusor.h"
)"; )";
constexpr absl::string_view kHeaderEpilog = constexpr absl::string_view kHeaderEpilog =

View File

@ -18,12 +18,12 @@
#include <string> #include <string>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "clang/AST/Decl.h" #include "clang/AST/Decl.h"
#include "clang/AST/Type.h" #include "clang/AST/Type.h"
#include "sandboxed_api/tools/clang_generator/generator.h" #include "sandboxed_api/tools/clang_generator/generator.h"
#include "sandboxed_api/tools/clang_generator/types.h" #include "sandboxed_api/tools/clang_generator/types.h"
#include "sandboxed_api/util/statusor.h"
namespace sapi { namespace sapi {

View File

@ -18,12 +18,12 @@
#include <iostream> #include <iostream>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "clang/Format/Format.h" #include "clang/Format/Format.h"
#include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/fileops.h"
#include "sandboxed_api/tools/clang_generator/diagnostics.h" #include "sandboxed_api/tools/clang_generator/diagnostics.h"
#include "sandboxed_api/tools/clang_generator/emitter.h" #include "sandboxed_api/tools/clang_generator/emitter.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/statusor.h"
namespace sapi { namespace sapi {
namespace { namespace {
@ -68,7 +68,7 @@ bool GeneratorASTVisitor::VisitFunctionDecl(clang::FunctionDecl* decl) {
namespace internal { namespace internal {
sapi::StatusOr<std::string> ReformatGoogleStyle(const std::string& filename, sapi::StatusOr<std::string> ReformatGoogleStyle(const std::string& filename,
const std::string& code) { const std::string& code) {
// Configure code style based on Google style, but enforce pointer alignment // Configure code style based on Google style, but enforce pointer alignment
clang::format::FormatStyle style = clang::format::FormatStyle style =
clang::format::getGoogleStyle(clang::format::FormatStyle::LK_Cpp); clang::format::getGoogleStyle(clang::format::FormatStyle::LK_Cpp);

View File

@ -20,13 +20,13 @@
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "sandboxed_api/util/statusor.h"
#include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h" #include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/Tooling.h" #include "clang/Tooling/Tooling.h"
#include "sandboxed_api/tools/clang_generator/types.h" #include "sandboxed_api/tools/clang_generator/types.h"
#include "sandboxed_api/util/statusor.h"
namespace sapi { namespace sapi {
@ -67,7 +67,7 @@ class GeneratorASTVisitor
namespace internal { namespace internal {
sapi::StatusOr<std::string> ReformatGoogleStyle(const std::string& filename, sapi::StatusOr<std::string> ReformatGoogleStyle(const std::string& filename,
const std::string& code); const std::string& code);
} // namespace internal } // namespace internal

View File

@ -208,7 +208,7 @@ std::string MapQualTypeReturn(const clang::ASTContext& context,
return "absl::Status"; return "absl::Status";
} }
// Remove const qualifier like in MapQualType(). // Remove const qualifier like in MapQualType().
return absl::StrCat("sapi::StatusOr<", return absl::StrCat("::sapi::StatusOr<",
MaybeRemoveConst(context, qual).getAsString(), ">"); MaybeRemoveConst(context, qual).getAsString(), ">");
} }

View File

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// This file and it's implementation provide a custom fork of
// util/task/status.h. This will become obsolete and will be replaced once
// Abseil releases absl::Status.
#ifndef THIRD_PARTY_SAPI_UTIL_STATUS_H_ #ifndef THIRD_PARTY_SAPI_UTIL_STATUS_H_
#define THIRD_PARTY_SAPI_UTIL_STATUS_H_ #define THIRD_PARTY_SAPI_UTIL_STATUS_H_