Merge "init: add support for global seccomp boot option" am: 9f1980e2fc

am: 5a79972238

Change-Id: Ide7500d4ff4d9eebf2fea1d81ff77044a6d63c57
This commit is contained in:
Steve Muckle 2017-07-25 20:30:30 +00:00 committed by android-build-merger
commit eb7db75c28
2 changed files with 14 additions and 0 deletions

View file

@ -77,6 +77,7 @@ LOCAL_STATIC_LIBRARIES := \
libcutils \
libbase \
libc \
libseccomp_policy \
libselinux \
liblog \
libcrypto_utils \

View file

@ -23,6 +23,7 @@
#include <inttypes.h>
#include <libgen.h>
#include <paths.h>
#include <seccomp_policy.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
@ -554,6 +555,15 @@ static int queue_property_triggers_action(const std::vector<std::string>& args)
return 0;
}
static void global_seccomp() {
import_kernel_cmdline(false, [](const std::string& key, const std::string& value, bool in_qemu) {
if (key == "androidboot.seccomp" && value == "global" && !set_global_seccomp_filter()) {
LOG(ERROR) << "Failed to globally enable seccomp!";
panic();
}
});
}
static void selinux_init_all_handles(void)
{
sehandle = selinux_android_file_context_handle();
@ -1035,6 +1045,9 @@ int main(int argc, char** argv) {
SetInitAvbVersionInRecovery();
// Enable seccomp if global boot option was passed (otherwise it is enabled in zygote).
global_seccomp();
// Set up SELinux, loading the SELinux policy.
selinux_initialize(true);