@@ -48,6 +48,7 @@ struct ksigaction
4848 sigset_t sa_mask;
4949};
5050#define SA_RESTORER 0x04000000
51+ #define E9_BACKDOOR 0xe9e9e9e9
5152
5253typedef void (*e9handler_t )(int , siginfo_t *, void *);
5354struct e9scratch_s
@@ -163,7 +164,7 @@ static NO_INLINE struct e9scratch_s *e9scratch(const e9_config_s *config,
163164 if (!alloc)
164165 return (struct e9scratch_s *)scratch;
165166 intptr_t r = e9mmap (scratch, PAGE_SIZE, PROT_READ | PROT_WRITE,
166- MAP_PRIVATE | MAP_ANONYMOUS, -1 , 0 );
167+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED , -1 , 0 );
167168 r = (r >= 0 && r != (intptr_t )scratch? -EAGAIN: r);
168169 if (r < 0 )
169170 e9panic (" mmap() scratch failed (errno=%u)" , (unsigned )-r);
@@ -250,7 +251,7 @@ void e9handler(int sig, siginfo_t *info, ucontext_t *ctx,
250251 {
251252 (void *)SIG_DFL, SA_NODEFER | SA_RESTORER, NULL , 0
252253 };
253- e9syscall (SYS_rt_sigaction, SIGILL, &action, NULL , 8 , 0xe9e9e9e9 );
254+ e9syscall (SYS_rt_sigaction, SIGILL, &action, NULL , 8 , E9_BACKDOOR );
254255 trampoline = (uint8_t *)mctx->gregs [REG_RIP];
255256 }
256257 void *xstate = (void *)mctx->fpregs ;
@@ -301,7 +302,7 @@ static void e9filter(struct e9scratch_s *scratch)
301302 BPF_STMT (BPF_LD | BPF_W | BPF_ABS,
302303 offsetof (struct seccomp_data , args[4 ])),
303304 // Backdoor: TODO: think of a better solution
304- BPF_JUMP (BPF_JMP | BPF_JEQ | BPF_K, 0xe9e9e9e9 , 3 , 0 ),
305+ BPF_JUMP (BPF_JMP | BPF_JEQ | BPF_K, E9_BACKDOOR , 3 , 0 ),
305306 BPF_STMT (BPF_LD | BPF_W | BPF_ABS,
306307 offsetof (struct seccomp_data , args[0 ])),
307308 BPF_JUMP (BPF_JMP | BPF_JEQ | BPF_K, SIGILL, 0 , 1 ),
@@ -416,7 +417,8 @@ void *e9init(int argc, char **argv, char **envp, const e9_config_s *config)
416417 (void *)handler, SA_NODEFER | SA_SIGINFO | SA_RESTORER,
417418 NULL , 0x0
418419 };
419- intptr_t r = e9syscall (SYS_rt_sigaction, SIGILL, &action, &old, 8 );
420+ intptr_t r = e9syscall (SYS_rt_sigaction, SIGILL, &action, &old, 8 ,
421+ E9_BACKDOOR);
420422 if (r < 0 )
421423 e9panic (" sigaction() failed (errno=%u)" , -r);
422424 scratch =
0 commit comments