From 21d737fbf9bad3f2a9190bc31212f29edbfcaeb3 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 28 Sep 2022 13:17:51 +0000 Subject: sys: control structural changes during neutralization Ideally, we should properly support the already existing fix flag to distinguish between fixing and checking, but for now at least let it control whether structural changes are to be made. Otherwise we get into trouble while hint-mutating syz_mount_image calls, because we iterate over all call arguments and (possibly) remove them at the same time. It leads to `bad group arg size %v, should be <= %v for %#v type %#v` errors. --- sys/targets/common.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/targets') diff --git a/sys/targets/common.go b/sys/targets/common.go index f55493256..a29365ce3 100644 --- a/sys/targets/common.go +++ b/sys/targets/common.go @@ -82,12 +82,12 @@ func MakeUnixNeutralizer(target *prog.Target) *UnixNeutralizer { } } -func (arch *UnixNeutralizer) Neutralize(c *prog.Call) { +func (arch *UnixNeutralizer) Neutralize(c *prog.Call, fixStructure bool) error { switch c.Meta.CallName { case "mmap": if c.Meta.Name == "mmap$bifrost" { // Mali bifrost mmap doesn't support MAP_FIXED. - return + return nil } // Add MAP_FIXED flag, otherwise it produces non-deterministic results. c.Args[3].(*prog.ConstArg).Val |= arch.MAP_FIXED @@ -98,7 +98,7 @@ func (arch *UnixNeutralizer) Neutralize(c *prog.Call) { } switch c.Args[pos+1].Type().(type) { case *prog.ProcType, *prog.ResourceType: - return + return nil } mode := c.Args[pos].(*prog.ConstArg) dev := c.Args[pos+1].(*prog.ConstArg) @@ -128,4 +128,5 @@ func (arch *UnixNeutralizer) Neutralize(c *prog.Call) { code.Val = 1 } } + return nil } -- cgit mrf-deployment