Skip to content
Permalink
Browse files

executor: move syz_execute_func after os imports. (#1107)

This commit moves the definition of the `syz_execute_func` after the
block of code that imports all the OS specific common headers.

This is required because after commit
dfd3394 `syz_execute_func` started
using the `NONFAILING` macro, which is defined in those header files for
each OS.

I also ran `make generate`.

TEST=I only tested that the executor works for Fuchsia with:

```shell
$ make executor TARGETOS=fuchsia TARGETARCH=amd64 SOURCEDIR=~/fuchsia
```
  • Loading branch information...
mvanotti authored and flowerhack committed Apr 3, 2019
1 parent 8658c25 commit 6a475fffec57cc3b1e51794c0ebed7d169f12349
Showing with 30 additions and 30 deletions.
  1. +16 −16 executor/common.h
  2. +14 −14 pkg/csource/generated.go
@@ -379,6 +379,22 @@ static uint16 csum_inet_digest(struct csum_inet* csum)
}
#endif

#if GOOS_akaros
#include "common_akaros.h"
#elif GOOS_freebsd || GOOS_netbsd || GOOS_openbsd
#include "common_bsd.h"
#elif GOOS_fuchsia
#include "common_fuchsia.h"
#elif GOOS_linux
#include "common_linux.h"
#elif GOOS_test
#include "common_test.h"
#elif GOOS_windows
#include "common_windows.h"
#else
#error "unknown OS"
#endif

#if SYZ_EXECUTOR || __NR_syz_execute_func
// syz_execute_func(text ptr[in, text[taget]])
static long syz_execute_func(volatile long text)
@@ -400,22 +416,6 @@ static long syz_execute_func(volatile long text)
}
#endif

#if GOOS_akaros
#include "common_akaros.h"
#elif GOOS_freebsd || GOOS_netbsd || GOOS_openbsd
#include "common_bsd.h"
#elif GOOS_fuchsia
#include "common_fuchsia.h"
#elif GOOS_linux
#include "common_linux.h"
#elif GOOS_test
#include "common_test.h"
#elif GOOS_windows
#include "common_windows.h"
#else
#error "unknown OS"
#endif

#if SYZ_THREADED
struct thread_t {
int created, call;
@@ -361,20 +361,6 @@ static uint16 csum_inet_digest(struct csum_inet* csum)
}
#endif
#if SYZ_EXECUTOR || __NR_syz_execute_func
static long syz_execute_func(volatile long text)
{
volatile long p[8] = {0};
(void)p;
#if GOARCH_amd64
asm volatile("" ::"r"(0l), "r"(1l), "r"(2l), "r"(3l), "r"(4l), "r"(5l), "r"(6l),
"r"(7l), "r"(8l), "r"(9l), "r"(10l), "r"(11l), "r"(12l), "r"(13l));
#endif
NONFAILING(((void (*)(void))(text))());
return 0;
}
#endif
#if GOOS_akaros
#include <ros/syscall.h>
@@ -4547,6 +4533,20 @@ static int do_sandbox_none(void)
#error "unknown OS"
#endif
#if SYZ_EXECUTOR || __NR_syz_execute_func
static long syz_execute_func(volatile long text)
{
volatile long p[8] = {0};
(void)p;
#if GOARCH_amd64
asm volatile("" ::"r"(0l), "r"(1l), "r"(2l), "r"(3l), "r"(4l), "r"(5l), "r"(6l),
"r"(7l), "r"(8l), "r"(9l), "r"(10l), "r"(11l), "r"(12l), "r"(13l));
#endif
NONFAILING(((void (*)(void))(text))());
return 0;
}
#endif
#if SYZ_THREADED
struct thread_t {
int created, call;

0 comments on commit 6a475ff

Please sign in to comment.
You can’t perform that action at this time.