Commit graph

50 commits

Author SHA1 Message Date
Nick Kralevich
53842f8a90 relax /system/bin directory permissions
In commit f4fc922f0b, we tightened the
permissions on various bin directories. Please see
https://android-review.googlesource.com/c/platform/system/core/+/822955
for details.

This change causes the Chase banking app to crash. This is because
the Chase app is using inotify_add_watch() on the /system/bin directory
and not checking the return value.

The Android Security model guarantees the immutability of files in
/system/bin, so the inotify watch is unnecessary.

Until the Chase app fixes their bug, we need to relax the permissions on
the /system/bin directory. Conceptually, this is a partial revert of
f4fc922f0b.

Bug: 119605322
Test: compiles
Change-Id: Ic72dd24cb27cff677093963bdfd0ae09bf132e08
2018-12-13 10:56:33 -08:00
Mark Salyzyn
757658c78d fs_config: add product and product_services to the scanning.
Test: compile
Bug: 119310326
Change-Id: I67ba155e4a03731d402cdfcf06ca80ad0c4ab2ed
2018-12-06 22:14:14 +00:00
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
Dario Freni
ab5583b585 s/product-services/product_services/g
Attempting to reduce the number of different spellings we have for
"product services" partition in the codebase.

Bug: 112431447
Test: m
Change-Id: I1a87d7e040a8b1f91f973ac7d90d6360b5b54f71
Merged-In: I1a87d7e040a8b1f91f973ac7d90d6360b5b54f71
2018-08-20 17:46:42 +00:00
Dario Freni
4fa866a467 Add support for /product-services partition.
This CL is largely and adaptation of
Ie996def20e25dc1afe0c74af2096af844934b2dc

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.
Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80
2018-07-23 16:14:36 +01:00
Luis Hector Chavez
bfe1835d82 Merge "bootstat: Remove the CAP_SYSLOG capability"
am: cefd4e56ad

Change-Id: I0a0627228434d0284b4f535942c97121d9773e14
2018-06-12 15:00:42 -07:00
Luis Hector Chavez
3276b57542 Merge "logd: Move the capabilities from file based to ambient"
am: 28cd2a02b1

Change-Id: Iaef160d039cf995f8dae104f122208660cc27985
2018-06-12 14:59:57 -07:00
Luis Hector Chavez
0becca32bc bootstat: Remove the CAP_SYSLOG capability
This change removes the CAP_SYSLOG file based capability from bootstat,
since the intention is that it should not be accessing the logs in the
long term. In order to avoid bitrot, the fallback code that depends on
CAP_SYSLOG has also been removed.

Bug: 62845925
Test: system/core/bootstat/boot_reason_test.sh
Change-Id: I899be44ef3ac1c4d81072f801d55c928ae09bb15
2018-06-11 12:41:24 -07:00
Luis Hector Chavez
d32c36c961 logd: Move the capabilities from file based to ambient
This change moves logd's capabilities from being file based to being set
by init through ambient capabilities.

Bug: 62845925
Test: sailfish:/ # grep Cap /proc/`pidof logd`/status
      CapInh: 0000000000000000
      CapPrm: 0000000440000000
      CapEff: 0000000440000000
      CapBnd: 0000000440000040
      CapAmb: 0000000000000000
      $ capsh --decode=0x440000040
      0x440000040=cap_setgid,cap_audit_control,cap_syslog
Test: liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Change-Id: I28c7c4ad37ad5eafd399aef78c303ce31298a9ef
2018-06-11 10:04:11 -07:00
Inseob Kim
cf5e8f1575 Merge "Support /product/bin" am: 36b61f061d
am: 931e0f268a

Change-Id: If507c7206c6e1c43e0fe5a6af411250b7879e2e3
2018-05-31 20:09:45 -07:00
Inseob Kim
25195daaca Support /product/bin
Bug: 80422611
Test: m -j succeeded and permissions of files under /product/bin are set
correctly

