From d646e21ff436cd2a40b23314436cd53f21ae9500 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 5 Jan 2020 12:44:49 +0100 Subject: prog: fix tests for string enforcement String value enforcement broke a number of tests where we use different values. Be more string as to what string values we use in tests. Required to add tmpfs descriptions to test syz_mount_image. Also special-casing AF_ALG algorithms as these are auto-generated. --- sys/linux/init.go | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'sys/linux/init.go') diff --git a/sys/linux/init.go b/sys/linux/init.go index aea6a6957..cf54ffcd0 100644 --- a/sys/linux/init.go +++ b/sys/linux/init.go @@ -4,7 +4,6 @@ package linux import ( - "bytes" "runtime" "github.com/google/syzkaller/prog" @@ -215,8 +214,6 @@ func (arch *arch) sanitizeCall(c *prog.Call) { default: family.Val = ^uint64(0) } - case "syz_open_procfs": - arch.sanitizeSyzOpenProcfs(c) case "syz_open_dev": enforceIntArg(c.Args[0]) enforceIntArg(c.Args[1]) @@ -279,26 +276,6 @@ func (arch *arch) sanitizeIoctl(c *prog.Call) { } } -func (arch *arch) sanitizeSyzOpenProcfs(c *prog.Call) { - // If fuzzer manages to open /proc/self/exe, it does some nasty things with it: - // - mark as non-executable - // - set some extended acl's that prevent execution - // - mark as immutable, etc - // As the result we fail to start executor again and recreate the VM. - // Don't let it open /proc/self/exe. - ptr := c.Args[1].(*prog.PointerArg) - if ptr.Res != nil { - arg := ptr.Res.(*prog.DataArg) - file := arg.Data() - for len(file) != 0 && (file[0] == '/' || file[0] == '.') { - file = file[1:] - } - if bytes.HasPrefix(file, []byte("exe")) { - arg.SetData([]byte("net\x00")) - } - } -} - func (arch *arch) generateTimespec(g *prog.Gen, typ0 prog.Type, old prog.Arg) (arg prog.Arg, calls []*prog.Call) { typ := typ0.(*prog.StructType) // We need to generate timespec/timeval that are either -- cgit mrf-deployment