diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-04-18 10:33:03 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-04-18 10:33:03 +0200 |
| commit | ea36da8271c508fe4c8bcc80af20ec81c812b95a (patch) | |
| tree | b1593c0e5c734593e4b55d0be5f597441f94e075 /sys/targets | |
| parent | 435c6d538899a51dde5bbc2472cd4e7ecb2ef270 (diff) | |
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.
Diffstat (limited to 'sys/targets')
| -rw-r--r-- | sys/targets/common.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 { |
