mediaex: apply seccomp filter

We can safely reduce the number of accessible system calls from ~250
down to ~30.

This commit adds a seccomp filter for arm/arm64 devices. Mediaextractor
runs as a 32 bit process so the same filter is used for both arm and
arm64 devices. The filter is arranged by frequency of the systemcall to
provide the best performance.

Most system calls are whitelisted without argument inspection. The
exception is the socket syscall where the first argument is checked to
ensure only domain=AF_LOCAL sockets are allowed - used for logging.

Vendor additions may be appended to the default filter by creating
mediaextractor-seccomp.policy file and pointing BOARD_SECCOMP_POLICY
to the directory where it resides. For example:

create: device/<oem>/<target>/seccomp/mediaextractor-seccomp.policy

with the necessary syscalls. set:
BOARD_SECCOMP_POLICY=device/<oem>/<target>/seccomp
in the device's BoardConfig.mk

Change-Id: I384a43beaa18f10081c15320a795d9d9d0180de4
diff --git a/services/mediaextractor/Android.mk b/services/mediaextractor/Android.mk
index e08f45e..a9a984a 100644
--- a/services/mediaextractor/Android.mk
+++ b/services/mediaextractor/Android.mk
@@ -11,12 +11,15 @@
 
 # service executable
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := main_extractorservice.cpp
-LOCAL_SHARED_LIBRARIES := libmedia libmediaextractorservice libbinder libutils liblog libicuuc
+ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm arm64))
+LOCAL_ADDITIONAL_DEPENDENCIES += mediaextractor-seccomp.policy
+endif
+LOCAL_SRC_FILES := main_extractorservice.cpp minijail/minijail.cpp
+LOCAL_SHARED_LIBRARIES := libmedia libmediaextractorservice libbinder libutils liblog libicuuc libminijail
 LOCAL_STATIC_LIBRARIES := libicuandroid_utils
 LOCAL_MODULE:= mediaextractor
 LOCAL_32_BIT_ONLY := true
 LOCAL_INIT_RC := mediaextractor.rc
 include $(BUILD_EXECUTABLE)
 
-
+include $(call all-makefiles-under, $(LOCAL_PATH))