From df5ae5f537c164da6feb31c645aa607d0c017ba5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 16 Jul 2018 17:01:29 +0200 Subject: sys/akaros: don't call provision(-1) It causes kernel debug splat, which has high chances of corrupting kernel crashes. --- sys/akaros/init.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sys') diff --git a/sys/akaros/init.go b/sys/akaros/init.go index 58d0d1f5f..c3b9e521a 100644 --- a/sys/akaros/init.go +++ b/sys/akaros/init.go @@ -13,6 +13,25 @@ func init() { prog.RegisterTarget(gen.Target_amd64, initTarget) } +type arch struct { + unix *targets.UnixSanitizer +} + func initTarget(target *prog.Target) { + arch := &arch{ + unix: targets.MakeUnixSanitizer(target), + } target.MakeMmap = targets.MakePosixMmap(target) + target.SanitizeCall = arch.sanitizeCall +} + +func (arch *arch) sanitizeCall(c *prog.Call) { + arch.unix.SanitizeCall(c) + switch c.Meta.CallName { + case "provision": + if pid, ok := c.Args[0].(*prog.ConstArg); ok && uint32(pid.Val) == ^uint32(0) { + // pid -1 causes some debugging splat on console. + pid.Val = 0 + } + } } -- cgit mrf-deployment