mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Internal change
PiperOrigin-RevId: 244881751 Change-Id: I3f3200c4d85906058ac17ed941e69ea22d9a4090
This commit is contained in:
parent
0fd468be7c
commit
63006c1476
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
namespace sapi {
|
namespace sapi {
|
||||||
|
|
||||||
::sapi::Status RPCChannel::Call(const FuncCall& call, uint32_t tag, FuncRet* ret,
|
::sapi::Status RPCChannel::Call(const FuncCall& call, uint32_t tag,
|
||||||
v::Type exp_type) {
|
FuncRet* ret, v::Type exp_type) {
|
||||||
absl::MutexLock lock(&mutex_);
|
absl::MutexLock lock(&mutex_);
|
||||||
if (!comms_->SendTLV(tag, sizeof(call),
|
if (!comms_->SendTLV(tag, sizeof(call),
|
||||||
reinterpret_cast<const uint8_t*>(&call))) {
|
reinterpret_cast<const uint8_t*>(&call))) {
|
||||||
|
|
|
@ -51,9 +51,10 @@ class CommsTest : public ::testing::Test {
|
||||||
timespec ts1, ts2;
|
timespec ts1, ts2;
|
||||||
CHECK_NE(clock_gettime(CLOCK_REALTIME, &ts1), -1);
|
CHECK_NE(clock_gettime(CLOCK_REALTIME, &ts1), -1);
|
||||||
CHECK_NE(clock_gettime(CLOCK_REALTIME, &ts2), -1);
|
CHECK_NE(clock_gettime(CLOCK_REALTIME, &ts2), -1);
|
||||||
snprintf(sockname_, sizeof(sockname_), "comms-test-%u-%u-%u-%u",
|
snprintf(
|
||||||
static_cast<uint32_t>(ts1.tv_sec), static_cast<uint32_t>(ts1.tv_nsec),
|
sockname_, sizeof(sockname_), "comms-test-%u-%u-%u-%u",
|
||||||
static_cast<uint32_t>(ts2.tv_sec), static_cast<uint32_t>(ts2.tv_nsec));
|
static_cast<uint32_t>(ts1.tv_sec), static_cast<uint32_t>(ts1.tv_nsec),
|
||||||
|
static_cast<uint32_t>(ts2.tv_sec), static_cast<uint32_t>(ts2.tv_nsec));
|
||||||
LOG(INFO) << "Sockname: " << sockname_;
|
LOG(INFO) << "Sockname: " << sockname_;
|
||||||
|
|
||||||
// Comms channel using a descriptor (initialized with a file descriptor).
|
// Comms channel using a descriptor (initialized with a file descriptor).
|
||||||
|
@ -406,8 +407,9 @@ class SenderThread {
|
||||||
SenderThread(Comms* comms, size_t rounds) : comms_(comms), rounds_(rounds) {}
|
SenderThread(Comms* comms, size_t rounds) : comms_(comms), rounds_(rounds) {}
|
||||||
void operator()() {
|
void operator()() {
|
||||||
for (size_t i = 0; i < rounds_; i++) {
|
for (size_t i = 0; i < rounds_; i++) {
|
||||||
ASSERT_THAT(comms_->SendBytes(reinterpret_cast<const uint8_t*>("Test"), 4),
|
ASSERT_THAT(
|
||||||
IsTrue());
|
comms_->SendBytes(reinterpret_cast<const uint8_t*>("Test"), 4),
|
||||||
|
IsTrue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ buffer.Create(1ULL << 20); // 1 MiB
|
||||||
s2.RunAsync();
|
s2.RunAsync();
|
||||||
comms->SendFD(buffer.GetFD());
|
comms->SendFD(buffer.GetFD());
|
||||||
auto result = s2.AwaitResult();
|
auto result = s2.AwaitResult();
|
||||||
uint8* buf = buffer.buffer(); // As modified by sandboxee
|
uint8_t* buf = buffer.buffer(); // As modified by sandboxee
|
||||||
size_t len = buffer.size();
|
size_t len = buffer.size();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ int fd;
|
||||||
comms.RecvFD(&fd);
|
comms.RecvFD(&fd);
|
||||||
sandbox2::Buffer buffer;
|
sandbox2::Buffer buffer;
|
||||||
buffer.Setup(fd);
|
buffer.Setup(fd);
|
||||||
uint8 *buf = buffer.GetBuffer();
|
uint8_t *buf = buffer.GetBuffer();
|
||||||
memset(buf, 'X', buffer.GetSize()); /* work with the buffer */
|
memset(buf, 'X', buffer.GetSize()); /* work with the buffer */
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ std::string DemangleSymbol(const std::string& maybe_mangled) {
|
||||||
}
|
}
|
||||||
return maybe_mangled;
|
return maybe_mangled;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetSymbolAt(const std::map<uint64_t, std::string>& addr_to_symbol,
|
std::string GetSymbolAt(const std::map<uint64_t, std::string>& addr_to_symbol,
|
||||||
uint64_t addr) {
|
uint64_t addr) {
|
||||||
auto entry_for_next_symbol = addr_to_symbol.lower_bound(addr);
|
auto entry_for_next_symbol = addr_to_symbol.lower_bound(addr);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user