@@ -196,6 +196,7 @@ func stubInit() {
196
196
stubSysmsgStart = mapLen
197
197
stubSysmsgLen := len (sysmsg .SighandlerBlob )
198
198
mapLen , _ = hostarch .PageRoundUp (mapLen + uintptr (stubSysmsgLen ))
199
+ stubExecMapEnd := mapLen
199
200
200
201
stubSysmsgRules = mapLen
201
202
stubSysmsgRulesLen = hostarch .PageSize * 2
@@ -279,6 +280,7 @@ func stubInit() {
279
280
stubSysmsgStart += stubStart
280
281
stubSysmsgStack += stubStart
281
282
stubROMapEnd += stubStart
283
+ stubExecMapEnd += stubStart
282
284
stubContextQueueRegion += stubStart
283
285
stubSpinningThreadQueueAddr += stubStart
284
286
stubContextRegion += stubStart
@@ -319,10 +321,24 @@ func stubInit() {
319
321
if errno := hostsyscall .RawSyscallErrno (
320
322
unix .SYS_MPROTECT ,
321
323
stubStart ,
322
- stubROMapEnd - stubStart ,
324
+ stubExecMapEnd - stubStart ,
323
325
unix .PROT_EXEC | unix .PROT_READ ); errno != 0 {
324
326
panic ("mprotect failed: " + errno .Error ())
325
327
}
328
+ if errno := hostsyscall .RawSyscallErrno (
329
+ unix .SYS_MPROTECT ,
330
+ stubExecMapEnd ,
331
+ stubROMapEnd - stubExecMapEnd ,
332
+ unix .PROT_READ ); errno != 0 {
333
+ panic ("mprotect failed: " + errno .Error ())
334
+ }
335
+ if errno := hostsyscall .RawSyscallErrno (
336
+ unix .SYS_MSEAL ,
337
+ stubStart ,
338
+ stubROMapEnd - stubStart ,
339
+ 0 ); errno != 0 && errno != unix .ENOSYS {
340
+ panic ("mseal failed: " + errno .Error ())
341
+ }
326
342
327
343
// Set the end.
328
344
stubEnd = stubStart + mapLen + uintptr (gap )
0 commit comments