aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-12-23 19:58:15 +0100
committerDmitry Vyukov <dvyukov@google.com>2015-12-23 19:58:15 +0100
commit58509c75a2a2d472855da0683c36d7ef2f1a6c97 (patch)
tree01a5a400dc703bac7b8003aa2344ba36b24beb96 /executor/executor.cc
parent078517990325cd52828f3ba2d74ced12fc412db8 (diff)
prog: remove padding checking
So far it has found only false positives. Let's leave this to KMSAN.
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc56
1 files changed, 2 insertions, 54 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index 9cdeb7ab8..4b1b38968 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -47,8 +47,6 @@ const int kCoverSize = 16 << 10;
const uint64_t instr_eof = -1;
const uint64_t instr_copyin = -2;
const uint64_t instr_copyout = -3;
-const uint64_t instr_set_pad = -4;
-const uint64_t instr_check_pad = -5;
const uint64_t arg_const = 0;
const uint64_t arg_result = 1;
@@ -314,17 +312,6 @@ retry:
// The copyout will happen when/if the call completes.
continue;
}
- if (call_num == instr_set_pad) {
- char* addr = (char*)read_input(&input_pos); // addr
- uint64_t size = read_input(&input_pos); // size
- memset(addr, 0, size);
- continue;
- }
- if (call_num == instr_check_pad) {
- read_input(&input_pos); // addr
- read_input(&input_pos); // size
- continue;
- }
// Normal syscall.
if (call_num >= sizeof(syscalls) / sizeof(syscalls[0]))
@@ -443,7 +430,6 @@ void handle_completion(thread_t* th)
if (th->ready || !th->done || th->handled)
fail("bad thread state in completion: ready=%d done=%d handled=%d",
th->ready, th->done, th->handled);
- uint64_t* copyout_pos = th->copyout_pos;
if (th->res != (uint64_t)-1) {
results[th->call_n].executed = true;
results[th->call_n].val = th->res;
@@ -460,12 +446,6 @@ void handle_completion(thread_t* th)
debug("copyout from %p\n", addr);
break;
}
- case instr_check_pad: {
- // Ignore for now, we will process them below.
- read_input(&th->copyout_pos);
- read_input(&th->copyout_pos);
- break;
- }
default:
done = true;
break;
@@ -473,39 +453,6 @@ void handle_completion(thread_t* th)
}
}
if (!collide) {
- th->copyout_pos = copyout_pos;
- for (bool done = false; !done;) {
- uint64_t call_num = read_input(&th->copyout_pos);
- switch (call_num) {
- case instr_copyout: {
- // Ignore, this is already handled above.
- read_input(&th->copyout_pos);
- read_input(&th->copyout_pos);
- break;
- }
- case instr_check_pad: {
- // Check that kernel returns zeros in struct padding.
- // Non-zeros can mean an information leak.
- char* addr = (char*)read_input(&th->copyout_pos);
- uint64_t size = read_input(&th->copyout_pos);
- for (uint64_t i = 0; i < size; i++) {
- if (addr[i] != 0) {
- printf("syscall '%s' (index %d): non-zero padding output at %p:",
- syscalls[th->call_num].name, th->call_index, addr);
- for (i = 0; i < size; i++)
- printf(" %02x", addr[i]);
- printf("\n");
- error("non-zero padding");
- }
- }
- break;
- }
- default:
- done = true;
- break;
- }
- }
-
write_output(th->call_index);
write_output(th->call_num);
write_output(th->res != (uint64_t)-1 ? 0 : th->reserrno);
@@ -842,12 +789,13 @@ void error(const char* msg, ...)
// just exit (e.g. due to temporal ENOMEM error)
void exitf(const char* msg, ...)
{
+ int e = errno;
fflush(stdout);
va_list args;
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
- fprintf(stderr, "\n");
+ fprintf(stderr, " (errno %d)\n", e);
exit(1);
}