From 0d10349cf0b4a9f98490378709bd9a83bd0042d6 Mon Sep 17 00:00:00 2001 From: Marco Vanotti Date: Tue, 16 Jul 2019 17:09:43 -0700 Subject: [PATCH] sys/fuchsia: update zx_clock_get syscall (#1292) * sys/fuchsia: update zx_clock_get. zx_clock_get was deprecated and replaced by zx_clock_get_new. In a recent CL[0], they replaced the zx_clock_get by zx_clock_get_new and moved all client. This commit updates syzkaller to use the new function. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/298575 * run make extract && make generate --- executor/common_fuchsia.h | 3 ++- executor/defs.h | 4 ++-- executor/syscalls.h | 2 -- pkg/csource/generated.go | 3 ++- sys/fuchsia/gen/amd64.go | 7 ++----- sys/fuchsia/gen/arm64.go | 7 ++----- sys/fuchsia/time.txt | 3 +-- 7 files changed, 11 insertions(+), 18 deletions(-) diff --git a/executor/common_fuchsia.h b/executor/common_fuchsia.h index 72b57801..5099100d 100644 --- a/executor/common_fuchsia.h +++ b/executor/common_fuchsia.h @@ -223,6 +223,7 @@ static long syz_job_default(void) static long syz_future_time(volatile long when) { zx_time_t delta_ms; + zx_time_t now; switch (when) { case 0: delta_ms = 5; @@ -234,7 +235,7 @@ static long syz_future_time(volatile long when) delta_ms = 10000; break; } - zx_time_t now = zx_clock_get(ZX_CLOCK_MONOTONIC); + zx_clock_get(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } #endif diff --git a/executor/defs.h b/executor/defs.h index 14511974..42683a00 100644 --- a/executor/defs.h +++ b/executor/defs.h @@ -45,7 +45,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "10ad2411f1db75aaa4971061b5f008e17d8dd923" +#define SYZ_REVISION "0831ecb34bc4bfd3c444366782fdbd3fafe56026" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -55,7 +55,7 @@ #if GOARCH_arm64 #define GOARCH "arm64" -#define SYZ_REVISION "8513a6093b2306314106c924eee6cb5263d85436" +#define SYZ_REVISION "b643855d1cb7438abcacb87d29a4dfdd49961397" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 diff --git a/executor/syscalls.h b/executor/syscalls.h index a8236cb8..35145562 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -1537,7 +1537,6 @@ const call_t syscalls[] = { {"zx_channel_write$fuchsia_timezone_TimezoneWatcherOnTimezoneOffsetChange", 0, (syscall_t)zx_channel_write}, {"zx_clock_get", 0, (syscall_t)zx_clock_get}, {"zx_clock_get_monotonic", 0, (syscall_t)zx_clock_get_monotonic}, - {"zx_clock_get_new", 0, (syscall_t)zx_clock_get_new}, {"zx_cprng_add_entropy", 0, (syscall_t)zx_cprng_add_entropy}, {"zx_cprng_draw", 0, (syscall_t)zx_cprng_draw}, {"zx_deadline_after", 0, (syscall_t)zx_deadline_after}, @@ -1958,7 +1957,6 @@ const call_t syscalls[] = { {"zx_channel_write$fuchsia_timezone_TimezoneWatcherOnTimezoneOffsetChange", 0, (syscall_t)zx_channel_write}, {"zx_clock_get", 0, (syscall_t)zx_clock_get}, {"zx_clock_get_monotonic", 0, (syscall_t)zx_clock_get_monotonic}, - {"zx_clock_get_new", 0, (syscall_t)zx_clock_get_new}, {"zx_cprng_add_entropy", 0, (syscall_t)zx_cprng_add_entropy}, {"zx_cprng_draw", 0, (syscall_t)zx_cprng_draw}, {"zx_deadline_after", 0, (syscall_t)zx_deadline_after}, diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 3224ff69..1dc6bf4c 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -981,6 +981,7 @@ static long syz_job_default(void) static long syz_future_time(volatile long when) { zx_time_t delta_ms; + zx_time_t now; switch (when) { case 0: delta_ms = 5; @@ -992,7 +993,7 @@ static long syz_future_time(volatile long when) delta_ms = 10000; break; } - zx_time_t now = zx_clock_get(ZX_CLOCK_MONOTONIC); + zx_clock_get(ZX_CLOCK_MONOTONIC, &now); return now + delta_ms * 1000 * 1000; } #endif diff --git a/sys/fuchsia/gen/amd64.go b/sys/fuchsia/gen/amd64.go index 3e1c518a..c9d3b8b5 100644 --- a/sys/fuchsia/gen/amd64.go +++ b/sys/fuchsia/gen/amd64.go @@ -6944,12 +6944,9 @@ var syscalls_amd64 = []*Syscall{ }}, {Name: "zx_clock_get", CallName: "zx_clock_get", Args: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}, BitMask: true}, - }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, - {Name: "zx_clock_get_monotonic", CallName: "zx_clock_get_monotonic"}, - {Name: "zx_clock_get_new", CallName: "zx_clock_get_new", Args: []Type{ - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "clock_id", TypeSize: 4}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "zx_time", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", TypeSize: 8, ArgDir: 1}}}}, }}, + {Name: "zx_clock_get_monotonic", CallName: "zx_clock_get_monotonic"}, {Name: "zx_cprng_add_entropy", CallName: "zx_cprng_add_entropy", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "buffer", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Path: []string{"buffer"}}, @@ -7797,4 +7794,4 @@ var consts_amd64 = []ConstValue{ {Name: "fuchsia_power_Status_OK"}, } -const revision_amd64 = "10ad2411f1db75aaa4971061b5f008e17d8dd923" +const revision_amd64 = "0831ecb34bc4bfd3c444366782fdbd3fafe56026" diff --git a/sys/fuchsia/gen/arm64.go b/sys/fuchsia/gen/arm64.go index a8593726..33e7c9ca 100644 --- a/sys/fuchsia/gen/arm64.go +++ b/sys/fuchsia/gen/arm64.go @@ -6944,12 +6944,9 @@ var syscalls_arm64 = []*Syscall{ }}, {Name: "zx_clock_get", CallName: "zx_clock_get", Args: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "clock_id", FldName: "clock_id", TypeSize: 8}}, Vals: []uint64{0, 1, 2}, BitMask: true}, - }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "zx_time", FldName: "ret", TypeSize: 8, ArgDir: 1}}}, - {Name: "zx_clock_get_monotonic", CallName: "zx_clock_get_monotonic"}, - {Name: "zx_clock_get_new", CallName: "zx_clock_get_new", Args: []Type{ - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "clock_id", TypeSize: 4}}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "zx_time", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", TypeSize: 8, ArgDir: 1}}}}, }}, + {Name: "zx_clock_get_monotonic", CallName: "zx_clock_get_monotonic"}, {Name: "zx_cprng_add_entropy", CallName: "zx_cprng_add_entropy", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "buffer", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Path: []string{"buffer"}}, @@ -7797,4 +7794,4 @@ var consts_arm64 = []ConstValue{ {Name: "fuchsia_power_Status_OK"}, } -const revision_arm64 = "8513a6093b2306314106c924eee6cb5263d85436" +const revision_arm64 = "b643855d1cb7438abcacb87d29a4dfdd49961397" diff --git a/sys/fuchsia/time.txt b/sys/fuchsia/time.txt index a94ed0b2..d0372c71 100644 --- a/sys/fuchsia/time.txt +++ b/sys/fuchsia/time.txt @@ -6,8 +6,7 @@ include resource zx_time[int64]: 0, ZX_TIME_INFINITE zx_nanosleep(deadline zx_time) -zx_clock_get(clock_id flags[clock_id]) zx_time -zx_clock_get_new(clock_id int32, zx_time ptr[out, intptr]) +zx_clock_get(clock_id flags[clock_id], zx_time ptr[out, intptr]) zx_clock_get_monotonic() zx_ticks_get() zx_ticks_per_second()