DynamoRIO / DynamoRIO/dynamorio

SYS_execveat is not handled

Open
#2,426 0 comments 0 reactions 0 assignees View on GitHub
OpSys-Linux
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 18h
Merged PRs (30d)
30

Description

The system call "execveat" was added to Linux in kernel 3.19. It needs to be handled in a similar way to "execve".

If you run the program below under a debug build of DynamoRIO you can see how the program escapes from DynamoRIO in the "execveat" case, though not in the "execve" case.

```
$ gcc -Wall -O2 exec.c
$ bin64/drrun -- ./a.out execve
... We see "" twice.
$ bin64/drrun -- ./a.out execveat
... We see " just once.
```

```
#define _GNU_SOURCE
#include // AT_FDCWD
#include
#include
#include
#include
#include

int main(int argc, char *argv[])
{
char *const argv2[] = { "a.out", "reexec", 0 };
char *const envp2[] = { 0 };

if (argc != 2)
exit(1);
if (!strcmp(argv[1], "execve")) {
syscall(SYS_execve, "a.out", argv2, envp2);
printf("Failed execve\n");
}
if (!strcmp(argv[1], "execveat")) {
syscall(SYS_execveat, AT_FDCWD, "a.out", argv2, envp2, AT_SYMLINK_NOFOLLOW);
printf("Failed execveat\n");
}
if (!strcmp(argv[1], "reexec")) {
printf("Reexecuted\n");
}
return 0;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.