chromium/sandbox/linux/syscall_broker/remote_syscall_arg_handler_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "sandbox/linux/syscall_broker/remote_syscall_arg_handler.h"

#include <sys/mman.h>
#include <sys/types.h>

#include <algorithm>
#include <cstring>
#include <tuple>

#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/page_size.h"
#include "base/posix/unix_domain_socket.h"
#include "base/test/bind.h"
#include "sandbox/linux/tests/test_utils.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace sandbox {
namespace syscall_broker {

namespace {
const char kPathPart[] =;

void FillBufferWithPath(char* buf, size_t size, bool null_terminate) {}

void VerifyCorrectString(std::string str, size_t size) {}

pid_t ForkWaitingChild(base::OnceCallback<void(int)>
                           after_parent_signals_callback = base::DoNothing(),
                       base::ScopedFD* parent_sync_fd = nullptr) {}

struct ReadTestConfig {};

void ReadTest(const ReadTestConfig& test_config) {}
}  // namespace

// | path + null_byte |
SANDBOX_TEST(BrokerRemoteSyscallArgHandler, BasicRead) {

// | zero + path... | ...path + null_byte + zero |
SANDBOX_TEST(BrokerRemoteSyscallArgHandler, MultipageRead) {}

// | path... | ...path |
SANDBOX_TEST_ALLOW_NOISE(BrokerRemoteSyscallArgHandler, ReadExceededPathMax) {}
// | path... | null_byte + zero |
SANDBOX_TEST_ALLOW_NOISE(BrokerRemoteSyscallArgHandler,
                         ReadBarelyExceededPathMax) {}

// | zero + path... | INACCESSIBLE |
SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadUnreadablePage) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunkMinus1) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunk) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunkPlus1) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunkEndingAtPage) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunkEndingOnePastPage) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChunkPlus1EndingOnePastPage) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, ReadChildExited) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, BasicWrite) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, WriteToInvalidAddress) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, WritePartiallyToInvalidAddress) {}

SANDBOX_TEST(BrokerRemoteSyscallArgHandler, WriteChildExited) {}

}  // namespace syscall_broker
}  // namespace sandbox