github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/strace/mmap.go (about) 1 // Copyright 2021 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package strace 16 17 import ( 18 "github.com/SagerNet/gvisor/pkg/abi" 19 "github.com/SagerNet/gvisor/pkg/abi/linux" 20 ) 21 22 // ProtectionFlagSet represents the protection to mmap(2). 23 var ProtectionFlagSet = abi.FlagSet{ 24 { 25 Flag: linux.PROT_READ, 26 Name: "PROT_READ", 27 }, 28 { 29 Flag: linux.PROT_WRITE, 30 Name: "PROT_WRITE", 31 }, 32 { 33 Flag: linux.PROT_EXEC, 34 Name: "PROT_EXEC", 35 }, 36 } 37 38 // MmapFlagSet is the set of mmap(2) flags. 39 var MmapFlagSet = abi.FlagSet{ 40 { 41 Flag: linux.MAP_SHARED, 42 Name: "MAP_SHARED", 43 }, 44 { 45 Flag: linux.MAP_PRIVATE, 46 Name: "MAP_PRIVATE", 47 }, 48 { 49 Flag: linux.MAP_FIXED, 50 Name: "MAP_FIXED", 51 }, 52 { 53 Flag: linux.MAP_ANONYMOUS, 54 Name: "MAP_ANONYMOUS", 55 }, 56 { 57 Flag: linux.MAP_GROWSDOWN, 58 Name: "MAP_GROWSDOWN", 59 }, 60 { 61 Flag: linux.MAP_DENYWRITE, 62 Name: "MAP_DENYWRITE", 63 }, 64 { 65 Flag: linux.MAP_EXECUTABLE, 66 Name: "MAP_EXECUTABLE", 67 }, 68 { 69 Flag: linux.MAP_LOCKED, 70 Name: "MAP_LOCKED", 71 }, 72 { 73 Flag: linux.MAP_NORESERVE, 74 Name: "MAP_NORESERVE", 75 }, 76 { 77 Flag: linux.MAP_POPULATE, 78 Name: "MAP_POPULATE", 79 }, 80 { 81 Flag: linux.MAP_NONBLOCK, 82 Name: "MAP_NONBLOCK", 83 }, 84 { 85 Flag: linux.MAP_STACK, 86 Name: "MAP_STACK", 87 }, 88 { 89 Flag: linux.MAP_HUGETLB, 90 Name: "MAP_HUGETLB", 91 }, 92 }