Change-Id: I83377d809c47c92da6b226d2853ea6a7462fb127
2018-06-01 08:33:04 +09:00
Gwendal Grignou
8526413941 allow config/sdcardfs directory to be seen for ARC++
Normally, the whole configfs is mounted on /config and /config will be
word readable:

sailfish:/ $ ls -ld /config/*
drwxrwx--- 258 system package_info 0 2018-05-08 16:08 /config/sdcardfs
sailfish:/ $ ls -ld /config/
drwxr-xr-x 3 root root 0 1969-12-31 16:00 /config/

On ARC++, we only mount-bind config/sdcardfs, so it is important that
/config is set properly.

It is actually 0500, so system could not see /config/sdcardfs, even if
/config/sdcardfs is set properly:
Although root can, as system uid, we can not reach /config/sdcardfs:
:/ $ ls -ld /config
dr-x------ 3 root root 31 2018-05-02 21:56 /config
:/ $ ls -ld /config/sdcardfs
ls: /config/sdcardfs: Permission denied

With this change, system (and systemservice) is able to reach
/config/sdcardfs:
:/ $ ls -ld /config
dr-xr-xr-x 3 root root 31 2018-05-02 21:56 /config
:/ $ ls -ld /config/sdcardfs
drwxrwx--- 109 system package_info 0 2018-05-08 15:29 /config/sdcardfs

Bug: 63876697
Test: After change, package service is able to create the bindings in
/config/sdcardfs.

Change-Id: I7e9b99d7af2ad001fbb1b95bee35d494e861be78
Signed-off-by: Gwendal Grignou <gwendal@google.com>
2018-05-08 16:18:48 -07:00
Tom Cherry
07aa2a6131 Remove vendor Wifi and BT entries from fs_config.cpp
Their capability bits are now specified in their associated init .rc
file, which is the proper place for this to be done.

A notice is added to guide developers away from using android_files to
give services Linux capabilities and to guide them away from adding
vendor/ entries.

Bug: 74554159
Test: BT, Wifi, Tethering work on walleye
Merged-In: I13c425d022b4f5c217587cdf601884ef44650ac7
Change-Id: I13c425d022b4f5c217587cdf601884ef44650ac7
(cherry picked from commit b5e5c56401)
2018-04-05 10:40:49 -07:00
Tom Cherry
b5e5c56401 Remove vendor Wifi and BT entries from fs_config.cpp
Their capability bits are now specified in their associated init .rc
file, which is the proper place for this to be done.

A notice is added to guide developers away from using android_files to
give services Linux capabilities and to guide them away from adding
vendor/ entries.

Bug: 74554159
Test: BT, Wifi, Tethering work on walleye
Change-Id: I13c425d022b4f5c217587cdf601884ef44650ac7
2018-03-29 14:10:12 -07:00
Treehugger Robot
61896fc0ee Merge "Enabled SYS_MODULE capability for wifi@1.0-service" 2018-03-29 20:57:42 +00:00
Ajit Kumar
b0fc2d743b Enabled SYS_MODULE capability for wifi@1.0-service
Add sys_module capability to enabled insmod operation.

Merged-In: I6436c3297e5318bd00ae3582549a11cb82ccbafd
Change-Id: I6436c3297e5318bd00ae3582549a11cb82ccbafd
(cherry picked from commit c2a059fbf0)
2018-03-29 19:34:06 +00:00
Tom Cherry
666464a180 Revert "fs_config: Move hostapd to /vendor/bin/hw"
This reverts commit 656b75c77c.

Capability bits are moving from fs_config.cpp to the associated init
scripts for daemons on /vendor.

Bug: 74554159
Test: wifi tethering works on walleye
2018-03-28 18:29:02 +00:00
Robert Sesek
f29ce0ff7c Merge "Remove fs_config entries for webview_zygote." am: 47354e76eb am: 19fafd1ae9
am: b13b9e0d55

Change-Id: I970fb49989763bde055922f8f6c59e89450a83ee
2018-02-23 17:55:05 +00:00
Robert Sesek
84e8a3811f Remove fs_config entries for webview_zygote.
This process is now spawned from the main app_process zygote, rather
than being its own binary launched by init.

Bug: 63749735
Test: m
Change-Id: I87e00197e1ce64d77b4c306fcd702c6ad778b236
2018-02-14 17:42:03 -05:00
Ajit Kumar
c2a059fbf0 Enabled SYS_MODULE capability for wifi@1.0-service
Add sys_module capability to enabled insmod operation.

Change-Id: I6436c3297e5318bd00ae3582549a11cb82ccbafd
2018-02-12 18:31:47 +00:00
Jaekyun Seok
207a211804 Merge "Support /product partition" am: 8f324542a2 am: 10e1ec7de3
am: 83ffef2cb1

Change-Id: Ia1933bbede3db2489151e5ab8ead574582b87f7a
2018-01-25 04:17:36 +00:00
Jaekyun Seok
dff165d3a2 Support /product partition
This CL will enable reading /product/build.prop and add product paths
into ld.config.txt.in.

Bug: 64195575
Test: tested with 'PRODUCT_PRODUCT_PROPERTIES := ro.product.abc=abc' on
sailfish

Change-Id: Ie996def20e25dc1afe0c74af2096af844934b2dc
2018-01-25 09:37:20 +09:00
Roshan Pius
656b75c77c fs_config: Move hostapd to /vendor/bin/hw
Bug: 36646171
Test: Able to turn on softap
Change-Id: Ibd82581a12b4bd2e7d22825361706e35f292ce2b
2018-01-16 12:38:04 -08:00
Elliott Hughes
8e9aeb9053 Move libcutils source to C++.
Just the minimial changes to get this to actually build, because otherwise
we always bog down trying to rewrite everything (when the real answer
is usually "stop using libcutils, it's awful").

This doesn't move a handful of files: two are basically just BSD libc
source, a couple have outstanding code reviews, and one can be deleted
(but I'll do that in a separate change).

I'm also skipping the presubmit hooks because otherwise clang-format
wants to reformat everything. I'll follow up with that...

Bug: N/A
Test: builds
Change-Id: I06403f465b67c8e493bad466dd76b1151eed5993
2017-11-10 13:18:10 -08:00
Elliott Hughes
bb5ec4a926 resolve merge conflicts of 796987482 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ica884c137c5f21e261600b2b011ab963036c0cdb
2017-10-17 12:36:14 -07:00
Treehugger Robot
796987482f Merge "<stdbool.h> not necessary in C++." 2017-10-17 19:26:53 +00:00
Elliott Hughes
a0f73f9bff <stdbool.h> not necessary in C++.
Bug: N/A
Test: builds
Change-Id: I1f32b202e353414e74ace87a7d5b495b5deb5f99
Merged-In: I1f32b202e353414e74ace87a7d5b495b5deb5f99
2017-10-17 16:21:33 +00:00
Bowgo Tsai
d29ac08509 Merge "Removing $(PRODUCT_OUT)/root/root"
am: 8cbbacdc15

Change-Id: Ia671976f8d7d4b83478c58d566e309f36af125ab
2017-09-29 03:27:38 +00:00
Bowgo Tsai
144893e5ec Removing $(PRODUCT_OUT)/root/root
Bug: 65570851
Test: boot sailfish
Change-Id: I80c3c3de23c57343187fde207980731b5341bc1f
Merged-In: I80c3c3de23c57343187fde207980731b5341bc1f
(cherry picked from commit ededee3e40)
2017-09-28 18:10:58 +08:00
Mark Salyzyn
6818f80dbb Merge changes from topic "b/63736262"
am: 1f666a6be9

Change-Id: I2586aac3d6fe8252ee6728de64fb37102accf0da
2017-09-13 22:45:52 +00:00
Mark Salyzyn
b304f6d4e7 bootstat: introduce sys.boot.reason
Adding functionality to bootstat --record_boot_complete and
--record_boot_reason to initialize sys.boot.reason, the canonical
system boot reason.

Filter out ro.boot.bootreason oem noise into sys.boot.reason.  Add
heuristics to determine what the boot reason is, when otherwise would
be defaulting to the blunt and relatively devoid of detail catch-all
reboot reasons ("reboot", "shutdown", "cold", "warm", "hard").

boot_reason_test.sh is also a compliance test.

Test: boot_reason_test.sh all
Bug: 63736262
Change-Id: Ic9a42cccbcfc89a5c0e081ba66d577a97c8c8c76
2017-09-12 09:28:25 -07:00
Hung-ying Tyan
42388236a4 Merge "Load default prop from /system/etc/prop.default" into oc-dr1-dev
am: d334d69b70

Change-Id: I358c9b60bf20d7852d81006bb37a9efab0dd19ad
2017-06-28 06:31:08 +00:00
Ben Fennema
cd3584e90b Merge "libcutils: fs_config: fix "system/<partition>/" aliasing"
am: 449bfd7a93

Change-Id: I9f3d0f0e4dc147d9d2a5a1e41486805ada29d62a
2017-06-26 22:49:41 +00:00
Ben Fennema
acd7b7b0c0 libcutils: fs_config: fix "system/<partition>/" aliasing
Pull prefix checking into fs_config_cmp and make prefix_cmp be a
glorified partial ? strncmp() : strcmp()

Results before:
[ RUN      ] fs_config.system_alias

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: vendor/lib/hw didn't match system/vendor/lib

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/vendor/bin/wifi didn't match vendor/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/odm/bin/wifi didn't match odm/bin/wifi

[ ERROR ] system/core/libcutils/tests/fs_config.cpp:143:: system/oem/bin/wifi didn't match oem/bin/wifi
system/core/libcutils/tests/fs_config.cpp:247: Failure
Value of: check_fs_config_cmp(fs_config_cmp_tests)
  Actual: true
Expected: false
[  FAILED  ] fs_config.system_alias (6 ms)

Results after:
[ RUN      ] fs_config.system_alias
[       OK ] fs_config.system_alias (0 ms)

Bug: 62204623
Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Change-Id: I8282827002816e86ea3014fed29eabf43b837815
Signed-off-by: Ben Fennema <fennema@google.com>
2017-06-26 14:13:52 -07:00
Hung-ying Tyan
527d80d945 Load default prop from /system/etc/prop.default
/default.prop is moved to /system/etc/prop.default for full Treblized
devices. Modifies property_service to load it from there first.
In recovery mode, the file is renamed as /prop.default. This path is
tried if /system/etc/prop.default is not available.

Bug: 37815285
Test: Tested with ag/2419001. Booted pixel phones, checked the location
      of prop.default, verified the symlink at /default.prop, checked a
      few properties via adb shell and manually tested a few apps.
      Booted to recovery and ran 'adb sideload' successfully.
Change-Id: I485231f21fc86b0aec58edf867e229a31e77d85e
2017-06-16 22:46:15 +08:00
Elliott Hughes
3e9223f460 Merge "Revert "Load {default,build}.prop from /{system,vendor,odm}/etc/"" am: f9259b59e8 am: b2f12e42ca
am: 22cdddecba

Change-Id: I6e41d84c76a0d1f31e54d5422638817905f202f4
2017-05-25 18:18:40 +00:00
Hung-ying Tyan
3346338919 Revert "Load {default,build}.prop from /{system,vendor,odm}/etc/"
This reverts commit 723f1a2b31.

Bug: 62075509
2017-05-25 19:18:17 +08:00
Hung-ying Tyan
a22e004f57 Merge "Load {default,build}.prop from /{system,vendor,odm}/etc/" am: a9aa77d259 am: 26c4bcfadd
am: 0cd0d52147

Change-Id: Ide638286886cef323e8bb049f5baf4bbe659c47a
2017-05-25 02:46:10 +00:00
Hung-ying Tyan
723f1a2b31 Load {default,build}.prop from /{system,vendor,odm}/etc/
/default.prop may be moved to /system/etc/ and renamed as prop.default.
/{system,vendor,odm}/build.prop may be moved to /{system,vendor,odm}/etc/
and renamed as prop.build.
This patch makes property_service load prop.* from the new locations
first. Also replaces NULL with nullptr for C++ cleanup.

Bug: 37815285
Test: Booted pixel phones, checked the locations of prop.*, verified
      symlinks, checked a few properties (via adb shell getprop)
      and manually tested a few apps (Camera, Maps etc).
      ODM is not tested as it does not exist on the tested device.
Change-Id: Id8eeb3c1a5728dd04005dfad4733b8e6336f9093
2017-05-25 08:41:08 +08:00
Mark Salyzyn
940a9a08e5 libcutils: fs_config: remove aliases
Covered by the code automatically now. Dropping duplicate wifi.

Test: gTest libcutils_test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: I86e29192e321e1e449d2c30161af69c34b8baa16
2017-05-19 13:30:08 -07:00
Mark Salyzyn
88c04aae1e libcutils: fs_config: remove aliases
Covered by the code automatically now.

Test: gTest libcutils_test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Iad6ba65e023845aaea7a181b277a7383c44bd937
2017-05-19 18:16:23 +00:00
Mark Salyzyn
de439332ba Merge "Revert "Partial revert of "libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate" Revert just the wifi hardware part."" into oc-dev
am: 6a93fd7e7c

Change-Id: Ifc81c5a2b17176711138c34b1a82ac945e7186a6
2017-05-19 18:12:30 +00:00
Mark Salyzyn
645d62facb Merge changes Iad6ba65e,Ia6a7e8c9,Ida9405cb am: 037d2b71dc am: 219e7200be
am: 7c466b936a

Change-Id: I9da0e906b391b9e4846c534eda77fb33d96e191a
2017-05-19 14:35:34 +00:00
Mark Salyzyn
2cf243528f libcutils: fs_config: remove aliases
Covered by the code automatically now.

Test: gTest libcutils_test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Iad6ba65e023845aaea7a181b277a7383c44bd937
2017-05-18 15:56:54 -07:00
Mark Salyzyn
2d37797b68 libcutils: fs_config: alias "system/<partition>/" to "<partition>/"
For the known partitions entrenched in the build system: vendor, oem
and odm only. We will alias entries that reference system/<partition>
and <partition>/ so that if either are specified, the rule will apply
to both possible paths.

Test: gTest libcutils-tests
Bug: 37703469
Change-Id: Ida9405cbed323489a3d0599c1645e9be2c7b9d08
2017-05-18 15:54:31 -07:00
Mark Salyzyn
e9e599751b Merge "libcutils: fs_config internal table alias test" am: 8fad110bfa am: bfead93a3a
am: 4bc080ab1a

Change-Id: Iddf608a4082d9442f48355291abd15e2aef6a18d
2017-05-04 21:25:25 +00:00
Mark Salyzyn
0f6a270d24 libcutils: fs_config internal table alias test
Private interface to permit testing only added to fs_config to
expose android_files and android_dirs.

Make sure that both paths to a partition are specified in fs_config
internal tables.

Test: gTest libcutils-unit-test --gtest_filter=fs_config.*
Bug: 37703469
Change-Id: Ida5fccdb786dc6d67325005d4fdd1fa1ffaef396
2017-05-04 11:41:17 -07:00
Daniel Cardenas
21fff17ed6 Partial revert of "libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate" Revert just the wifi hardware part.
am: 6db432daf7

Change-Id: I7796ffcf07d6478ead19c5bab171a9ff4ce4f758
2017-05-03 19:42:52 +00:00
Mark Salyzyn
5cad367060 Merge "libcutils: convert fs_config.cpp" am: c50245e43e am: a255ab0cb0
am: 5f82055a2e

Change-Id: I93bdac8212b6d913c0851d4ef1145a1943a76e3b
2017-05-03 16:57:09 +00:00
Mark Salyzyn
163ecc68c7 libcutils: convert fs_config.cpp
C++ify fs_config.c

Test: gTest libcutils-test
Bug: 37703469
Change-Id: Id48ae22f203ed923942257575296c69b32345ae6
2017-05-03 08:04:35 -07:00
Renamed from libcutils/fs_config.c (Browse further)