From ea36da8271c508fe4c8bcc80af20ec81c812b95a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 18 Apr 2020 10:33:03 +0200 Subject: sys/linux: use PROT_EXEC for the data section mmap Turns out the mmap protection get out of sync between executor and C reproducers. C reproducers missed PROT_EXEC. Add PROT_EXEC for linux, freebsd and akaros. --- sys/targets/common.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/targets') diff --git a/sys/targets/common.go b/sys/targets/common.go index a5a4838c2..72c485f81 100644 --- a/sys/targets/common.go +++ b/sys/targets/common.go @@ -8,9 +8,12 @@ import ( ) // MakePosixMmap creates a "normal" posix mmap call that maps [addr, addr+size) range. -func MakePosixMmap(target *prog.Target) func(addr, size uint64) *prog.Call { +func MakePosixMmap(target *prog.Target, exec bool) func(addr, size uint64) *prog.Call { meta := target.SyscallMap["mmap"] prot := target.GetConst("PROT_READ") | target.GetConst("PROT_WRITE") + if exec { + prot |= target.GetConst("PROT_EXEC") + } flags := target.GetConst("MAP_ANONYMOUS") | target.GetConst("MAP_PRIVATE") | target.GetConst("MAP_FIXED") const invalidFD = ^uint64(0) return func(addr, size uint64) *prog.Call { -- cgit mrf-deployment