Commit graph

1494 commits

Author SHA1 Message Date
Automerger Merge Worker
89d31aadb3 Merge "Add project ID constants." am: 529605bc9e am: df4f865d7a am: 3781fb4a9a
Change-Id: I61572b4fcfcd57af9fb29dfd37c67a2b956d820e
2020-02-19 22:20:44 +00:00
Martijn Coenen
529605bc9e Merge "Add project ID constants." 2020-02-19 05:23:20 +00:00
Martijn Coenen
1cc2f9d77f Add project ID constants.
These will be used for quota tracking on external storage devices
that don't have sdcardfs.

Bug: 146419093
Test: N/A
Change-Id: If00961cc3807bcc3e93675e5d27dd6444007fdba
2020-02-18 17:19:09 -08:00
Treehugger Robot
15c0b798bd Merge "bootstat: enhance last reboot reason property with file backing" am: 7550e6f882 am: ffd276388f am: c0210f1d0e
Change-Id: I6d953d6b9308dc46619e52f81cb5469b22df55d0
2020-02-17 10:12:25 +00:00
Mark Salyzyn
ee016ce0b3 bootstat: enhance last reboot reason property with file backing
Helps with support of recovery and rollback boot reason history, by
also using /metadata/bootstat/persist.sys.boot.reason to file the
reboot reason.

Test: manual
Bug: 129007837
Change-Id: Id1d21c404067414847bef14a0c43f70cafe1a3e2
2020-02-14 13:24:16 -08:00
Automerger Merge Worker
ed830505b2 Merge "[vts-core] fix the test error of KernelLibcutilsTest." am: 3d6154ffe9 am: 14e0b48b59 am: 7ef1507434
Change-Id: I90840a20974875b13b3546ae162f5bd5dca13ecd
2020-02-11 22:13:46 +00:00
Treehugger Robot
3d6154ffe9 Merge "[vts-core] fix the test error of KernelLibcutilsTest." 2020-02-11 21:15:57 +00:00
Automerger Merge Worker
afe3a288e1 Merge "Add correct permissions to benchmarktest directories" am: 8c2d4d6146 am: cfce9d6ad9 am: 8008cc405b
Change-Id: Ic505c73fcbd294928aaa33da39b91051ae1e7225
2020-02-10 21:24:15 +00:00
Automerger Merge Worker
a16facc231 Merge "trace-container: Check /sys/kernel/tracing for tracefs" am: 1ac1d86b7d am: 0b9ed14c89 am: cb22a67a84
Change-Id: I1ecc90f8ea32703a52a0e32bd9ea7b6a57eb6647
2020-02-10 17:21:52 +00:00
Akos Denke
bb61a6e79d Add correct permissions to benchmarktest directories
Change-Id: I487d59317635b54f623002baf3c00aa47910a33a
2020-02-10 12:11:54 -05:00
Hridya Valsaraju
5cdb5d4619 trace-container: Check /sys/kernel/tracing for tracefs
tracefs will be mounted at /sys/kernel/tracing when debugfs
is not mounted.

Bug: 134669095
Test: atest AtraceHostTest
Change-Id: I8178babaa6928ac3796622bdb08f123428ccd191
2020-02-07 11:08:21 -08:00
nelsonli
1d53f839cc [vts-core] fix the test error of KernelLibcutilsTest.
Correct the test name of the Test.config.

Bug: 148629781
Test: atest KernelLibcutilsTest
Change-Id: I0307e4ddc89c016f00c6075d0549818d5b3b9382
2020-02-07 10:07:09 +08:00
Automerger Merge Worker
d17586e9d9 Merge "Add AID_EXT_DATA_RW / AID_EXT_OBB_RW GIDs." am: e6acbfe556 am: e9b7b464bd am: 2d5970ffc2
Change-Id: I8ffa385724b0b49b3f5b329187ba1a75edb5ba87
2020-02-03 10:42:41 +00:00
Treehugger Robot
e6acbfe556 Merge "Add AID_EXT_DATA_RW / AID_EXT_OBB_RW GIDs." 2020-02-03 10:14:33 +00:00
Automerger Merge Worker
200fdd3138 Merge "Check /sys/kernel/tracing for tracefs" am: a6c834f960 am: 73a3552047 am: cd5ee4246f
Change-Id: I3fe8e36a890791342aff0630bf694ec9ed1f2092
2020-02-01 07:26:01 +00:00
Martijn Coenen
4501ed5c2e Add AID_EXT_DATA_RW / AID_EXT_OBB_RW GIDs.
These will be used as a GID for the Android/data and Android/obb
directories respectively, on devices that don't have sdcardfs.

Bug: 146419093
Test: builds
Change-Id: I52a3235e872eb4b0402f918d5c47661f16626ba6
2020-01-31 15:12:31 +01:00
Hridya Valsaraju
6a879b25d9 Check /sys/kernel/tracing for tracefs
When debugfs is not mounted, atrace should look for
tracefs in /sys/kernel/tracing.

Test: CtsAtraceHostTestCases
Bug: 148436518
Change-Id: I45c0e664892bcda277fd9612106ad5216aea0a1b
2020-01-30 17:38:51 -08:00
Automerger Merge Worker
3d81374fd5 Merge "Add external_storage gid" am: 8e4cf5b436 am: ed326eafc0 am: 92fe152517
Change-Id: If39cab9fa0cbab8d997492c2be9962ea519eaef7
2020-01-27 12:51:13 +00:00
Zimuzo Ezeozue
8e4cf5b436 Merge "Add external_storage gid" 2020-01-27 12:22:16 +00:00
Automerger Merge Worker
fb6adb6ffc Merge changes from topic "ramdisk" am: d66e442c21 am: 49e66cc894 am: 635c64fb58
Change-Id: I9ecbf4ad764d0f96ddc34ccd24ce0fea9836ac04
2020-01-25 01:14:13 +00:00
Zim
bdeaf57da3 Add external_storage gid
This gid allows processes full access to public areas of external
storage. This includes the following:
1. EmulatedVolumes: All files and directories excluding the app
specific directories under Android/
2. PublicVolumes: Including 'unreliable' volumes (USB OTG) that are
not typically accesible to ordinary apps

Apps with the MANAGE_EXTERNAL_STORAGE permission will automatically
have this gid

Test: m
Bug: 144914977
Change-Id: I17da0b2367e356edc031d063e214574463afc985
2020-01-24 16:54:03 +00:00
Yifan Hong
04b932b8fd Add e2fsck to fs_config
Test: boot and look at serial console
Bug: 147347110
Change-Id: Ife664c02fa4cf86d9385caff734d2bb3e56d988f
2020-01-22 16:47:14 -08:00
Automerger Merge Worker
cb6893cc82 Merge "[vts-core] Make VtsKernelLibcutilsTest runnable by base TradeFed" am: 0852b10b37 am: 7315bc9175 am: 2a6c4e3de6
Change-Id: Ic89129bcd6b833a2efa92a96a7cf376823f46b40
2020-01-20 03:01:24 +00:00
Treehugger Robot
0852b10b37 Merge "[vts-core] Make VtsKernelLibcutilsTest runnable by base TradeFed" 2020-01-20 02:32:56 +00:00
Automerger Merge Worker
5c2d51d588 Merge "Add user for credstore." am: 4659cdaf5c am: 66e60c7b77 am: 8e0e2797e6
Change-Id: I86961943c8ffb05878313db09ae8166d9fe59358
2020-01-17 03:44:26 +00:00
nelsonli
d83f390896 [vts-core] Make VtsKernelLibcutilsTest runnable by base TradeFed
Create KernelLibcutilsTest and add it to vts-core.
VtsKernelLibcutilsTest just run the test of libcutils_test_static
and filter-out all of the test except AshmemTest#. We can just use the
include-filter to do the same thing.

Bug: 147789274
Test: atest KernelLibcutilsTest
Change-Id: Idb5cee3596bf063c2419f1a11055a17ad3075e26
2020-01-17 09:48:58 +08:00
David Zeuthen
e83f386653 Add user for credstore.
The credstore system daemon is running as an unprivileged user. This
CL adds this user and also creates a directory (/data/misc/credstore/)
where this daemon can store its data.

Bug: 111446262
Test: N/A
Change-Id: I8da2c32dd04fef797870b8a7bbc5e499bed71f9e
2020-01-16 07:32:04 -05:00
Automerger Merge Worker
3f963835ff Merge "libcutils: fallback to /dev/ashmem" am: 6e016ef80e am: 0714a9eae2 am: 315d44f02c
Change-Id: I334c8988af63a49dab7ace5045b9a792eb0050b2
2020-01-15 20:17:28 +00:00
Treehugger Robot
6e016ef80e Merge "libcutils: fallback to /dev/ashmem" 2020-01-15 19:48:26 +00:00
Steven Moreland
4f99dd3af1 libcutils: fallback to /dev/ashmem
For a Q APEX built with use_vendor, rather than using AIDL to talk to
ashmemd, it would directly open /dev/ashmem. R libcutils does ashmem
differently, but in order to allow R-built APEXes to replace this
category of APEXes, falling back to /dev/ashmem.

Fixes: 147363115
Test: tested on Q in swcodec APEX
Change-Id: I625e46b15fee6649251ab9be7a1bbe11c5427525
2020-01-14 18:19:10 +00:00
Automerger Merge Worker
e7fbe55a98 Merge "Use sequence number to check if to reload atrace tags." am: 445234c76c am: d371ad8665 am: 0549118e91
Change-Id: I364d217f7447b7b4f4cf7c042e9f26844e245d46
2020-01-14 10:10:44 +00:00
Florian Mayer
445234c76c Merge "Use sequence number to check if to reload atrace tags." 2020-01-14 09:37:04 +00:00
Florian Mayer
b06766cbbf Use sequence number to check if to reload atrace tags.
This is to deprecate the sysprop change notification in atrace.
After this change, processes will only update their enabled tags
at the first atrace event. Previously we reloaded the tags as a
result of the sysprop changed Binder notification, which woke up
every process in the system.

