From 7fb694ef82d4dace30cf68efba5a6af705c94fa4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Mar 2020 09:01:48 +0100 Subject: [PATCH] prog: sort enabled syscalls for determinism Makes tests deterministic and syz-mutate with -seed flag. Pointed out by Jordan Frank (@jwf). --- prog/prio.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prog/prio.go b/prog/prio.go index 0e81528e..b67bbaea 100644 --- a/prog/prio.go +++ b/prog/prio.go @@ -221,6 +221,9 @@ func (target *Target) BuildChoiceTable(prios [][]float32, enabled map[*Syscall]b if len(enabledCalls) == 0 { panic(fmt.Sprintf("empty enabledCalls, len(target.Syscalls)=%v", len(target.Syscalls))) } + sort.Slice(enabledCalls, func(i, j int) bool { + return enabledCalls[i].ID < enabledCalls[j].ID + }) run := make([][]int, len(target.Syscalls)) for i := range run { if !enabled[target.Syscalls[i]] {