-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Fix Linux Landlock feature test in Autotools and CMake builds.
The previous Linux Landlock feature test assumed that having the linux/landlock.h header file was enough. The new feature tests also requires that prctl() and the required Landlock system calls are supported.
- Loading branch information
Showing
5 changed files
with
54 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -901,10 +901,29 @@ endif() | |
|
||
# Sandboxing: Landlock | ||
if(NOT SANDBOX_FOUND AND ENABLE_SANDBOX MATCHES "^ON$|^landlock$") | ||
check_include_file(linux/landlock.h HAVE_LINUX_LANDLOCK_H) | ||
# A compile check is done here because some systems have | ||
# linux/landlock.h, but do not have the syscalls defined | ||
# in order to actually use Linux Landlock. | ||
check_c_source_compiles(" | ||
#include <linux/landlock.h> | ||
#include <sys/syscall.h> | ||
#include <sys/prctl.h> | ||
. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rany2
|
||
void my_sandbox(void) | ||
{ | ||
(void)prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); | ||
(void)SYS_landlock_create_ruleset; | ||
(void)SYS_landlock_restrict_self; | ||
(void)LANDLOCK_CREATE_RULESET_VERSION; | ||
return; | ||
} | ||
int main(void) { return 0; } | ||
" | ||
HAVE_LINUX_LANDLOCK) | ||
|
||
if(HAVE_LINUX_LANDLOCK_H) | ||
set(SANDBOX_COMPILE_DEFINITION "HAVE_LINUX_LANDLOCK_H") | ||
if(HAVE_LINUX_LANDLOCK) | ||
set(SANDBOX_COMPILE_DEFINITION "HAVE_LINUX_LANDLOCK") | ||
set(SANDBOX_FOUND ON) | ||
|
||
# Of our three sandbox methods, only Landlock is incompatible | ||
|
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 little dot is just pure evil.