platform_system_core/libcutils
Nick Kralevich f4fc922f0b Set bin directories to 0751
Currently, /system/bin, /system/xbin, /product/bin, and /vendor/bin
are 0755, which allows any process to iterate through those
directories and list out the contents. For the vast majority of
processes, this is unnecessary. They only need to know whether a
particular binary exists or doesn't exist, but they don't need to
know the other binaries within those directories.

Allowing this is particularly problematic for SELinux. In particular,
some third party Android applications try to examine every file in
the bin directories, generating SELinux audit noise along the
way. This audit noise makes it harder to see real bugs, and falsely
implies an architectural dependency between the application and random
files in directories like /system/bin.

This change removes the ability to list the contents of the various bin
directories, preventing random probing by such apps. The ability to
execute files, or to probe a specific file by name, remain unchanged.

Addresses SELinux denials similar to the following:
  avc: denied { getattr } for comm="Thread-11" path="/system/bin/atrace" dev="dm-0" ino=189 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:atrace_exec:s0 tclass=file permissive=0 app=uk.co.santander.santanderUK
  avc: denied { getattr } for comm="Binder:26637_2" path="/system/bin/atrace" dev="dm-0" ino=168 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:atrace_exec:s0 tclass=file permissive=0 app=com.tencent.mm
  avc: denied { getattr } for comm="Thread-12" path="/system/bin/apexd" dev="dm-0" ino=451 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:apexd_exec:s0 tclass=file permissive=1 app=com.grppl.android.shell.CMBlloydsTSB73

Shell access to these directories continues to be allowed, to allow for
host-side CTS tests.

Also adjust the indentation of some clang directives, to make the
presubmit hooks happy.

Test: Device boots and no apparent problems.
Change-Id: Ibe75682fac1983d39f3f479a5850ab5a96f6627d
2018-11-11 11:29:10 -08:00
..
arch-arm Switch arch-arm/memset32.S to unified syntax. 2015-05-11 22:22:13 -07:00
arch-arm64
arch-mips android_memset.c: Use sanitized shifts 2015-08-27 14:32:17 -07:00
arch-x86 Clean up memset[16,32] routines: unify files names, remove redundant wrapper 2014-09-17 18:11:18 +04:00
arch-x86_64 Clean up memset[16,32] routines: unify files names, remove redundant wrapper 2014-09-17 18:11:18 +04:00
include [GPU Service] Add independent AID for gpu service. 2018-11-06 12:52:01 -08:00
include_vndk/cutils libcutils: remove unused open_memstream. 2018-07-11 14:28:21 -07:00
tests libcutils test: make set_sched_policy optional 2018-08-28 13:26:04 -07:00
Android.bp cutils: move hashmap to <pthread.h>. 2018-07-13 10:54:49 -07:00
android_get_control_env.h libcutils: move cutils/files.h to cutils/android_get_control_file.h 2016-11-16 15:56:56 -08:00
android_get_control_file.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
android_reboot.cpp Stop defining local "unused" macros now this is C++. 2017-11-30 16:24:36 -08:00
ashmem-dev.cpp libcutils: ashmem: Avoid doing fd checks for ashmem calls 2018-07-17 17:02:44 -07:00
ashmem-host.cpp Remove more bogus <stdbool.h> #includes from C++. 2018-05-08 13:00:06 -07:00
canned_fs_config.cpp Remove more bogus <stdbool.h> #includes from C++. 2018-05-08 13:00:06 -07:00
config_utils.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
fs.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
fs_config.cpp Set bin directories to 0751 2018-11-11 11:29:10 -08:00
hashmap.cpp cutils: move hashmap to <pthread.h>. 2018-07-13 10:54:49 -07:00
iosched_policy.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
klog.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
load_file.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
MODULE_LICENSE_APACHE2
multiuser.cpp Better, consistent definition of AID_SHARED_GID. 2017-11-13 16:49:26 -07:00
native_handle.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
NOTICE
OWNERS libcutils: add OWNERS. 2018-06-12 13:58:30 -07:00
partition_utils.cpp fs_mgr: fix incorrect parameter type 2018-10-09 10:49:44 -07:00
properties.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
qtaguid.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
record_stream.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
sched_policy.cpp Rewrite get_sched_policy_name for safety. 2018-04-25 14:55:48 -07:00
socket_inaddr_any_server_unix.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
socket_inaddr_any_server_windows.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
socket_local_client_unix.cpp Stop defining local "unused" macros now this is C++. 2017-11-30 16:24:36 -08:00
socket_local_server_unix.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
socket_local_unix.h libcutils: share Windows networking code. 2016-01-15 15:57:35 -08:00
socket_network_client_unix.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
socket_network_client_windows.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
sockets.cpp libcutils: move cutils/files.h to cutils/android_get_control_file.h 2016-11-16 15:56:56 -08:00
sockets_unix.cpp libcutils: lose socket_peer_is_trusted to ART, the only user. 2018-10-25 13:24:08 -07:00
sockets_windows.cpp Fix / suppress new unused warnings for mingw+clang 2017-11-29 21:37:28 -08:00
str_parms.cpp libcutils: remove some unused API. 2018-07-11 14:27:32 -07:00
strdup8to16.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
strdup16to8.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
strlcpy.c Fix Windows strlcpy.c build. 2015-04-02 17:21:47 -07:00
threads.cpp Fix / suppress new unused warnings for mingw+clang 2017-11-29 21:37:28 -08:00
trace-container.cpp Move libcutils source to C++. 2017-11-10 13:18:10 -08:00
trace-dev.cpp Revert "Don't initialize atrace if it's already disabled." 2018-02-08 00:49:37 +00:00
trace-dev.inc Remove more bogus <stdbool.h> #includes from C++. 2018-05-08 13:00:06 -07:00
trace-host.cpp Stop defining local "unused" macros now this is C++. 2017-11-30 16:24:36 -08:00
uevent.cpp libcutils: Stop checking the uid of netlink messages 2018-01-08 13:24:32 -08:00