Test: adb shell su root atrace -t 10 ss
Test: #define ATRACE_SHMEM 0; adb shell su root atrace -t 10 ss

Bug: 137366208

Change-Id: Idffba5fd4ba23fba2f6b9f594365df68ac0c1626
2020-01-13 17:02:58 +00:00
Automerger Merge Worker
2a71043523 Merge "SurfaceFlinger: migrate capabilities to surfaceflinger.rc" am: 1f3e40e8e7 am: f0b712654a am: 20c23f681f
Change-Id: Ie5494744cacf65157f180ffd62691da5278a8d91
2020-01-08 22:58:57 +00:00
Ady Abraham
21844fa771 SurfaceFlinger: migrate capabilities to surfaceflinger.rc
SurfaceFlinger requires CAP_SYS_NICE which is set in
libcutils/fs_config.cpp. This is the old way of setting capabilities
and new the way is to set it directly on surfaceflnger.rc

Test: adb shell /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test
Test: adb shell stop surfaceflinger && adb shell start surfaceflinger
Bug: 147271477
Change-Id: I680509a385928a9c929d4fe4857118af219e2b13
2020-01-08 19:35:57 +00:00
Automerger Merge Worker
f5bab53f7e Merge "Add system_ext/apex/*/bin to fs_config" am: d4502115ad am: 69aa1e0b2c am: 16fcc9921a
Change-Id: Ie2b8333e9fb79c500049c0ac30c735871161c110
2019-12-20 05:32:49 +00:00
Jooyung Han
08792eb5de Add system_ext/apex/*/bin to fs_config
Flattened APEXes can be installed in /system_ext.
Especially, GSI have both flattened/unflattened apexes so that it can
run with updatable devices and non-updatable devices as well.

Bug: 145963716
Test: flash GSI on P device and boot
Change-Id: I3a941672446a5353517243a851739a66f4252617
2019-12-20 03:54:57 +09:00
Automerger Merge Worker
92911289a6 Merge "Remove warning from VNDK's <cutils/log.h>" am: ab96d9dec1 am: 3e886cea8c
Change-Id: I189e946bd4de85db79ba15e53415d57730f7b5c1
2019-12-04 18:43:52 +00:00
Tom Cherry
2d5cfa9fa6 Remove warning from VNDK's <cutils/log.h>
We're never going to fix this warning and it's not causing any active
issues that vendors are using this header.  It is however causing
active issues that we have extraneous warning messages in the log.

Bug: 123758136
Test: no build warnings from <cutils/log.h>
Change-Id: Iccf702bf2536ba106a00ac04467d54401cbe2a50
2019-12-04 08:33:49 -08:00
Tom Cherry
3bacd417fb Merge "Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors" am: 02359c6d96 am: 777cbf21df
am: 76755f20e7

Change-Id: Id808b8d7e72eec69ce79bb3255c5653292e8fc08
2019-11-13 09:08:20 -08:00
Treehugger Robot
02359c6d96 Merge "Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors" 2019-11-13 16:50:46 +00:00
Elliott Hughes
885c59ec02 Merge "Ignore nullptr in native_handle_close()." am: 2ba8c4b0af am: d36bf30620
am: 87d56a0603

Change-Id: I6c308a5dd9329fa2fd58cbac1ee56841520545ba
2019-11-13 08:29:04 -08:00
Elliott Hughes
2ba8c4b0af Merge "Ignore nullptr in native_handle_close()." 2019-11-13 16:04:22 +00:00
Tom Cherry
edad2bf9b6 Use PLOG and TEMP_FAILURE_RETRY for uevent socket errors
Use TEMP_FAILURE_RETRY() for recvmsg() to prevent failing
unnecessarily from EINTR.  Use PLOG(ERROR) in ueventd to display the
actual error if reading from the uevent socket does fail.

Test: build
Change-Id: I64a22698ce6ffc7573f75b57803551c7b6940e30
2019-11-13 07:21:42 -08:00
Elliott Hughes
7e42484610 Ignore nullptr in native_handle_close().
Just like native_handle_delete().

Bug: http://b/143898343
Test: new test
Change-Id: I373067aa6c2b03548b218c7011bdbf23bd71f260
2019-11-12 20:23:55 -08:00
Elliott Hughes
9a767159c0 Merge "Remove unused android_memset16()/android_memset32()." 2019-11-12 19:10:40 +00:00
Elliott Hughes
7b8fcfea0e Remove unused android_memset16()/android_memset32().
Pixelflinger is gone.

Test: treehugger
Change-Id: I6954ae6a860102be0f6d76f33e76ed3210e5c152
2019-11-08 15:59:30 -08:00
Elliott Hughes
d91984a890 libcutils: remove unused socket_set_receive_timeout().
Test: treehugger
Change-Id: I834762fd83bdaa3b714c7531439bf9115a82e342
2019-11-08 15:21:39 -08:00
Tom Cherry
e41aded12d Add require_root for libcutils tests
7 of these tests require root

Test: these tests pass as root
Change-Id: Ife4d1ae0c8fe8a2ace288c584ac044a37bae0b3e
2019-11-07 14:06:21 -08:00
Treehugger Robot
ad3069eb72 Merge "Turn on executable bit on system_ext/bin" 2019-11-07 15:13:56 +00:00
Jeongik Cha
4e467e71e9 Turn on executable bit on system_ext/bin
Setting executable bit on system_ext/bin is missing, so add them into
list.

Bug: 144066307
Test: m && check if system_ext/bin/* have execute permission.
Change-Id: I89c9e0d2d54f965ecd058bb9e77ba77b7ed164c1
2019-11-07 16:51:49 +09:00
Tom Cherry
f8baa897ec libcutils: update fs_config tests for current behavior
Update fs_config tests for the new behavior in
a8eb00720c.

Before the above CL, fs_config_cmp() would match any partition prefix
to any path, even if there is not a logical relationship between them.
For example, these two lines in the test the demonstrate the changed
behavior:

{ true,  "vendor/lib",             "system/vendor/lib/hw",    true },
{ true,  "system/vendor/lib",      "vendor/lib/hw",           true },

The first line should match and does; it is testing that files located
at system/vendor/lib/hw are matched by an fs_path_config entry
specified as vendor/lib.  This is to allow for applying the policy we
have for the vendor partition to files in /system/vendor in the case
that there is no vendor partition.

The second line should not match.  This is testing that a file
that's located at vendor/lib/hw is matched by an fs_path_config entry
specified as system/vendor/lib.  This is backwards; we do not want to
have policy specified for system/vendor to impact policy for the
vendor partition.

Also, we never have any relationships from /system/oem to /oem or
/system/odm to /odm, so these are logically unrelated and should fail
to match.  We do however have a relationship from /vendor/odm to /odm,
so this test is added.

Test: libcutils unit tests pass on CF
Change-Id: I026f0233e00bbd0aad9bc0fb701aef000d2a037c
2019-11-06 09:40:33 -08:00
Tom Cherry
350164cc7c Revert "liblog: remove mistakenly added symbols from vndk"
This reverts commit 5f8162b086.

Reason for revert: Turns out they're being used.

Merged-In: Iad9010190c7a4140b69dc553df5debdd88dcf81a
Change-Id: Iad9010190c7a4140b69dc553df5debdd88dcf81a
2019-10-23 11:39:13 -07:00
Tom Cherry
7867721e51 liblog: remove mistakenly added symbols from vndk
These functions and headers were all mistakenly added to the vndk.
They should not be used by vendors.

Test: these symbols do not appear in vendor libraries
Merged-In: I03919b437c2d9f0e573b7a6b40249ed12fe874b9
Change-Id: I03919b437c2d9f0e573b7a6b40249ed12fe874b9
2019-10-22 09:47:45 -07:00
Treehugger Robot
ed2d29ea13 Merge "sched_policy: add get_cpuset/sched_policy_profile_name" 2019-10-16 02:44:22 +00:00
Wei Wang
ee2f260223 sched_policy: add get_cpuset/sched_policy_profile_name
Expose API to return name of task profile for cpuset/sched policy so
that libprocessgroup clients using SetTaskProfiles directly don't have
to maintain the mapping. This reduces the risk of inconsistency and saves
memory.

Bug: 139521784
Test: atest libcutils_test:SchedPolicy
Change-Id: I414312a038613913fb6a827bdcefceb3dec21264
2019-10-14 20:03:06 -07:00
Florian Mayer
ad427b74c4 Remove useless goto.
Test: build

Change-Id: Ifb8d832de1115eefbf2e09c6d5c8f03244566933
2019-10-10 18:15:24 +01:00
Bill Peckham
dea8c9c1ac Moving recovery resources from /system to /vendor
This change is part of a topic that moves the recovery resources from the
system partition to the vendor partition, if it exists, or the vendor directory
on the system partition otherwise. The recovery resources are moving from the
system image to the vendor partition so that a single system image may be used
with either an A/B or a non-A/B vendor image. The topic removes a delta in the
system image that prevented such reuse in the past.

The recovery resources that are moving are involved with updating the recovery
partition after an update. In a non-A/B configuration, the system boots from
the recovery partition, updates the other partitions (system, vendor, etc.)
Then, the next time the system boots normally, a script updates the recovery
partition (if necessary). This script, the executables it invokes, and the data
files that it uses were previously on the system partition. The resources that
are moving include the following.

* install-recovery.sh
* applypatch
* recovery-resource.dat (if present)
* recovery-from-boot.p (if present)

This change moves the recovery resources to vendor in libcutils/fs_config.cpp
and removes the flash_recovery service from rootdir/init.rc. This service moved
to a vendor init.rc file in bootable/recovery/applypatch.

Bug: 68319577
Test: Ensure that recovery partition is updated correctly.
Change-Id: I492f7989ea8042912e9d0e0eadeaa351affbee13
2019-10-04 00:04:08 +00:00
Tri Vo
92fd3caff7 libcutils: route to /dev/ashmem<boot_id> instead of ashmemd
Having libcutils ask ashmemd for ashmem fds results in unsatisfactory
performance/memory overhead. Introduce a duplicate of /dev/ashmem and
route to it instead.

Our goal remains as before, namely, use SELinux to phase out usage of
ashmem that doesn't go through libcutils.

Bug: 139855428
Test: boot aosp_crosshatch, browse internet, use camera
Change-Id: I02260a9042acb412571b11f1f4c1d8608483064a
2019-09-25 12:50:16 -07:00
Treehugger Robot
cda0a308eb Merge "Allocate UID for fs-verity ownership in keystore" 2019-09-17 16:08:48 +00:00
Nick Kralevich
6bcd50ed6d system/apex/*/bin should be 0751
Consistent with other bin directories, system/apex/*/bin should
be 0751.

Test: compiles and boots
Change-Id: Ie32e7623d2b2eb923417d0c2ba3ee6899a9bfc7b
2019-09-10 18:54:28 -07:00
Victor Hsieh
5f327d24c3 Allocate UID for fs-verity ownership in keystore
Test: compile and use
Bug: 112038744
Change-Id: Ic129484a0f6f266bb58f8afd722d5d8f7565b922
2019-09-05 16:18:13 -07:00
Xin Li
d0a45dbc9a Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:23 +00:00
Steven Moreland
c0660668e7 libcutils: Implement ashmem_valid on host.
Was missing.

Bug: 124524556
Test: build host code with dependency on this
Change-Id: I0074923e9ec53e42f9479fff47df0a24c8750164
2019-09-05 01:26:19 +00:00
Elliott Hughes
13e64377b3 Merge "Reland "libcutils: remove unused "jstring.h"."
am: a22599df58

Change-Id: I7ea8fa894ed60fc64534a6de312258b75b3bff8e
2019-08-12 11:40:28 -07:00
Elliott Hughes
79198d9ade Reland "libcutils: remove unused "jstring.h".
This reverts commit 09ba34925f.

Bug: http://b/139257138
Test: treehugger
Change-Id: Id9b612c5a79b89ed17d2205219af19788ae96c9e
2019-08-12 15:09:20 +00:00
Mason Wang
1967bf3f07 Merge "Revert "libcutils: remove unused "jstring.h".""
am: 4b8e6b673f

Change-Id: I2ec20c825970beefae2c9b2693506c2d7d3165d5
2019-08-11 22:40:42 -07:00
Mason Wang
09ba34925f Revert "libcutils: remove unused "jstring.h"."
This reverts commit aa96e8898c.

Reason for revert: It caused BB, and b/139257138 is for your reference

Change-Id: I93f1d0ba0fa43325e2815e9b2de84bb7cb41c457
2019-08-12 02:16:58 +00:00
Elliott Hughes
94879d3b9f Merge "libcutils: remove unused "jstring.h"."
am: e2adc14803

Change-Id: I2d779ea267d1177ace3d18290f61b9006d86ce25
2019-08-11 08:51:52 -07:00
Elliott Hughes
aa96e8898c libcutils: remove unused "jstring.h".
Test: treehugger
Change-Id: I56989862a51a6c8785f22f783027d50c42be650c
2019-08-08 17:45:48 -07:00
Elliott Hughes
498163c28a Merge "Remove more dead code."
am: 0c2dab9adf

Change-Id: I52dbcba34d893573b3452c7b084af8840e5c1ec1
2019-08-08 12:40:55 -07:00
Elliott Hughes
1547e4a316 Remove more dead code.
Test: treehugger
Change-Id: I2b7f606241cde2c2743d8021fad00d30f7e0b0de
2019-08-07 14:52:16 -07:00
Tom Cherry
306ca15d79 Merge "Add reserved AID ranges for all partitions"
am: 2a0a0810a1

Change-Id: I639c3ed66293da360318b5979480c1def45f1955
2019-07-15 16:32:41 -07:00
Tom Cherry
2a0a0810a1 Merge "Add reserved AID ranges for all partitions" 2019-07-15 23:19:41 +00:00
Justin Yun
e0b1eb8d65 Merge "Rename product_services to system_ext"
am: 6da50e319c

Change-Id: If9eaecca2382b3ace74ae721e80d51c79bb9b0fb
2019-07-11 00:15:28 -07:00
Tom Cherry
3ceea099f3 Add reserved AID ranges for all partitions
With Treble and Mainline, each partition needs to be able to
independently define its own set of AIDs and therefore needs its own
AID range to not conflict with updates made to other partitions.

This includes the system partition in the case of vendors making
additions to it.  Bionic will always have the hardcoded list of
platform AIDs in its own reserved list.

Bug: 73062966
Test: can load AIDs from partitions other than vendor
Test: bionic-unit-tests

Change-Id: I6509acc555cd28b421b9edaf3f8006bad6c56125
2019-07-10 13:45:53 -07:00
Justin Yun
7eaf9b58ec Rename product_services to system_ext
Update ld.config.txt and init.

Bug: 134359158
Test: make && check boot and ld.config.txt file
Change-Id: Ie1dce42e690414fb45b26759506ea7f64d06740d
2019-07-09 23:34:17 +00:00
Tom Cherry
073c1d442c Merge "Actually make fs_path_config / fs_path_config_from_file private" am: 20670249d0
am: a4754b12c4

Change-Id: Iedd8078ee67055f4b88393de4c9b8f42f8c39fef
2019-06-24 14:37:04 -07:00
Tom Cherry
68debff5ec Actually make fs_path_config / fs_path_config_from_file private
No one outside of libcutils is using these structs and we don't want
to leak them as they are private.

Test: build
Change-Id: I1c95564a9843c9155a333334008cbff7c7ff1f51
2019-06-20 23:34:30 +00:00
Tom Cherry
bc876255f7 Merge "Remove fs_config endianness functions" am: 9b229069fb
am: 2a43e8ffb7

Change-Id: I76dd185d3034387b347119c6136620c3409e7ea6
2019-06-20 15:10:31 -07:00
Tom Cherry
ad13c88ee2 Merge "Remove fs_config_generate()" am: 45f79b1c3b
am: b9ef822307

Change-Id: I2d451687cdfef481ec4c222cbdef584fa0b6bfbd
2019-06-20 15:10:14 -07:00
Tom Cherry
5550d4e90f Remove fs_config endianness functions
We don't support big endian on Android.

Test: build
Change-Id: I4278ecc139b0ffeba63cf7b3a43b1ce9e858e741
2019-06-20 16:35:50 +00:00
Zhijun He
f17089d834 Revert "libprocessgroup users use libcutils"
am: 5360a8492d

Change-Id: I505e0a9aa120531f6190b328a0dc9a9f79eb473a
2019-06-18 22:50:46 -07:00
Zhijun He
5360a8492d Revert "libprocessgroup users use libcutils"
This reverts commit 1ec3b78b67.

Reason for revert: breaks all camera use cases

Bug: 135568875

Exempt-From-Owner-Approval: revert, no build cop

Change-Id: Iec8e1f94f5bedced3f3faf73f851fd2f13e2e768
2019-06-19 05:25:07 +00:00
Steven Moreland
d0b343973c Merge "libprocessgroup users use libcutils" into qt-dev
am: c99582dc51

Change-Id: Ib150bad71b461c71355467ea0f21d5cebc3f7633
2019-06-18 16:48:52 -07:00
Steven Moreland
1ec3b78b67 libprocessgroup users use libcutils
libprocessgroup symbols are being moved into libcutils in order to
optimize linking/memory usage. libprocessgroup will no longer be
required in the future (however removing references to it will come
separately).

Bug: 135145426
Test: boot

Test:
BEFORE:
$ adb shell showmap -a $(pid hwservicemanager) | grep -P "libprocessgroup|libcutils" -A1 | grep -P 'libprocessgroup|libcutils|\.bss' | awk '{s += $9}END{print s}'
28

AFTER:
$ adb shell showmap -a $(pid hwservicemanager) | grep -P "libprocessgroup|libcutils" -A1 | grep -P 'libprocessgroup|libcutils|\.bss' | awk '{s += $9}END{print s}'
12

Change-Id: I10d7c2d2b2b14cbbe0a128b9156d31206419d24c
2019-06-18 22:03:54 +00:00
Tom Cherry
55fe01db69 Remove fs_config_generate()
We replaced creating the binary fs_config files with a python script
(/build/make/tools/fs_config/fs_config_generator.py), so there are no
more users of this function, nor do we plan for there to be.

Test: build
Change-Id: I49ec7e3d22c206bc250cbda6f66a4a59e47030e9
2019-06-17 13:40:31 -07:00
Bowgo Tsai
1d0e2be724 Merge "Moving /odm/build.prop to /odm/etc/buid.prop" into qt-dev
am: b36b54cf79

Change-Id: Iaa42e2c76c794b6c94a69961421834956c04ff65
2019-05-22 21:07:57 -07:00
Bowgo Tsai
3182ea132e Moving /odm/build.prop to /odm/etc/buid.prop
In device root directory, we have the following symlinks:
  - /odm/app -> /vendor/odm/app
  - /odm/bin -> /vendor/odm/bin
  - /odm/etc -> /vendor/odm/etc
  ...

This allows the Generic System Image (GSI) to be used on both devices:
  1) Has a physical odm partition, where those symlink will be hidden
     when /odm is used as the mount point
  2) Has no physical odm partition and fallback to /vendor/odm/.

We can't just have the symlink /odm -> /vendor/odm, because the former
devices won't have /vendor/odm directory, which leads to mount failure
when the mount point /odm is resolved to /vendor/odm.

The existing /vendor/odm/build.prop won't be loaded in the latter
devices, because there is no symlink
    - /odm/build.prop -> /vendor/odm/build.prop.

Note that init blocks reading through direct symlinks (O_NOFOLLOW) so
the above symlink won't work either. This CL moves the odm build.prop
to /odm/etc/build.prop for init to load it (symlinks in earlier
components of the path will still be followed by O_NOFOLLOW).

Bug: 132128501
Test: boot a device and checks /odm/etc/build.prop is loaded
Change-Id: I0733c277baa67c549bb45599abb70aba13fbdbcf
Merged-In: I0733c277baa67c549bb45599abb70aba13fbdbcf
(cherry picked from commit c49655b2a4)
2019-05-22 16:15:44 +08:00
Bowgo Tsai
9fc8dcf517 Moving /odm/build.prop to /odm/etc/buid.prop
In device root directory, we have the following symlinks:
  - /odm/app -> /vendor/odm/app
  - /odm/bin -> /vendor/odm/bin
  - /odm/etc -> /vendor/odm/etc
  ...

This allows the Generic System Image (GSI) to be used on both devices:
  1) Has a physical odm partition, where those symlink will be hidden
     when /odm is used as the mount point
  2) Has no physical odm partition and fallback to /vendor/odm/.

We can't just have the symlink /odm -> /vendor/odm, because the former
devices won't have /vendor/odm directory, which leads to mount failure
when the mount point /odm is resolved to /vendor/odm.

The existing /vendor/odm/build.prop won't be loaded in the latter
devices, because there is no symlink
    - /odm/build.prop -> /vendor/odm/build.prop.

Note that init blocks reading through direct symlinks (O_NOFOLLOW) so
the above symlink won't work either. This CL moves the odm build.prop
to /odm/etc/build.prop for init to load it (symlinks in earlier
components of the path will still be followed by O_NOFOLLOW).

Bug: 132128501
Test: boot a device and checks /odm/etc/build.prop is loaded
Change-Id: I0733c277baa67c549bb45599abb70aba13fbdbcf
Merged-In: I0733c277baa67c549bb45599abb70aba13fbdbcf
2019-05-22 06:03:34 +00:00
dimitry
d2231d0e2d Merge changes I8186718c,I8d6f33e9,I56fe5e11,Ie4004c98,I531d3d60, ... am: b26696e2dd
am: f7e9467a31

Change-Id: Iaf243bead1df42205b8c7b35f6336e5b664c45aa
2019-05-21 02:24:56 -07:00
dimitry
051d5cba80 Enable native_bridge_support for libcutils
Android build system added support for building translated binaries
used on natively bridged targets (arm on x86 for example).

However in order to avoid building unnecessary binaries and libraries
for such architectures most modules do not support native bridge by default.

All needed modules have to explicitly indicate if they may be used as part
of translated binary build.

This change enabled native bridge support for libcutils which is a
greylisted library (available for apps targeting Android version < N).

Bug: http://b/77159578
Test: make
Change-Id: I56fe5e11a884d22714cfc4afb78bec0a352d6370
2019-05-16 14:17:00 +02:00
Tom Cherry
d0dc22e467 Merge "Add default executable permission in odm/bin" am: 766e878253
am: ede9bb5b37

Change-Id: I0d2817f128f8acaec5356b42b80d43ef0b8ac947
2019-05-08 08:56:03 -07:00
Tom Cherry
766e878253 Merge "Add default executable permission in odm/bin" 2019-05-08 15:31:28 +00:00
Tom Cherry
6836c9a24b Merge "Remove sbin from fs_config.cpp" am: 26ec31ce8d
am: c6c4fbe805

Change-Id: I8a8d4742a03df2bf475c6a4a7c7350cff7638470
2019-05-07 23:59:51 -07:00
Tom Cherry
2f74a26a2d Remove sbin from fs_config.cpp
There is no longer a /sbin on Android.

Bug: 73660730
Test: build
Change-Id: I3f5ce292790392a02aa4a1c661f44b4c7e1570dc
2019-05-07 10:21:05 -07:00
Min Yun
a8eb00720c Add default executable permission in odm/bin
In odm's binary files can't have executable permission.
Add default executable permission in odm/bin and vendor/odm/bin.
Previously partitions that except system, only appeared in
system partition if product haven't separated partition.
After support ODM, vendor/odm should considered.

Bug : 124465978
Test : Check each file's permission.
system/vendor/bin/* -> 0755
system/product/bin/* -> 0755
system/product_services/bin/* -> 0644
system/oem/bin/* -> 0644

vendor/odm/bin/* -> 0755
vendor/product/bin/* -> 0644
vendor/product_services/bin/* -> 0644

Change-Id: I5cee48474fceaf73853b2013d58017bd64953d86
2019-05-07 14:04:23 +09:00
Tim Murray
41f261df25 Merge "cutils: add ashmem_init" am: 55ba959c13
am: 3d213c39e8

Change-Id: Ib9335109c0226c34dce479ee56a5f231d23f8d19
2019-04-05 03:02:02 -07:00
Tim Murray
8879ed7f2a cutils: add ashmem_init
Add a new ashmem_init function that only dlopens libashmemd_client.
This allows the library to be preloaded in the zygote.

Test: boots, works
Bug: 129543489

Change-Id: Ie106791edf381654f085203c266c9f9c0df35cfc
2019-04-04 17:30:25 -07:00
Tim Murray
943f1c1d4a cutils: add ashmem_init
Add a new ashmem_init function that only dlopens libashmemd_client.
This allows the library to be preloaded in the zygote.

Test: boots, works
Bug: 129543489

Change-Id: Ie106791edf381654f085203c266c9f9c0df35cfc
2019-04-05 00:28:05 +00:00
Yifan Hong
25d42eeaa6 Merge changes from topic "libprocessgroup_rc"
* changes:
  CgroupSetupCgroups -> CgroupSetup
  Add libcgrouprc to ld.config.*.txt.
  libprocessgroup: use libcgrouprc to read cgroup.rc
  libprocessgroup_setup: use libcgrouprc_format
  libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup
  libprocessgroup: Add libcgrouprc
  libprocessgroup: Add libcgrouprc_format
2019-04-03 19:08:51 +00:00
Yifan Hong
bd5853cb48 Merge changes from topic "libprocessgroup_rc"
* changes:
  CgroupSetupCgroups -> CgroupSetup
  Add libcgrouprc to ld.config.*.txt.
  libprocessgroup: use libcgrouprc to read cgroup.rc
  libprocessgroup_setup: use libcgrouprc_format
  libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup
  libprocessgroup: Add libcgrouprc
  libprocessgroup: Add libcgrouprc_format
2019-04-03 16:41:21 +00:00
Yifan Hong
53e0deb7b2 libprocessgroup: use libcgrouprc to read cgroup.rc
Use the LL-NDK library to read cgroup.rc.

As a side-effect, the CgroupController class is changed
to a wrapper of ACgroupController* from the library. The
class itself essentially becomes the pointer, and can be
trivially copied. Modify all client code for this change.

Test: builds and boots
Bug: 123664216

Change-Id: I635d9885db62e82f37421f6d20f59c84a6f4cbb2
Merged-In: I635d9885db62e82f37421f6d20f59c84a6f4cbb2
2019-04-02 22:31:57 -07:00
Elliott Hughes
15e370aced Merge "libcutils: android_reboot command should be unsigned." am: e3ec16b9c6 am: cf2f309cff
am: ba78d39cdc

Change-Id: I034c780c6c1166e4c6643ebcc607d3388246ebab
2019-04-02 19:52:28 -07:00
Treehugger Robot
e3ec16b9c6 Merge "libcutils: android_reboot command should be unsigned." 2019-04-03 01:19:06 +00:00
Yifan Hong
fad638c82d libprocessgroup: use libcgrouprc to read cgroup.rc
Use the LL-NDK library to read cgroup.rc.

As a side-effect, the CgroupController class is changed
to a wrapper of ACgroupController* from the library. The
class itself essentially becomes the pointer, and can be
trivially copied. Modify all client code for this change.

Test: builds and boots
Bug: 123664216

Change-Id: I635d9885db62e82f37421f6d20f59c84a6f4cbb2
2019-04-02 17:34:37 -07:00
Nick Kralevich
eed675688d Merge "Revert "relax /system/bin directory permissions"" am: 98880af580 am: 88b15b2b7c
am: 6b38459ee5

Change-Id: I44ec7363697f52ee55284343f4f4f473b34de9ab
2019-04-02 15:05:19 -07:00
Elliott Hughes
66e5ae0f5a libcutils: android_reboot command should be unsigned.
Hex literals have the type of the first type they fit in. The reboot
constants are large enough that that's `unsigned` rather than `int`.

Bug: http://b/76110968
Test: treehugger
Change-Id: Iac4fe61d1fe572297febf0b57e34d698942469f9
2019-04-02 09:19:46 -07:00
Nick Kralevich
8d1b43bbf4 Revert "relax /system/bin directory permissions"
It appears Chase has fixed their app, so we no longer need to keep these
permissions relaxed.

This reverts commit 53842f8a90.

Bug: 119605322
Test: compiles and boots
Change-Id: Iba5e9ecd685eb386997a5e92638b8a1b5943ad4b
2019-04-02 08:54:17 -07:00
Steven Moreland
6e10e67eaa Merge "libutils/libcutils: make host more like device" am: 43f29072a9 am: 02bb6c1b24
am: 775ed88ddd

Change-Id: I6d9a2c90499622ad61046b3c222f8cb9d688bd16
2019-03-29 17:49:56 -07:00
Steven Moreland
43f29072a9 Merge "libutils/libcutils: make host more like device" 2019-03-29 23:05:20 +00:00
Steven Moreland
e6132be529 libutils/libcutils: make host more like device
Having shared host libraries allows libraries depending on these to use
'shared_libs' for these. This simplifies configurations since these
libraries don't have to specify 'shared_libs' on all non-host targets.

Bug: 124524556
Test: build only

Change-Id: I09fb4a4fb66ea0a87cb76b1e6f400c537a11f082
2019-03-28 18:44:32 -07:00
Yifan Hong
82faf0949f libcutils: android_get_control_file uses realpath. am: dd6eefca30 am: 877436dd25
am: 353d08605d

Change-Id: Ia22a3af3de76eace5f8cb6e58ebc2a8c9d59437f
2019-03-26 16:37:24 -07:00
Elliott Hughes
ae2c2c5770 Merge "Clean up some mess by only building Android-specific code for the device." am: 443fdb2fdc am: 0fa7eddc31
am: 870413d411

Change-Id: I5ea2a7cf59c8ce5b7bc0a970237df17a69d08056
2019-03-25 09:43:43 -07:00
Yifan Hong
dd6eefca30 libcutils: android_get_control_file uses realpath.
If the path to android_get_control_file is a symlink, the final sanity
check will fail that the fd does not have the same path as the given
file. We can't expect callers to readlink() because this would change
the environment key. Instead, try to call realpath on both paths.

Bug: 126233777
Test: lpdump
Change-Id: I0df10d7dbe3e572b8335faad812e5cd80bff1733
2019-03-21 16:00:00 -07:00
Elliott Hughes
7acb0d39e8 Clean up some mess by only building Android-specific code for the device.
Test: treehugger
Change-Id: Id44721ccd1817d8c537b226f60a58b7cb691fb01
2019-03-21 14:59:45 -07:00
Roland Levillain
00c6d45ee9 Merge "Remove Valgrind entries from fs_config." am: e61d5ccf47 am: 710264b43b
am: 6ab844e1fe

Change-Id: I8ab7dcf37ed09045bfe9efe14a93048d6966c74e
2019-03-14 06:43:13 -07:00
Roland Levillain
3f3e2c678e Remove Valgrind entries from fs_config.
Valgrind has been removed from the Android tree in 2018.

Test: n/a
Bug: 77856586
Change-Id: I3b51d9b2290a4276299725cdd5a53a5bba00166e
2019-03-13 17:12:00 +00:00
The Android Open Source Project
4d916a1ece DO NOT MERGE - Merge PPRL.190305.001 into master
Bug: 127812889
Change-Id: I16a546dc24d3cf980ad7ab09895c0d97ee436224
2019-03-11 11:57:28 -07:00
Martijn Coenen
538e0b98c4 Update comments on native_handle_create.
To indicate limits.

Test: builds
Change-Id: Id5129a7f6a8f413911544dedeb02bb4e7a2f6e10
2019-03-06 14:22:10 +01:00
Elliott Hughes
1c8edfa5f3 Merge "__android_log_is_debuggable() shouldn't be an apex symbol" am: 69fc7b628d
am: 963633232e

Change-Id: Id4d53a791e8350be4bb91af4b20bc4a9715b464f
2019-02-20 22:51:49 -08:00
Tom Cherry
15800946e0 __android_log_is_debuggable() shouldn't be an apex symbol
Remove a superfluous check in fs_mgr, since those return values are
already impossible for a non-debuggable build.  Replace a one time
call to __android_log_is_debuggable(), since there's no reason to
cache the value or use this symbol.

Test: build
Change-Id: Icd4bef7b616c49d304303747388d7e3018c6fcfc
2019-02-20 12:52:02 -08:00
Elliott Hughes
661ce4047d Merge "Clean up libcutils/libutils tests." am: 57150963a3
am: f984d7a403

Change-Id: I9870edb8119ba3850b8f9863de439f3fa1fabaa8
2019-02-11 18:37:45 -08:00
Elliott Hughes
01705e4f1d Clean up libcutils/libutils tests.
Move tests in the same directory as the corresponding code, so it's
easier to see what is/isn't tested.

Fix naming of libcutils_tests (plural) to match the singular that's more
common (even though the plural makes more sense to me).

Add these two to system/core/'s TEST_MAPPING.

Remove obsolete AndroidTest.xml.

Fix a flaky (timing-dependent) libcutils test.

Test: ran tests
Change-Id: I7e0a31ff45c8a152562bf66fc97161594249366e
2019-02-11 13:15:56 -08:00
Jiyong Park
76a125bf4e Merge "Eliminate the APEX name in fs_config using wildcard" am: ea353cab91
am: 2e0f43c6ba

Change-Id: Id6e14d3e5d9c7e479ba2150804aa5f0f9c73469d
2019-02-08 17:45:37 -08:00
Jiyong Park
defdb18675 Eliminate the APEX name in fs_config using wildcard
Bug: 123743953
Test: Marlin/sailfish boots to the UI
Change-Id: If1669122be78255879ffb8c8c0a7408a34b5e617
2019-02-09 02:59:17 +09:00
Jiyong Park
6e1875ffea Merge "fs_config supports shell wildcard patterns" am: 2210f80e48
am: 4fe80fa336

Change-Id: I6dfdd5d8979a294bbe3c054f900e4f0f935edae4
2019-02-08 07:54:57 -08:00
Jiyong Park
a2159c493b fs_config supports shell wildcard patterns
It now supports shell wildcard pattern matching using fnmatch(3).

Bug: 123743953
Test: atest libcutils_test
Change-Id: Ib82ae3bf717cbdba267024e1c9d3da004274b95c
2019-02-08 03:53:52 +09:00
Jiyong Park
b97eeb34c4 Merge "Configure /system/apex/com.android.runtime.[debug|release]/bin/*" am: 186661d135
am: 6649f7447e

Change-Id: Iee6311ea1bdeae6e45a6863ee048ff229c0ca841
2019-02-07 08:26:34 -08:00
Jiyong Park
186661d135 Merge "Configure /system/apex/com.android.runtime.[debug|release]/bin/*" 2019-02-07 16:08:24 +00:00
Joel Fernandes
e3b45e5c31 Merge changes from topic "memfd-support" am: 3133b695e0
am: b03663ebdf

Change-Id: Idf18cb0a8eb9327f75d28018e9f0940cc32ae962
2019-02-07 06:27:43 -08:00
Joel Fernandes
519440468b Add support for memfd
This patch adds support to make libcutils create and use memfd where
possible, instead of ashmem.

The libcutils library is made dynamic, since apps are still sending over
ashmem FDs to processes and we are working on moving those apps away
from ashmem. The best we can do for that is make the library work, and
force apps in the long run to move away from directly using ashmem.

Due to further complications mentioned in the 'NOTE' section of the
patch, memfd is kept disabled for now, so nothing changes yet. To enable
it, set the sys.use_memfd property (check user_debug build).

Bug: 113362644
Change-Id: I491cb7841b664db5b1c26b3e07a440a14810e182
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-02-07 00:40:13 +00:00
Tri Vo
f60debf334 Merge "libcutils: route to ashmemd" am: 5bccd33e0b
am: 6604befa2e

Change-Id: I9511ecf61f9dd85bf2345eef0dd0138cf4f918b0
2019-02-05 13:58:27 -08:00
Suren Baghdasaryan
43a0b172f4 libprocessgroup: Add support for task profiles am: 82b72a5667
am: 953472f577

Change-Id: I5878ecc185f6c673bd18ef17769430e2df1ad71f
2019-02-04 20:58:31 -08:00
Tri Vo
2891ba09d5 libcutils: route to ashmemd
If libcutils is not a VNDK version and /dev/ashmem is not available,
then ask ashmemd for opened fd to /dev/ashmem.

We rely on SELinux policy to determine what's allowed to open
/dev/ashmem directly.

Bug: 113362644
Test: device boots (in selinux permissive mode)
Change-Id: I93c4fa6044b0bfa5282097c6c32139a8d8f67deb
2019-02-04 10:30:24 -08:00
Suren Baghdasaryan
82b72a5667 libprocessgroup: Add support for task profiles
Abstract usage of cgroups into task profiles that allows for changes
in cgroup hierarchy and version without affecting framework codebase.
Rework current processgroup and sched_policy API function implementations
to use task profiles instead of hardcoded paths and attributes.
Mount cgroups using information from cgroups.json rather than from init.rc

Exempt-From-Owner-Approval: already approved in internal master

Bug: 111307099
Test: builds, boots

Change-Id: If5532d6dc570add825cebd5b5148e00c7d688e32
Merged-In: If5532d6dc570add825cebd5b5148e00c7d688e32
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-02-03 16:48:35 +00:00
Jiyong Park
3435c88b4a Configure /system/apex/com.android.runtime.[debug|release]/bin/*
When TARGET_FLATTEN_APEX is set to true, the APEXes are flattened
directly under /system/apex/<name>. Among them the runtime APEX carries
binaries such as linker, dex2oat and they need to be configured to be
executable.

Bug: 123684826
Test: Marlin/sailfish boots to the UI
Change-Id: I8ebe9dc4341410ff91ca2cb7cf95e21b0829c008
2019-02-01 22:05:46 +09:00
David Anderson
a174c6e5b5 Merge "Add user/group for gsid." am: 9747a65380
am: 520aa5bfa1

Change-Id: I244794b8aca62983bb600ca214aedb09ef23a50a
2019-01-30 09:37:30 -08:00
David Anderson
8bc2b89ae6 Add user/group for gsid.
Bug: 122556707
Test: manual test
Change-Id: I18e44ff1bbb3c43cfc8f6f2997f9358052ce249b
2019-01-29 17:48:12 -08:00
Suren Baghdasaryan
1bd127b72e DO NOT MERGE: Revert "Revert "libcutils: Move sched_policy functions into libprocessgroup""
This reverts commit b5394db682.

Reason for revert: AOSP is fixed with new vendor image

Change-Id: Ie1a2e0200600214a65f4fe2250c903c8e8ce0a29
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-25 16:49:09 +00:00
Yabin Cui
f29284d53a Merge "Add setuid/setgid capabilities to simpleperf_app_runner." am: c87d1ed611
am: eb16021d1e

Change-Id: I4a723f71f1b7942db5124aa42ccb5e4008e2dde4
2019-01-24 11:17:50 -08:00
Yabin Cui
eb16021d1e Merge "Add setuid/setgid capabilities to simpleperf_app_runner."
am: c87d1ed611

Change-Id: I4d03b065dd379cffbe5ca9656c3294a7f3675887
2019-01-24 11:05:26 -08:00
Suren Baghdasaryan
6738419e09 Merge changes from topic "move sched_policy functions" am: ca50ee91b5
am: e8b2ac49bb

Change-Id: I9ba62bc4cce474b2a12af5a1035714ac9dd39703
2019-01-22 13:41:10 -08:00
Yabin Cui
af3e30d271 Add setuid/setgid capabilities to simpleperf_app_runner.
Also add simpleperf_app_runner in shell utilities.

Bug: 118835348
Test: build and boot.
Test: run simpleperf_app_runner manually.

Change-Id: I538503dabfa8ff192f4b3029206a62613eacdf32
2019-01-22 11:20:10 -08:00
Suren Baghdasaryan
facd40d0e1 libcutils: Move sched_policy functions into libprocessgroup
Move functions operating on cgroups from sched_policy.h in libcutils
into sched_policy_ctrl.h under libprocessgroup. This consolidates
cgroup-related functionality inside libprocessgroup.

Bug: 111307099
Test: builds, boots

Merged-In: Iba75f33281162b889989214d0325a5973d53ed2d
Change-Id: Iba75f33281162b889989214d0325a5973d53ed2d
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-22 18:18:48 +00:00
Martijn Coenen
c3be3e8b2a Merge "Update AID_ISOLATED_START to include new range." am: 73992c7c00
am: 48ec9e7ce4

Change-Id: I4c95bf99639aeb3e22f6260f2905ba6f5ce592ad
2019-01-17 13:03:00 -08:00
Martijn Coenen
cb88bc95fc Update AID_ISOLATED_START to include new range.
The AppZygote allocates UIDs out of the [90000..98999] range.

Bug: 111434506
Test: builds
Change-Id: I7846a81077636f6f9aff2880f1c9ee01c6f98257
2019-01-17 11:48:58 +01:00
Martijn Coenen
20ac1203a3 Export maximum number of fds/ints in a native_handle.
So we can deserialize it consisently and safely.

Bug: 120084106
Test: builds
Change-Id: I0eafff70d3a7e4d732fe600a0052efb90108208d
2019-01-16 08:55:14 -08:00
Mårten Kongstad
79d59f0b79 Merge "Add systrace tag for RRO" am: 1c018862a0
am: 047ae05793

Change-Id: If1c6b6b4b3b7696dfcbd358aca2234edfc9f24ee
2019-01-09 16:14:02 -08:00
Mårten Kongstad
ee9534515e Add systrace tag for RRO
Introduce a new systrace tag, TRACE_TAG_RRO, for use with runtime
resource overlay.

Bug: 119761810
Test: builds
Merged-In: I7b883d107a9ae2b12bbda04b74001a68e2a904aa
Change-Id: I7b883d107a9ae2b12bbda04b74001a68e2a904aa
2019-01-08 14:17:47 -08:00
David Sehr
903789f132 Merge "Enable building ATRACE stubs on Windows" am: 8f5f643c57
am: 7373603f11

Change-Id: I1571ba36f08831d3bb74e683c8e79872981b67a3
2019-01-07 14:05:40 -08:00
Martijn Coenen
ad1fded66a Export maximum number of fds/ints in a native_handle. am: 02debfa2df am: 5fa5708025
am: 08ba9b1412

Change-Id: I8a4ebec9c608af10bcb1387fc5dfe9b0b6886f27
2019-01-04 10:58:38 -08:00
Martijn Coenen
08ba9b1412 Export maximum number of fds/ints in a native_handle. am: 02debfa2df
am: 5fa5708025

Change-Id: I7812acbfd43811e332513b9945432d23fba94187
2019-01-04 10:53:26 -08:00
Martijn Coenen
5fa5708025 Export maximum number of fds/ints in a native_handle.
am: 02debfa2df

Change-Id: I36da3de7dcad006ee647163a62b0d5c8819b994e
2019-01-04 10:46:21 -08:00
David Sehr
eb2dd20dc3 Enable building ATRACE stubs on Windows
The header contained inline functions that called unimplemented code on
Windows.  Enable building the implementations.

Bug: none
Test: make -j 50 checkbuild
Change-Id: I11b39e6f5c72fc000088182f3631a9f538474c42
2018-12-20 13:46:08 -08:00
Remi NGUYEN VAN
354d5f27ff Merge "Add UID for network stack app" 2018-12-19 02:01:23 +00:00
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
Tom Cherry
23319ebebf Start using new C++ Fstab class widely
Bug: 62292478
Test: boot
Test: adb-remount-test.sh

Change-Id: Id4715af4c1f03e2cfc67de92d3ea58e933685e51
2018-12-12 17:08:09 +00:00
Remi NGUYEN VAN
1129243abe Add UID for network stack app
Test: built, booted, verified app is started and has proper uid
Bug: b/112869080
Change-Id: I8a21613de825ede8832918d0ffa08c537b30704b
2018-12-12 10:55:38 +09:00
Martijn Coenen
02debfa2df Export maximum number of fds/ints in a native_handle.
So we can deserialize it consisently and safely.

Bug: 120084106
Test: builds
Change-Id: I0eafff70d3a7e4d732fe600a0052efb90108208d
2018-12-11 11:38:41 +01: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
Daniel Mentz
41aa2c3703 Increase netlink uevent rcvbuf size to 16M
Increase size of the NETLINK_KOBJECT_UEVENT socket receive buffer to
16M.  Also, use SO_RCVBUFFORCE to override any limits set by
/proc/sys/net/core/rmem_max.

We had a couple of instances, where we lost critical uevent messages due
to receive buffer overflows.

Bug: 119933843
Change-Id: I6aab183aa0194e173f9175b47c6beb0835cf6675
2018-12-03 18:39:24 +00:00
Mark Salyzyn
9f1cf25332 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
2018-11-14 09:35:34 -08: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
Peiyong Lin
126c19b6ec [GPU Service] Add independent AID for gpu service.
BUG: 118347356
Test: Build, flash and boot, `adb shell cmd gpuservice vkjson` to verify

Change-Id: Ic8c4154668d09b3dbfedf4a7c0dc376a01a9bde6
2018-11-06 12:52:01 -08:00
Elliott Hughes
396bf2109a libcutils: lose socket_peer_is_trusted to ART, the only user.
Bug: N/A
Test: builds
Change-Id: I599270729c2037b2c06d7906a5e5f7362fbbaf08
2018-10-25 13:24:08 -07:00
bohu
39ed7afe2b fs_mgr: fix incorrect parameter type
BUG: 117426573
Change-Id: Iffbdd3763dd19aa527bf805918a566477d122cfc
2018-10-09 10:49:44 -07:00
Igor Murashkin
4578129f86 android_filesystem_config add AID for iorapd
Add new AID for new binder native service (iorapd).

Bug: 72170747
Change-Id: I81facb3f22e1162dc49329b970532287833fcecd
2018-10-05 16:26:28 -07:00
David Pursell
6fd4b9b6b5 libcutils test: make set_sched_policy optional
set_sched_policy checks that operations related to the kernel config
CONFIG_CGROUP_SCHEDTUNE are working properly, but this config is not
required so devices without this were failing the test.

This CL splits set_sched_policy into two tests so that the policy and
timerslack tests can be skipped individually when devices don't support
them.

Bug: 113185515, 112550681
Test: libcutils_test{32,64} now pass on aosp_x86_64 emulator
Change-Id: I31638b61e033f0c96b63428a8d27d27dbc36bce3
2018-08-28 13:26:04 -07: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
Joel Fernandes
70aa2a3475 Merge "libcutils: ashmem: Avoid doing fd checks for ashmem calls"
am: 5fd5be33e6

Change-Id: Ieed029cda8a99e528c2297005122b898452ab3d9
2018-07-17 19:28:23 -07:00
Joel Fernandes
5fd5be33e6 Merge "libcutils: ashmem: Avoid doing fd checks for ashmem calls" 2018-07-18 02:14:54 +00:00
Joel Fernandes
56cd651e7a libcutils: ashmem: Avoid doing fd checks for ashmem calls
Callers already verify that they are calling ashmem API on a valid fd by
calling ashmem_valid first. Lets make the fstat syscall only if the
ioctl returns -ENOTTY. This means in the regular case, only 1 syscall is
needed (ioctl) vs the current 2 (fstat+ioctl).

Some data to show improvements in reduction of vfs_getattr calls in the
kernel by 10x when doing a camera.

Test: Boot and camera CTS
Bug: 111418894
Change-Id: I992620bbe44355e54ba19eeac81da586c5e5a6e0
Signed-off-by: Joel Fernandes <joelaf@google.com>
2018-07-17 17:02:44 -07:00
Yi Kong
f2b4259b93 Merge "libcutils: remove rather than fix the mutex."
am: 39e7a1c981

Change-Id: Ie1084574143f2d1e4b4995f7682948b77b5334b6
2018-07-14 14:27:25 -07:00
Yi Kong
39e7a1c981 Merge "libcutils: remove rather than fix the mutex." 2018-07-14 21:18:54 +00:00
Elliott Hughes
51a2cacbb9 libcutils: remove rather than fix the mutex.
Bug: 68236239
Test: ran tests
Change-Id: I53e47f99e6963bedcb0be30cf10c9187da8a047d
2018-07-13 14:53:51 -07:00
Elliott Hughes
1ecedeb0c1 Merge "cutils: move hashmap to <pthread.h>."
am: dda5fe46ac

Change-Id: I925212825eb6b91074bf519e532125953c5eb1f1
2018-07-13 13:10:57 -07:00
Elliott Hughes
9d12725cad cutils: move hashmap to <pthread.h>.
Bug: N/A
Test: builds
Change-Id: I16a470265a17ea5bd47ef76ec234907cf7ec3e4f
2018-07-13 10:54:49 -07:00
Elliott Hughes
0ba4aed7ec Merge "libcutils: remove unused open_memstream."
am: df398f2b67

Change-Id: I8b19f94b4c9e689dbd72d70fa6bd28d6c003a205
2018-07-12 09:14:25 -07:00
Elliott Hughes
bf7909a521 Merge "libcutils: remove some unused API."
am: fc567a9b95

Change-Id: I114ea3f267f240ae54668807e75d077cd09228fa
2018-07-12 09:13:53 -07:00
Elliott Hughes
df398f2b67 Merge "libcutils: remove unused open_memstream." 2018-07-12 16:07:04 +00:00
Elliott Hughes
c35d4a5213 libcutils: remove unused open_memstream.
Bug: N/A
Test: builds
Change-Id: I3c2d8acd4dfe42fbe883b14501cd47674d84f431
2018-07-11 14:28:21 -07:00
Elliott Hughes
721e3ebf55 libcutils: remove some unused API.
Bug: N/A
Test: builds
Change-Id: Iabe42353a708afde2611b5c642775849e2e45baa
2018-07-11 14:27:32 -07:00
Bernie Innocenti
d540d5630c Merge "libcutils: Simplify android_get_control_socket()"
am: 5f70ed6ee1

Change-Id: I2d4b953241ee3ba62f6bbac2edd6a3c589864a90
2018-06-28 04:15:14 -07:00
Treehugger Robot
5f70ed6ee1 Merge "libcutils: Simplify android_get_control_socket()" 2018-06-28 11:01:44 +00:00
Elliott Hughes
fdd7062e09 Merge "libcutils: add OWNERS."
am: cd7244100b

Change-Id: I76a7d21a1387cc3cab77dfe95c42674dd1c0bac0
2018-06-12 15:50:18 -07:00
Treehugger Robot
cd7244100b Merge "libcutils: add OWNERS." 2018-06-12 22:46:28 +00: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
Elliott Hughes
796eb71e9c libcutils: add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ia147e1dc9511810cd86a463861db3d3d7fedab9b
2018-06-12 13:58:30 -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
9bd3ee1c4f Support /product/bin
Bug: 80422611
Test: m -j succeeded and permissions of files under /product/bin are set
correctly

Change-Id: I83377d809c47c92da6b226d2853ea6a7462fb127
Merged-In: I83377d809c47c92da6b226d2853ea6a7462fb127
(cherry picked from commit 25195daaca)
2018-06-01 10:38:57 +09: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
Bernie Innocenti
4351bb05ad libcutils: Simplify android_get_control_socket()
1. TEMP_FAILURE_RETRY() isn't necessary with getsockname() because
it's a synchronous syscall.

2. There's no need to allocate and free a temporary buffer for the
full pathname of the socket.

Test: Manually, as follows:
    - added temporary ALOG output
    - flashed and booted a device
    - checked expected output from all system daemons
    - removed log statements

Change-Id: I4550a2d67fdffe6aff3c1050f8eeeaca0f985fb3
2018-05-28 15:00:50 +09:00
Jiyong Park
dfe433db47 Merge "Mark as recovery_available: true" am: 9f6f8bf0dc
am: d7fece5d91

Change-Id: Id59445da13aeef13784f04daebc8a96a7d506cbb
2018-05-21 22:32:36 -07:00
Jiyong Park
612210c75b Mark as recovery_available: true
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Bug: 67916654
Bug: 64960723
Test: m -j
Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
2018-05-15 09:47:04 +09:00
Gwendal Grignou
b7f78ee89c Merge "allow config/sdcardfs directory to be seen for ARC++" into pi-dev
am: 232ce729f5

Change-Id: Idcd13df25a17e91b4395d3672ce52f9e24f400af
2018-05-10 18:41:50 -07:00
Gwendal Grignou
232ce729f5 Merge "allow config/sdcardfs directory to be seen for ARC++" into pi-dev 2018-05-11 01:36:14 +00:00
Logan Chien
94223374c8 libctuils: Exclude qtaguid.cpp from VNDK-SP variant
This commit excludes `qtaguid.cpp` from the VNDK-SP variant of
`libcutils.so` because the interface of `libnetd_client.so` may vary
between AOSP releases.

Besides, these functions don't work in vendor processes either because
VNDK-SP libraries are loaded in an isolated `vndk` linker namespace,
which cannot access `/system/lib[64]/libnetd_client.so` directly.  This
change makes it easier to spot the issue at build time and saves several
bytes.

Test: Build aosp_walleye-userdebug and
/system/lib[64]/vndk-sp-$VER/libctuils.so no longer exports qtaguid_*
functions.

Bug: 79329469
Change-Id: Idf6b60f6e58371ea320193641669d1e4412d62b8
Merged-In: Idf6b60f6e58371ea320193641669d1e4412d62b8
(cherry picked from commit 25b742c627)
2018-05-09 10:16:12 +08:00
Logan Chien
bb783998ce Merge "libctuils: Exclude qtaguid.cpp from VNDK-SP variant" 2018-05-09 01:56:00 +00: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
Elliott Hughes
23b98f492b Remove more bogus <stdbool.h> #includes from C++.
Bug: N/A
Test: builds
Change-Id: I794cd28667c6c65b38940d8f443315ad116b7ac3
2018-05-08 13:00:06 -07:00
Logan Chien
25b742c627 libctuils: Exclude qtaguid.cpp from VNDK-SP variant
This commit excludes `qtaguid.cpp` from the VNDK-SP variant of
`libcutils.so` because the interface of `libnetd_client.so` may vary
between AOSP releases.

Besides, these functions don't work in vendor processes either because
VNDK-SP libraries are loaded in an isolated `vndk` linker namespace,
which cannot access `/system/lib[64]/libnetd_client.so` directly.  This
change makes it easier to spot the issue at build time and saves several
bytes.

Test: Build aosp_walleye-userdebug and
/system/lib[64]/vndk-sp-$VER/libctuils.so no longer exports qtaguid_*
functions.

Bug: 79329469
Change-Id: Idf6b60f6e58371ea320193641669d1e4412d62b8
2018-05-08 17:41:21 +08:00
Mika Raento
2c2e3e89b0 Systrace support for NNAPI
Change-Id: I5abf283b5fb04725ec0b8ffbb8191fbddec1766b
Bug: 78137932
Test: mm
2018-04-26 09:34:22 +01:00
Elliott Hughes
9f49508f36 Rewrite get_sched_policy_name for safety.
This way you'll get a build time error if you make the usual mistake of
adding to the enum but not adding an entry to the array.

Also improve the unit tests, and fix get_sched_policy_name's incorrect
behavior on invalid inputs.

Bug: N/A
Test: ran tests
Change-Id: Iefcb1ec9ef66267837da7a576c8be3d0cfb16cd0
2018-04-25 14:55:48 -07:00
Tim Murray
419ba9e2aa cutils: add restricted cpuset
(cherrypick of 658ae90f69 without the init.rc change)

Bug: 78197570
Test: CTS
Change-Id: I6df972950b75a839caa463ae282ad000b959e8ae
2018-04-25 14:30:37 -07:00
Tim Murray
658ae90f69 cutils: add restricted cpuset
Bug 78197570
Test: CTS
Exempt-From-Owner-Approval: owner OOO, build cop says it's fine

Change-Id: I6df972950b75a839caa463ae282ad000b959e8ae
2018-04-18 16:42:12 -07:00
Mark Salyzyn
f089e1403b llkd: add live-lock daemon
Introduce a standalone live-lock daemon (llkd), to catch kernel
or native user space deadlocks and take mitigating actions.  Will
also configure [khungtaskd] to fortify the actions.

If a thread is in D or Z state with no forward progress for longer
than ro.llk.timeout_ms, or ro.llk.[D|Z].timeout_ms, kill the process
or parent process respectively.  If another scan shows the same
process continues to exist, then have a confirmed live-lock condition
and need to panic.  Panic the kernel in a manner to provide the
greatest bugreporting details as to the condition.  Add a alarm self
watchdog should llkd ever get locked up that is double the expected
time to flow through the mainloop.  Sampling is every
ro.llk_sample_ms.

Default will not monitor init, or [kthreadd] and all that [kthreadd]
spawns.  This reduces the effectiveness of llkd by limiting its
coverage.  If in the future, if value in covering kthreadd spawned
threads, the requirement will be to code drivers so that they do not
remain in a persistent 'D' state, or that they have mechanisms to
recover the thread should it be killed externally.  Then the
blacklists can be adjusted accordingly if these conditions are met.

An accompanying gTest set have been added, and will setup a persistent
D or Z process, with and without forward progress, but not in a
live-lock state because that would require a buggy kernel, or a module
or kernel modification to stimulate.

Android Properties llkd respond to (*_ms parms are in milliseconds):
- ro.config.low_ram default false, if true do not sysrq t (dump
  all threads).
- ro.llk.enable default false, allow live-lock daemon to be enabled.
- ro.khungtask.enable default false, allow [khungtaskd] to be enabled.
- ro.llk.mlockall default true, allow mlock'd live-lock daemon.
- ro.khungtask.timeout default 12 minutes.
- ro.llk.timeout_ms default 10 minutes, D or Z maximum timelimit,
  double this value and it sets the alarm watchdog for llkd.
- ro.llk.D.timeout_ms default ro.llk.timeout_ms, D maximum timelimit.
- ro.llk.Z.timeout_ms default ro.llk.timeout_ms, Z maximum timelimit.
- ro.llk.check_ms default 2 minutes sampling interval
  (ro.llk.timeout_ms / 5) for threads in D or Z state.
- ro.llk.blacklist.process default 0,1,2 (kernel, init and
  [kthreadd]), and process names (/comm or /cmdline) init,[kthreadd],
  lmkd,lmkd.llkd,llkd,[khungtaskd],watchdogd,[watchdogd],
  [watchdogd/0] ...
- ro.llk.blacklist.parent default 0,2 (kernel and [kthreadd]) and
  "[kthreadd]".  A comma separated lists of process ids, /comm names
  or /cmdline names.
- ro.llk.blacklist.uid default <empty>, comma separated list of
  uid numbers or names from getpwuid/getpwnam.

Test: llkd_unit_test
Bug: 33808187
Bug: 72838192
Change-Id: I32e8aa78aef10834e093265d0f3ed5b4199807c6
2018-04-18 14:01:56 -07:00
Mark Salyzyn
64d97d8761 lmkd: limit capability set to minimum
Set F() capability set and 'drop' lmkd from AID_ROOT to AID_LMKD uid
and from AID_ROOT to AID_LMKD and AID_SYSTEM gid.

/dev/memcg/memory.pressure defaults to root.root mode 0000, set it up
as root.system mode 0040 to allow lmkd read access.

Instrument failure to set SCHED_FIFO.

Annotate access points that require elevated capabilities.

Test: check /proc/`pidof lmkd`/status for capability set
Test: lmkd_unit_test
Bug: 77650566
Change-Id: I986081a0434cf6e842b63a55726380205b30a3ea
2018-04-16 14:51:56 -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
Martijn Coenen
24426e96a5 Add new trace tag for AIDL.
So we can auto-generate tracing code for AIDL interfaces.

Bug: 74416314
Test: inspect atrace output
Change-Id: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
Merged-In: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
2018-03-26 09:59:21 +02:00
Martijn Coenen
07b98d9b97 Add new trace tag for AIDL.
So we can auto-generate tracing code for AIDL interfaces.

Bug: 74416314
Test: inspect atrace output
Change-Id: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
2018-03-21 13:59:34 +01: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
Alexey Kuzmin
8166a93899 Merge "Add tracing tags to vibrator" am: c415d00fbe am: 0f71d5fe53
am: f2b8913c4f

Change-Id: I2c90c90bfc08875b2cb58d8a8cc8bec414164438
2018-02-15 14:17:57 +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
Alexey Kuzmin
3b5aebb046 Add tracing tags to vibrator
Now all somewhat time-consuming methods of the VibratorService
are surrounded by traceBegin/traceEnd blocks.
The vibration itself is surrounded with asyncTrace block.

Test: Run "systrace vibrator" and see the time consumption report.
Bug: 73000045
Merged-In: I94172e379354ec3418321b8151e6182cec2e886c
Change-Id: I94172e379354ec3418321b8151e6182cec2e886c
2018-02-13 18:29:40 +00:00
Daniel Colascione
d49fb1238d Merge "Support * as a wildcard for ATRACE_TAG_APP" am: 53c964f53b am: 2e50045f60
am: 34499aab21

Change-Id: Ie8e78dc2f85c513ba4ba8b4a355a7d4de1e1055d
2018-02-12 23:27:14 +00: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
Daniel Colascione
642ef98b3b Support * as a wildcard for ATRACE_TAG_APP
Test: strcmp
Change-Id: I33ec3ae071e3856538444663bbabb3c779ed8afa
2018-02-09 20:08:19 -08:00
Paul Crowley
c67fd14fd1 Merge "Revert "Don't initialize atrace if it's already disabled."" am: c50d19c0b0 am: 33d3758684
am: 006cd45c86

Change-Id: I1f9e10da302fdb6b0a427dae321551f8e3744f7a
2018-02-08 17:46:30 +00:00
Treehugger Robot
c50d19c0b0 Merge "Revert "Don't initialize atrace if it's already disabled."" 2018-02-08 17:27:41 +00:00
Paul Crowley
738adf7b46 Revert "Don't initialize atrace if it's already disabled."
This reverts commit e184423526.

Reason for revert: b/73081734
Bug: 73081734

Change-Id: I8ae835f5575292ebd3c4457ef26c2e8f98cfa11e
2018-02-08 00:49:37 +00:00
Mark Salyzyn
1e330b0376 Merge "libcutils: Add "daemon" and "bin" users for testing only" am: 718899b415 am: 2500e38093
am: 451ff596cf

Change-Id: Id2abde064963cbb68929c76ff5a47d4f52995190
2018-02-06 04:29:47 +00:00
Mark Salyzyn
8e8648463d libcutils: Add "daemon" and "bin" users for testing only
Multiple LTP tests require a "daemon" or "bin" user.  These user ids
have been defined since UNIX incept, and even up to the '80s remained
in many of the tools as hard coded values.  Add these two ids with
a cautionary note.

Test: compile
Bug: 31152327
Bug: 31226046
Bug: 32385889
Change-Id: Ida2fb6d817b8ada0624870439fcf848667b31fb3
2018-02-05 11:06:08 -08:00
Mark Salyzyn
eac8700cbb Merge "libcutils: test: increase use of ashmem_valid(fd)" am: dd218e6c84 am: 9f3a257536
am: 43f2c5cf38

Change-Id: I5e7b0994b76afbc60446518d08fe36dbf02f3fe5
2018-01-31 17:52:43 +00:00
Treehugger Robot
dd218e6c84 Merge "libcutils: test: increase use of ashmem_valid(fd)" 2018-01-31 17:35:29 +00:00
Paul Crowley
8645dd1204 Merge "Don't initialize atrace if it's already disabled." am: 0e239bbd8b am: 2fc40a6518
am: 65c685e204

Change-Id: I1ab9cff70cd461069f2db651ab96f449aae4666e
2018-01-30 22:14:34 +00:00
Paul Crowley
e184423526 Don't initialize atrace if it's already disabled.
For processes that start very early, atrace initialization can cause
an selinux denial, so make sure it's possible to disable it and avoid
the call to open "trace_marker".

Bug: 63927601
Test: disable atrace early in vold, ensure that selinux denial is
avoided.

Change-Id: I2422e6d0db323bc13c6d6ed1896435151fca21f7
2018-01-30 08:18:24 -08:00
Ruchi Kandoi
838c985416 Merge "Add AID for Secure Element Application" am: d3e7e31d28 am: 66c3eb0e45
am: f9ae0b10e0

Change-Id: I81e91a74c81a8e9854b1f4bab26ed03f033801c6
2018-01-26 20:02:54 +00:00
Mark Salyzyn
276758dab8 libcutils: test: increase use of ashmem_valid(fd)
There may be evidence of ashmem_valid(fd) reporting that the file
descriptor is an ashmem node.  Increase testing of ashmem_valid(fd),
reporting that the node _is_ ashmem, to inspire confidence in the
positive result.  Scan all file descriptors in the system, and for
those that pass ashmem_valid, get a non-zero size reference back.

Some clang-format-isms applied.

Test: libcutils-test --gtest_filter=AshmemTest.*
Bug: 72021458
Change-Id: I77d746b57a89a6afa1b829dddfdc4dd319f6b684
2018-01-26 09:50:57 -08:00
Ruchi Kandoi
d506c068d4 Add AID for Secure Element Application
Test: Test if the correct uid is assigned to the application
Change-Id: Ib0302a2e90ae89499ecbcebffa393bdd037adfbe
2018-01-25 18:21:53 +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
Yi Jin
31b506679b Add AID_STATSD and AID_INCIDENTD for statsd/incidentd daemons.
Test: manual
Change-Id: Id798519c3b0116529fc698e6b316a1c6b1c293ca
2018-01-09 14:17:50 -08:00
Treehugger Robot
f008571a4f Merge "libcutils: Stop checking the uid of netlink messages" 2018-01-09 17:35:31 +00:00
Treehugger Robot
affd4e9bd9 Merge "Use override_export_include_dirs." 2018-01-08 22:15:51 +00:00
Luis Hector Chavez
84c99136fd libcutils: Stop checking the uid of netlink messages
This is a partial revert of
https://android-review.googlesource.com/c/platform/system/core/+/528619.
The uid-check was done before
https://patchwork.kernel.org/patch/1525551/ was available, and thus is
now unnecessary to perform such check, since we can just rely on the
kernel patch now.

Bug: 71632076
Test: aosp_sailfish-userdebug still works

Change-Id: I1d1319b774483d1714ecb4dd838a20e055acc2a3
2018-01-08 13:24:32 -08:00
Jeff Sharkey
354417a7fb Allocate GID to use reserved disk space.
Filesystems allow the setting of the "resgid" parameter to designate
a GID that is allowed to use the "reserved" disk space (in addition
to UID 0).  We'll be granting this GID to critical system processes,
so that the system is usable enough for the user to free up disk
space used by abusive apps.

Test: builds, boots
Bug: 62024591
Change-Id: I2d166f3b730f0a3e7279fb40f12db7413c1dadad
2018-01-07 19:21:51 -07:00
Steven Moreland
e1c834db04 Use override_export_include_dirs.
Bug: 62878521
Test: soong build system finds renamed attribute
Change-Id: I51e42f4378db366b8711cd373fb835fecda88416
2018-01-05 14:42:12 -08:00
Elliott Hughes
579e682628 Add std::string StartsWith*/EndsWith* overloads.
We should have done this from the beginning. Thanks to Windows, we're not
going to be able to switch libbase over to std::string_view any time soon.

Bug: N/A
Test: ran tests
Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
2017-12-20 09:42:22 -08:00
Elliott Hughes
38d2567c9f Stop defining local "unused" macros now this is C++.
Bug: N/A
Test: builds, boots
Change-Id: I3eb075d5003fa7cdc6690f4af29a296e22be257c
2017-11-30 16:24:36 -08:00
Dan Willemsen
528f144e77 Fix / suppress new unused warnings for mingw+clang
Bug: 69933068
Test: mmma system/core
Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
2017-11-29 21:37:28 -08:00