forked from jiixyj/epoll-shim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Safely interpose fcntl() on architectures with bounded variadic argum…
…ents `fcntl()` abuses C variadic arguments to implement optional parameters. We want to forward this argument to the real `fcntl()` call, but doing so is non-portable. On most architectures, we can just read an `intptr_t`/`void*` and this will give us a (semi-)valid result even if no argument/an int was passed instead since `va_arg()` will generally read the next argument register or arbitrary data from the stack. On CHERI-enabled architectures, variadic arguments are tightly bounded, which means that reading a `void*` if an `int` was passed will result in a runtime trap. To avoid this problem this commit uses a new `vfcntl` libc function (CTSRD-CHERI/cheribsd#2194), that takes a va_list instead of variadic arguments. Since this needs a new HAVE_VCNTL compile-time check, this adds a new config.h header that also includes the HAVE_TIMERFD value. This removes the need to pass -D flags on the command line. This reduces the number of test failures on CheriBSD Morello from 210 to 8.
- Loading branch information
1 parent
6dce79a
commit dbf8124
Showing
7 changed files
with
69 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#cmakedefine01 HAVE_TIMERFD | ||
#cmakedefine01 HAVE_VFCNTL | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters