executor: fix some bugs found by clang

This commit is contained in:
Dmitry Vyukov 2015-12-31 17:52:26 +01:00
parent 96e9dbd874
commit 33950d306a
2 changed files with 5 additions and 2 deletions

View File

@ -14,7 +14,7 @@ fuzzer:
go build -o ./bin/syz-fuzzer github.com/google/syzkaller/syz-fuzzer
executor:
gcc -o ./bin/syz-executor executor/executor.cc -lpthread -static -Wall -O1 -g
$(CC) -o ./bin/syz-executor executor/executor.cc -lpthread -static -Wall -O1 -g $(CFLAGS)
execprog:
go build -o ./bin/syz-execprog github.com/google/syzkaller/tools/syz-execprog

View File

@ -36,7 +36,6 @@ const int kInFd = 3;
const int kOutFd = 4;
const int kInPipeFd = 5;
const int kOutPipeFd = 6;
const int kCoverFd = 5;
const int kMaxInput = 2 << 20;
const int kMaxOutput = 16 << 20;
const int kMaxArgs = 9;
@ -498,12 +497,14 @@ void execute_call(thread_t* th)
else {
th->res = -1;
}
break;
}
case __NR_syz_dri_open: {
// syz_dri_open(card_id intptr, flags flags[open_flags]) fd[dri]
char buf[128];
sprintf(buf, "/dev/dri/card%lu", th->args[0]);
th->res = open(buf, th->args[1], 0);
break;
}
case __NR_syz_fuse_mount: {
// syz_fuse_mount(target filename, mode flags[fuse_mode], uid uid, gid gid, maxread intptr, flags flags[mount_flags]) fd[fuse]
@ -528,6 +529,7 @@ void execute_call(thread_t* th)
// Ignore errors, maybe fuzzer can do something useful with fd alone.
}
th->res = fd;
break;
}
case __NR_syz_fuseblk_mount: {
// syz_fuseblk_mount(target filename, blkdev filename, mode flags[fuse_mode], uid uid, gid gid, maxread intptr, blksize intptr, flags flags[mount_flags]) fd[fuse]
@ -558,6 +560,7 @@ void execute_call(thread_t* th)
}
}
th->res = fd;
break;
}
}
th->reserrno = errno;