Commit graph

960 commits

Author SHA1 Message Date
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
Elliott Hughes
347b67a8da Merge "Preserve errno better in native_handle functions." am: dd6e73f432 am: 4b6b4e02ed
am: d0c0d16b6a

Change-Id: I825b20ac4c9c3b0c6921a4469cf3091b0c811d9a
2017-05-03 01:12:40 +00:00
Elliott Hughes
dd6e73f432 Merge "Preserve errno better in native_handle functions." 2017-05-03 01:02:21 +00:00
Mark Salyzyn
9432fb8d8b libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate
am: fde19425f3

Change-Id: Id2d51a818161b8345332ecbac82784eea4d82dab
2017-05-02 21:07:11 +00:00
Mark Salyzyn
fde19425f3 libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate
(cherry picked from commit f0b53d0726)
(added "system/vendor/bin/hostapd" to list)

Cover both direct and symlink indirect paths to the referenced
files in the vendor, odm and oem partitions.

Test: compile and hand-verify properties
Bug: 37703469
Change-Id: I5b3a887e904baee2ac193ac4a73aaaee0bbfdb9f
2017-05-02 11:17:54 -07:00
Elliott Hughes
bf0492a9a1 Preserve errno better in native_handle functions.
So a caller of native_handle_clone can trust errno to be relevant.

Bug: http://b/37215366
Test: builds
Change-Id: I0992f38ad559db4a02fce07123842dbad8e3f473
2017-05-01 21:34:15 -07:00
Mark Salyzyn
d3f16131fa Merge "libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate" am: 43e9106410 am: 2eecd3ab99
am: c092331130

Change-Id: I992ad88cccd01fc4cbcfba10e011c299b669100b
2017-05-01 21:18:45 +00:00
Treehugger Robot
43e9106410 Merge "libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate" 2017-05-01 21:01:58 +00:00
Erik Staats
192c707bcc Merge "Change set_sched_policy to set slack for current thread." am: d6f8b5f2d4 am: fc6d71707a
am: 4696b4110b

Change-Id: Ibf5a664e1232cefceeceb9a31c90ea47fe686b77
2017-05-01 18:57:10 +00:00
Erik Staats
d6f8b5f2d4 Merge "Change set_sched_policy to set slack for current thread." 2017-05-01 18:35:30 +00:00
Mark Salyzyn
f0b53d0726 libcutils: fs_config.c mark vendor, odm and oem partitions in duplicate
Cover both direct and symlink indirect paths to the referenced
files in the vendor, odm and oem partitions.

Test: compile and hand-verify properties
Bug: 37703469
Change-Id: I5b3a887e904baee2ac193ac4a73aaaee0bbfdb9f
2017-05-01 16:17:31 +00:00
Elliott Hughes
09e55b9155 Merge "Remove unused cruft from <cutils/bitops.h>." am: 4c8acafa25 am: 024a51bdc8
am: e19f4abd7b

Change-Id: Ic3b3f6f99c3dfbad02ff59789d9aac717eb3da0f
2017-04-30 02:53:31 +00:00
Elliott Hughes
4c8acafa25 Merge "Remove unused cruft from <cutils/bitops.h>." 2017-04-30 02:45:46 +00:00
Elliott Hughes
0e8810ccbe Remove unused cruft from <cutils/bitops.h>.
Bug: N/A
Test: builds
Change-Id: I5931f2b91b2d64d8e26f9ba092879c14d0ed3622
2017-04-29 10:22:40 -07:00
Randy Pan
f7e92a235f Merge "Revert "Remove capability setting for legacy_wifi_hal"" into oc-dev
am: df54d0efc3

Change-Id: I631cc474f74c51f2de08d00b774f0d6c32818b5c
2017-04-27 03:50:45 +00:00
Randy Pan
b8f707d641 Revert "Remove capability setting for legacy_wifi_hal"
This reverts commit faf317b7e9.

Bug: 37713566
Test: Able to connect to GoogleGuest on Fugu
2017-04-26 18:24:48 -07:00
Erik Staats
d32331fb27 Change set_sched_policy to set slack for current thread.
Change set_sched_policy to use prctl PR_SET_TIMERSLACK if setting the policy
for the current thread and /proc/<tid>/timerslack_ns is not supported by the
kernel.

Bug: 32972117
Test: Verified that libcutils SchedPolicy tests pass.  See details in
testing done comment in
https://android-review.googlesource.com/381303 .
Change-Id: Id70940ed7f9ed94c3d105213f069bf3e5a8d8824
2017-04-26 15:39:26 -07:00
Philip Cuadra
1c268a86a1 Allow Bluetooth HAL CAP_SYS_NICE
The Bluetooth HAL has threads that process Bluetooth audio.  They need
to be scheduled as RT priority, so allow the Bluetooth HAL to set its
threads to RT scheduling.

Bug 37518404
Test:  play Bluetooth audio, confirm priority via systrace
Merged-In: I4928cf182a0805c0714e4d073cba15c864fbe328
Change-Id: I4928cf182a0805c0714e4d073cba15c864fbe328

(cherry picked from commit e08303d8cf)
2017-04-26 11:53:13 -07:00
Philip Cuadra
81898b6ffe Merge "Allow Bluetooth HAL CAP_SYS_NICE" am: 1ac29896b0 am: adecf17de6
am: fb66ad7df4

Change-Id: Ida2eced4f78292df5886a3c35c9d2230db3da613
2017-04-26 17:10:47 +00:00
Philip Cuadra
1ac29896b0 Merge "Allow Bluetooth HAL CAP_SYS_NICE" 2017-04-26 16:56:00 +00:00
Erik Staats
548c87d55d Merge "Change get_sched_policy to check "schedtune" and "cpuset"." am: e74ecbfddd am: b81797446d
am: c023a8bcd8

Change-Id: I3993a7279e8dec1abf1aedd1e66db63fbadd59b3
2017-04-26 16:50:35 +00:00
Randy Pan
9ff5e014bd Merge "Remove capability setting for legacy_wifi_hal" into oc-dev
am: 8ed2e54ce5

Change-Id: I730d7d2f8da7c07981f08a284ea3c2e0f1344d05
2017-04-25 17:20:58 +00:00
Randy Pan
8ed2e54ce5 Merge "Remove capability setting for legacy_wifi_hal" into oc-dev 2017-04-25 16:59:38 +00:00
Erik Staats
b4c4654c7c Change get_sched_policy to check "schedtune" and "cpuset".
get_sched_policy will first attempt to get the policy from the "schedtune"
subsystem cgroup and, if not set, attempt to get the policy from the
"cpuset" subsystem cgroup.  If neither subsystem has a cgroup set,
SP_FOREGROUND is returned.

Bug: 32972117
Test: Verified that SchedPolicy libcutils test passes and that ps displays
the expected policies.  See details in testing done comment in
https://android-review.googlesource.com/379426 .

Change-Id: I586a921a38eea99d65590b07ece96c9808a2e56d
2017-04-25 15:26:53 +00:00
Philip Cuadra
e08303d8cf Allow Bluetooth HAL CAP_SYS_NICE
The Bluetooth HAL has threads that process Bluetooth audio.  They need
to be scheduled as RT priority, so allow the Bluetooth HAL to set its
threads to RT scheduling.

Bug 37518404
Test:  play Bluetooth audio, confirm priority via systrace
Change-Id: I4928cf182a0805c0714e4d073cba15c864fbe328
2017-04-24 17:59:20 -07:00
Randy Pan
faf317b7e9 Remove capability setting for legacy_wifi_hal
It's now specified in the hal .rc file.

Bug: 37105075
Bug: 37483427
Test: Wifi HAL runs on Fugu and Pixel.
Change-Id: Iead8d4146a794cf9afbaa06a60e9f269ddc425af
2017-04-24 10:48:18 -07:00
Lorenzo Colitti
a66d1bcd0e Merge "Revert "Make the xtables lock readable only by AID_RADIO and root."" into oc-dev 2017-04-22 04:36:48 +00:00
Lorenzo Colitti
20d9068e00 Merge "Revert "Make the xtables lock readable only by AID_RADIO and root."" am: d272ca38f6 am: aaa2b30d5c
am: 87f9ffdac7

Change-Id: I8161bd5fd129e7eb8fc1644400a259ae96c2a0aa
2017-04-22 04:33:50 +00:00
Lorenzo Colitti
50e244b203 Revert "Make the xtables lock readable only by AID_RADIO and root."
This reverts commit 5e801e7bd5.

The file permissions don't allow access to the lock on devices
where vendor code runs with UID root and GID radio. They are
no longer necessary because we have a more flexible selinux-based
solution in https://android-review.googlesource.com/#/c/354223/ .

Test: strace -f -e flock -p <netmgrd_pid> on angler shows flock succeeds
Test: strace -f -e flock -p <netmgrd_pid> on marlin shows flock succeeds
Test: netd_unit_test passes on marlin
Test: strace -f -e flock -p <netd_pid> on marlin shows flock succeeds
Bug: 36108349
Bug: 37483189

(cherry picked from commit b6e4b35fe4)

Change-Id: Ia1bbf8d93ec6777514be66cbd1a32dfc95df95c0
Merged-In: Ia1bbf8d93ec6777514be66cbd1a32dfc95df95c0
2017-04-22 01:48:05 +09:00
Lorenzo Colitti
b6e4b35fe4 Revert "Make the xtables lock readable only by AID_RADIO and root."
This reverts commit 5e801e7bd5.

The file permissions don't allow access to the lock on devices
where vendor code runs with UID root and GID radio. They are
no longer necessary because we have a more flexible selinux-based
solution in https://android-review.googlesource.com/#/c/354223/ .

Test: strace -f -e flock -p <netmgrd_pid> on angler shows flock succeeds
Test: strace -f -e flock -p <netmgrd_pid> on marlin shows flock succeeds
Test: netd_unit_test passes on marlin
Test: strace -f -e flock -p <netd_pid> on marlin shows flock succeeds
Bug: 36108349
Bug: 37483189
Change-Id: Ia1bbf8d93ec6777514be66cbd1a32dfc95df95c0
2017-04-21 16:41:35 +00:00
Steven Moreland
2bd4342234 Remove VNDK warning.
Added todo once usages are fixed.

Bug: 33241851
Test: things with -Werror now compile in VNDK
(cherry picked from commit 81626e48cb)
Merged-In: I6c4a148dca4d4710912fe62a8854cb8077651701
Change-Id: I6c4a148dca4d4710912fe62a8854cb8077651701
2017-04-19 10:32:49 -07:00
Steven Moreland
385fe692cc libcutils: vendor_available
By setting vendor_available, the following may become true:

* a prebuilt library from this release may be used at runtime by
  in a later releasse (by vendor code compiled against this release).
  so this library shouldn't depend on runtime state that may change
  in the future.
* this library may be loaded twice into a single process (potentially
  an old version and a newer version). The symbols will be isolated
  using linker namespaces, but this may break assumptions about 1
  library in 1 process (your singletons will run twice).

Background:

This means that these modules may be built and installed twice --
once for the system partition and once for the vendor partition. The
system version will build just like today, and will be used by the
framework components on /system. The vendor version will build
against a reduced set of exports and libraries -- similar to, but
separate from, the NDK. This means that all your dependencies must
also mark vendor_available.

At runtime, /system binaries will load libraries from /system/lib*,
while /vendor binaries will load libraries from /vendor/lib*. There
are some exceptions in both directions -- bionic(libc,etc) and liblog
are always loaded from /system. And SP-HALs (OpenGL, etc) may load
/vendor code into /system processes, but the dependencies of those
libraries will load from /vendor until it reaches a library that's
always on /system. In the SP-HAL case, if both framework and vendor
libraries depend on a library of the same name, both versions will be
loaded, but they will be isolated from each other.

It's possible to compile differently -- reducing your source files,
exporting different include directories, etc. For details see:

https://android-review.googlesource.com/368372

None of this is enabled unless the device opts into the system/vendor
split with BOARD_VNDK_VERSION := current.

Bug: 36426473
Bug: 36079834
Test: m -j libcutils
Test: attempt to compile with BOARD_VNDK_VERSION := current
Test: (sanity) boot internal marlin
(cherry picked from commit 9610c548a8)
Merged-In: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
Change-Id: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
2017-04-19 10:32:45 -07:00
Treehugger Robot
edaed3ed7a Merge "Allocate a GID range for external cache files." 2017-04-18 22:34:16 +00:00
Jeff Sharkey
0996bb87f4 Merge "Allocate a GID range for external cache files." into oc-dev
am: 1d9f6d9c24

Change-Id: I04e3f528298b6e198812d8701b7dc9477988f46a
2017-04-18 20:13:39 +00:00
TreeHugger Robot
1d9f6d9c24 Merge "Allocate a GID range for external cache files." into oc-dev 2017-04-18 20:03:22 +00:00
Steven Moreland
ed08b90e48 Merge "Remove VNDK warning." into oc-dev
am: ca243f2fcb

Change-Id: I19e120f593dc4a6ee7cea76b78a676ee3f71fb70
2017-04-17 23:19:42 +00:00
Steven Moreland
fc5d4345fa Merge "libcutils: compile with BOARD_VNDK_VERSION current" into oc-dev
am: 64639fd7dc

Change-Id: Ic30e207a89cf80f6f509f64f92ec9ee32cfaf3c1
2017-04-17 23:19:28 +00:00
Steven Moreland
deeb5eb8fb libcutils: vendor_available
am: 9610c548a8

Change-Id: I504b4f52357fa3580e9154291021b57c07bd8b02
2017-04-17 23:19:14 +00:00
TreeHugger Robot
ca243f2fcb Merge "Remove VNDK warning." into oc-dev 2017-04-17 23:07:43 +00:00
TreeHugger Robot
64639fd7dc Merge "libcutils: compile with BOARD_VNDK_VERSION current" into oc-dev 2017-04-17 23:07:38 +00:00
Steven Moreland
d73be1b96b libcutils: compile with BOARD_VNDK_VERSION current
- moved __android_log_is_debuggable to a new public header
    (log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
  to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
  now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

(cherry picked from commit 1f83aa424f)

Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
2017-04-17 14:44:17 -07:00
Jeff Sharkey
bd2ecd8e6d Allocate a GID range for external cache files.
We can't reuse the GID range for internal cache files, otherwise
we don't have a way to tease apart the difference when deciding if
it's safe to move apps.

Test: builds, boots
Bug: 37193650
Change-Id: I22c4e575cd557636e74c5c73035adb1d4dcbb7f7
2017-04-17 14:59:51 -06:00
Jeff Sharkey
fa16473921 Allocate a GID range for external cache files.
We can't reuse the GID range for internal cache files, otherwise
we don't have a way to tease apart the difference when deciding if
it's safe to move apps.

Test: builds, boots
Bug: 37193650
Change-Id: I22c4e575cd557636e74c5c73035adb1d4dcbb7f7
2017-04-17 14:50:27 -06:00
Steven Moreland
81626e48cb Remove VNDK warning.
Added todo once usages are fixed.

Bug: 33241851
Test: things with -Werror now compile in VNDK
Change-Id: I6c4a148dca4d4710912fe62a8854cb8077651701
2017-04-17 13:48:28 -07:00
Steven Moreland
9610c548a8 libcutils: vendor_available
By setting vendor_available, the following may become true:

* a prebuilt library from this release may be used at runtime by
  in a later releasse (by vendor code compiled against this release).
  so this library shouldn't depend on runtime state that may change
  in the future.
* this library may be loaded twice into a single process (potentially
  an old version and a newer version). The symbols will be isolated
  using linker namespaces, but this may break assumptions about 1
  library in 1 process (your singletons will run twice).

Background:

This means that these modules may be built and installed twice --
once for the system partition and once for the vendor partition. The
system version will build just like today, and will be used by the
framework components on /system. The vendor version will build
against a reduced set of exports and libraries -- similar to, but
separate from, the NDK. This means that all your dependencies must
also mark vendor_available.

At runtime, /system binaries will load libraries from /system/lib*,
while /vendor binaries will load libraries from /vendor/lib*. There
are some exceptions in both directions -- bionic(libc,etc) and liblog
are always loaded from /system. And SP-HALs (OpenGL, etc) may load
/vendor code into /system processes, but the dependencies of those
libraries will load from /vendor until it reaches a library that's
always on /system. In the SP-HAL case, if both framework and vendor
libraries depend on a library of the same name, both versions will be
loaded, but they will be isolated from each other.

It's possible to compile differently -- reducing your source files,
exporting different include directories, etc. For details see:

https://android-review.googlesource.com/368372

None of this is enabled unless the device opts into the system/vendor
split with BOARD_VNDK_VERSION := current.

Bug: 36426473
Bug: 36079834
Test: m -j libcutils
Test: attempt to compile with BOARD_VNDK_VERSION := current
Test: (sanity) boot internal marlin
Change-Id: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d
2017-04-17 12:39:26 -07:00
Steven Moreland
1f83aa424f libcutils: compile with BOARD_VNDK_VERSION current
- moved __android_log_is_debuggable to a new public header
    (log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
  to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
  now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
2017-04-17 12:18:36 -07:00
Josh Gao
368e043a7b adb: don't try to resolve 'localhost' am: 46de1d7f03 am: 32d7ede78b
am: 677a73e5f1

Change-Id: I3e939fbea6cb3f3b7cf36040a81655d5ef0acae2
2017-04-14 20:14:26 +00:00
Josh Gao
32d7ede78b adb: don't try to resolve 'localhost'
am: 46de1d7f03

Change-Id: Ie419c5ddd80938760d7eaa3f50605c9874ca33d7
2017-04-14 20:07:56 +00:00
Josh Gao
0301b3217b Merge changes from topics 'adb_thread', 'adb_loopback'
* changes:
  adb: statically link libbase into the tests.
  adb: kill adb_thread_{create, join, detach, exit}.
  adb: don't try to resolve 'localhost'
2017-04-14 20:04:04 +00:00
Josh Gao
46de1d7f03 adb: don't try to resolve 'localhost'
Misconfigured systems can have localhost pointing to an address that
isn't 127.0.0.1 or ::1.

adb is the only caller of the libcutils socket_loopback functions, so
move them into adb and switch the implementations over to using
INADDR_LOOPBACK and in6addr_loopback, instead of resolving 'localhost'
when connecting.

Bug: http://b/37282612
Test: `killall adb; adb shell`
Test: `killall adb; ip addr del 127.0.0.1/8 dev lo; adb shell`
Change-Id: I01c1885f1d9757ad0f7b353dd04b4d1f057741c8
2017-04-12 16:07:49 -07:00
Elliott Hughes
f9a0c78fe0 Merge "libcutils: fix system-background tasks shown in top command" am: e4e4777fc7 am: 48eaef5804
am: 7c44e1ffd2

Change-Id: I5e257bb30006b4a390eb347082c1fd3a0f2a7b1c
2017-04-12 18:57:46 +00:00
Ganesh Mahendran
6748f24d70 libcutils: fix system-background tasks shown in top command
tasks in system-background cgroup will be shown as below:
 580   580 system   12  -8   1% S 190656K  19408K unk surfaceflinger  /system/bin/surfaceflinger

This patch fix this issue.

Change-Id: Ib39ff892010498548d7fbfb4021df62498acd033
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
2017-04-12 16:25:25 +08:00
Mark Salyzyn
ffa763208b libcutils: fs_config: target_out_path assumed /system breaking partitions
(cherry picked from commit 6e9cb8fd79)

Strip off trailing / then /system and then add back the appropriate
config directory.  This fixes an issue with reading vendor, oem or odm
partitions.

Test: manual build successfully interprets all etc/fs_config_* files.
Test: manual incremental build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: Iba363f0731bb8d15e595bb45c56db97722edabc2
2017-04-10 19:32:11 +00:00
Mark Salyzyn
a53b83c2f4 libcutils: create private/fs_config.h
(cherry picked from commit a9403f0db8)

private/fs_config.h is required in order to build an independent
test that requires internal binary knowledge of the
etc/fs_config_(files|dirs) files.

Test: compile
Bug: 36071012
Change-Id: I268bcfdbb6d45b7bf6040cbf307a4e34812f5fef
2017-04-10 15:26:43 +00:00
Mark Salyzyn
e83bb3707a Merge "libcutils: fs_config: target_out_path assumed /system breaking partitions" am: e800b97c46 am: 0c7f2287aa
am: d98968eeda

Change-Id: Ie2624cba34872dfaa60e2e44c26c82cc766af2b3
2017-04-07 20:51:15 +00:00
Mark Salyzyn
6e9cb8fd79 libcutils: fs_config: target_out_path assumed /system breaking partitions
Strip off trailing / then /system and then add back the appropriate
config directory.  This fixes an issue with reading vendor, oem or odm
partitions.

Test: manual build successfully interprets all etc/fs_config_* files.
Test: manual incremental build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: Iba363f0731bb8d15e595bb45c56db97722edabc2
2017-04-07 10:29:51 -07:00
Thierry Strudel
9c2029b1d0 Merge "Revert "libcutils: fs_config: target_out_path assumed /system"" am: ad90763ab9 am: bb1c8f3691
am: b00ea15291

Change-Id: If19838bebcf272599acd8d31b27c1cb6672bdba4
2017-04-07 02:16:59 +00:00
Thierry Strudel
29e0c8f1a9 Revert "libcutils: fs_config: target_out_path assumed /system"
This reverts commit 7130fb345d.

Bug: 36816191
Change-Id: I7d604d510865b1fa15781ffb4ad8b3e77ac44395
2017-04-07 00:34:03 +00:00
Mark Salyzyn
a74b51ebaf Merge "libcutils: fs_config: target_out_path assumed /system" am: 66b8491719 am: 27c796b2f7
am: 8ebacb43c5

Change-Id: I9c744e8daa966649c25b8d529512db8dc512c749
2017-04-06 00:20:39 +00:00
Mark Salyzyn
7130fb345d libcutils: fs_config: target_out_path assumed /system
Strip off /system/ and add appropriate config directory.

Test: manual build successfully interprets all etc/fs_config_* files.
Bug: 36071012
Change-Id: I2563248e91cea10fef3cc2f9e954e4782fdfce4f
2017-04-05 22:32:22 +00:00
Dan Shi
d2cee19333 Merge "Add test config to libcutils_test" am: c1c0de3945 am: 0b842b37f6
am: 6a5c28d5af

Change-Id: Ia86da758ddabdff2126de7758a5ad98a98802d31
2017-04-05 06:47:34 +00:00
Treehugger Robot
c1c0de3945 Merge "Add test config to libcutils_test" 2017-04-05 06:39:42 +00:00
Mark Salyzyn
2871101550 Merge "libcutils: create private/fs_config.h" am: 832f6c704a am: f8e1b8005b
am: 76a2b68d77

Change-Id: I5193f3ee61989e6f8ab9e9f1242fff508f3576b5
2017-04-04 20:21:37 +00:00
Mark Salyzyn
a9403f0db8 libcutils: create private/fs_config.h
private/fs_config.h is required in order to build an independent
test that requires internal binary knowledge of the
etc/fs_config_(files|dirs) files.

Test: compile
Bug: 36071012
Change-Id: I268bcfdbb6d45b7bf6040cbf307a4e34812f5fef
2017-04-04 19:14:32 +00:00
Jeff Sharkey
ca7326b175 Merge "Revert "Allocate GID to use reserved disk space."" am: 7c06d2c79a am: fc2ead70cd
am: 02a8ac95e1

Change-Id: I6d7dc25257c3c49c357d76063baf52bb16b741b1
2017-04-03 15:27:49 +00:00
Jeff Sharkey
d185445eee Revert "Allocate GID to use reserved disk space."
This reverts commit 82f8bb785e.

Sadly, we'd have to extend CAP_SYS_RESOURCE to a bunch of execution
domains to make this work, which isn't feasible.

Bug: 36450358
Change-Id: Iffe88e45d538c044382eb0d0ac24ff11a10d73c3
2017-04-03 04:00:36 +00:00
Jeff Sharkey
a13bbe5f4e Merge "Allocate GID to use reserved disk space." am: 145e185ddb am: 3afe2fc987
am: 211093ce82

Change-Id: If332325d475225f1ccf5b980b39f83b64e452b60
2017-04-01 01:42:21 +00:00
Dan Shi
2c67dfbc09 Add test config to libcutils_test
This change allows TradeFederation to run the test directly.
Refer to b/35882476 for design and discussion of this change.

Bug: 35882476
Test: local test
tradefed.sh run template/local --template:map test=libcutils_test

Change-Id: Ie083d1641e4ea226cbf7b82c6fd2c115e15b6bf6
2017-03-31 17:12:18 -07:00
Jeff Sharkey
82f8bb785e Allocate GID to use reserved disk space.
Filesystems like ext4 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 apps.

Test: builds
Bug: 36450358
Change-Id: I224bd1e597130edb411a1528872faff1ada02a89
2017-03-31 16:39:45 -06:00
Dan Shi
224cc80862 Merge "Add test config to libcutils_test_static" am: c65f842cd1 am: ad6c88f108
am: 838b61c11f

Change-Id: I9807d9ddda80ea8c57db07d01bae5d6ecfa142c1
2017-03-30 18:32:54 +00:00
Dan Shi
d8f533aab2 Add test config to libcutils_test_static
Design doc:
Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap
https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
Change-Id: I9faa1c929fff43635aff06b4228501e1227c4d06
2017-03-29 23:13:08 -07:00
Wei Wang
57474bcbc2 libcutils: remove sched_set/getscheduler
am: bc41166d56

Change-Id: I5e18fdc4baf128ee4edfa83edfc4e4be585af9b4
2017-03-28 21:03:59 +00:00
Wei Wang
bc41166d56 libcutils: remove sched_set/getscheduler
Bug: 36667354
Test: angler taking video
Change-Id: Ic077d856212c48610a0587c60d1186090166da2b
(cherry-picked from a8d59faa75)
2017-03-28 20:19:16 +00:00
Wei Wang
a8d59faa75 libcutils: remove sched_set/getscheduler
Bug: 36667354
Test: angler taking video
Change-Id: Ie7fbcccbd02314468c03317319574ee7e433561d
2017-03-28 13:01:20 -07:00
Mark Salyzyn
7de072bcb5 Merge "libcutils: handle root directory empty path" am: 6105dbd01b am: 621ae033a4
am: a31d895910

Change-Id: Icd4d70fecb09e26b9de45621e910f2d9dbec8d07
2017-03-28 17:27:30 +00:00
Jeremy Compostella
3d642d48e2 libcutils: handle root directory empty path
Usually, the canned paths lack the leading '/' which means that the
root directory is an empty path.  This patch makes
load_canned_fs_config() handle this empty path as the root directory.
It also make it flexible enough to handle an optional leading '/'.

Original-Author: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Gaelle Nassiet <gaellex.nassiet@intel.com>
Change-Id: Ice759ef37d1df23a54df1158ec0d3ad7f577a069
2017-03-28 14:57:22 +00:00
Wei Wang
d04ab5abfb Merge "libcutils: remove schedgroup" am: 3d8911fbbe am: c0fc8e7b7b
am: eb6d588cd6

Change-Id: I0a088c378ade4c3eccc338eb4d7a5b5894b5bfbc
2017-03-28 00:28:25 +00:00
Wei Wang
40267986da libcutils: remove schedgroup
After removing bg_non_interactive cgroup, there is only a ROOT cgroup.
This CL removes the no-op trying to set cgroup.
It also removes the attempt to open non-exist bg_non_interactive cgroup.

Bug: 36649832
Test: marlin boosts and cgroup ROOT task looks normal
Change-Id: Ibccd6db1499306174c940aec9219b20c1b86173d
2017-03-27 11:57:29 -07:00
Lorenzo Colitti
db3d45fa48 Merge "Make the xtables lock readable only by AID_RADIO and root." am: 438720ac2c am: 82cf4caaaa
am: bc918e922e

Change-Id: Icb129aaa1998632b6fffde4802a123b6bee9a26a
2017-03-24 06:34:51 +00:00
Lorenzo Colitti
438720ac2c Merge "Make the xtables lock readable only by AID_RADIO and root." 2017-03-24 06:25:38 +00:00
Mark Salyzyn
02842f2138 Merge "libcutils: fs_config() add check /odm/etc/fs_config_*" am: 1e62880f70 am: e1d2e3436e
am: cdbdf087bd

Change-Id: Ia4c97d29b9813c4ee233b0d62397f11bd79fb020
2017-03-23 20:05:44 +00:00
Mark Salyzyn
2b616cea9e libcutils: fs_config() add check /odm/etc/fs_config_*
Add reading of vendor file-system config files
/odm/etc/fs_config_dirs and /odm/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- /oem/etc/fs_config_dirs or /oem/etc/fs_config_files
- /odm/etc/fs_config_dirs or /odm/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the odm file-system config files,
although the developer is advised to restrict the scope to the /odm
file-system since the intent is to provide support only for
customized portions of odm.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: Ic3afb5bb4ea20b15bd5df728be9f16045bf5b039
2017-03-22 15:28:40 -07:00
Keun-young Park
02354ed37b Merge "remove emergency shutdown and improve init's reboot logic" am: 437dc91fa3 am: f803be004a
am: 9766c9ff31

Change-Id: Ifeb00b8356272e831a167e3cc7ebba30bf7134f8
2017-03-22 20:23:34 +00:00
Treehugger Robot
437dc91fa3 Merge "remove emergency shutdown and improve init's reboot logic" 2017-03-22 20:13:43 +00:00
Vijay Venkatraman
39958cb6e8 Merge "Moved include/android_filesystem_*.h and canned_fs_config.h to libcutils" am: a4bc98941a am: c0c4aeb556
am: 3286d2d0d2

Change-Id: I203baad63ece6cb9b223018a8664d625a6a5046d
2017-03-22 18:36:06 +00:00
Keun-young Park
8d01f63f50 remove emergency shutdown and improve init's reboot logic
- Emergency shutdown just marks the fs as clean while leaving fs
  in the middle of any state. Do not use it anymore.

- Changed android_reboot to set sys.powerctl property so that
  all shutdown can be done by init.

- Normal reboot sequence changed to
    1. Terminate processes (give time to clean up). And wait for
      completion based on ro.build.shutdown_timeout.
        Default value (when not set) is changed to 3 secs. If it is 0, do not
        terminate processes.
    2. Kill all remaining services except critical services for shutdown.
    3. Shutdown vold using "vdc volume shutdown"
    4. umount all emulated partitions. If it fails, just detach.
       Wait in step 5 can handle it.
    5. Try umounting R/W block devices for up to max timeout.
      If it fails, try DETACH.
      If umount fails to complete before reboot, it can be detected when
      system reboots.
    6. Reboot

- Log shutdown time and umount stat to log so that it can be collected after reboot

- To umount emulated partitions, all pending writes inside kernel should
  be completed.
- To umount /data partition, all emulated partitions on top of /data should
  be umounted and all pending writes should be completed.
- umount retry will only wait up to timeout. If there are too many pending
  writes, reboot will discard them and e2fsck after reboot will fix any file system
  issues.

bug: 36004738
bug: 32246772

Test: many reboots combining reboot from UI and adb reboot. Check last_kmsg and
      fs_stat after reboot.

Change-Id: I6e74d6c68a21e76e08cc0438573d1586fd9aaee2
2017-03-22 11:23:31 -07:00
Lorenzo Colitti
5e801e7bd5 Make the xtables lock readable only by AID_RADIO and root.
Anyone who can read this file can call flock(..., LOCK_EX) on it,
thereby blocking any future iptables commands from running.
Restrict it to user AID_RADIO, which includes device-specific
network management daemons, and group root.

Bug: 36108349
Test: see https://android-review.googlesource.com/#/c/348939/
Change-Id: I4dae4b5a835fabdc1a61a330e0446b39651f8156
2017-03-22 17:03:19 +09:00
Vijay Venkatraman
d4e2386057 Moved include/android_filesystem_*.h and canned_fs_config.h to libcutils
Bug: 33241851
Test: No changes needed for modules not using VNDK.
For VNDK, enable BOARD_VNDK_VERSION in BoardConfig.mk
and add libcutils to modules that need these headers.

Change-Id: I6102778aab35ed26a5ddde11230502dcd4edc852
2017-03-21 17:34:58 -07:00
Wei Wang
c0049c073b Merge changes from topic 'remove_bg_cgroup' am: e941c5fa41 am: 857e716f3e
am: 5e06a34e03

Change-Id: I5ec71f69c6629ad24a8f26be58a85c299c2491dd
2017-03-22 00:34:43 +00:00
Treehugger Robot
e941c5fa41 Merge changes from topic 'remove_bg_cgroup'
* changes:
  libcutils: only change cgroup when fd is initialized
  init.rc: remove bg_non_interactive cgroup
2017-03-21 22:09:51 +00:00
Mark Salyzyn
9e16f964fe Merge "libcutils: fs_config() add check /oem/etc/fs_config_*" am: c530045850 am: 6b5913a8b6
am: 8876fffd08

Change-Id: I07ea126a8fae279e888322c88a400d38aad3f381
2017-03-21 18:41:11 +00:00
Mark Salyzyn
74b0b50bbe Merge changes I4077bd6a,I92c4090e,Iff579600 am: e9539eb02f am: 122310429f
am: c232220ff0

Change-Id: I60b0aa1f9c5dba88426fefbc415366d507aeacf6
2017-03-21 17:02:03 +00:00
Mark Salyzyn
62c701e174 libcutils: fs_config() add check /oem/etc/fs_config_*
Add reading of vendor file-system config files
/oem/etc/fs_config_dirs and /oem/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- /oem/etc/fs_config_dirs or /oem/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the oem file-system config files,
although the developer is advised to restrict the scope to the /oem
file-system since the intent is to provide support only for
customized portions of oem.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I56f3fed5efa44d622a9a110937dbc949083d44ae
2017-03-21 08:15:58 -07:00
Mark Salyzyn
9ceadcb0c4 libcutils: fs_config() add check /vendor/etc/fs_config_*
Add reading of vendor file-system config files
/vendor/etc/fs_config_dirs and /vendor/etc/fs_config_files.

Order of interpretation (for dirs and files respectively):
- /system/etc/fs_config_dirs or /system/etc/fs_config_files
- /vendor/etc/fs_config_dirs or /vendor/etc/fs_config_files
- internal android_dirs[] or android_files[] structures.

No restrictions are placed on the vendor file-system config files,
although the developer is advised to restrict the scope to the /vendor
file-system since the intent is to provide support only for
customized portions of vendor.img.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I4077bd6afcda2ee16189b2eb3c322af15205bbb9
2017-03-21 08:14:42 -07:00
Mark Salyzyn
a45eae93f6 libcutils: fs_config: sort files
Sort android_files[] first by requirements, grouping, specificity and
finally by alphanumeric order.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I92c4090eac0067e0327ac7c8dde229747893d585
2017-03-21 08:14:42 -07:00
Mark Salyzyn
c4f9f4c216 libcutils: fs_config: sort dirs
Sort android_dirs[] first by requirements, grouping, specificity and
finally by alphanumeric order.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: Iff579600b05d7b2a0b9fc7d9e9d897e0bb69aebd
2017-03-21 08:14:42 -07:00
Mark Salyzyn
02d5aa9c4b Merge "libcutils: fs_config.c code compliance" am: b501400a76 am: 679942bf0d
am: a02ef7ca54

Change-Id: I30352abb637c8410c94650a9f03d41a12d0595c8
2017-03-21 15:00:54 +00:00
Wei Wang
97957fc420 libcutils: only change cgroup when fd is initialized
This is to avoid failues on setting non-exist cgroup

Bug: 34193533
Test: on marlin
Change-Id: I619dcba332fda9ec421df811745cf10311beddd3
2017-03-20 22:13:22 -07:00
Mark Salyzyn
166e24c91b libcutils: fs_config.c code compliance
Comply with clang-format. Adjust some comments.

Test: full build and install smoke test and inspection
Bug: 36071012
Change-Id: I459a08b4dc4333ab3d75207621a27587849386a5
2017-03-20 15:32:11 -07:00
Todd Poynor
e63f366ee3 android_reboot: move reboot reason file to data/misc/reboot/
Move last reboot reason file to new directory data/misc/reboot/ to
require only SELinux permissions specific to this new file.

Bug: 30994946
Test: manual: reboot command, setprop sys.powerctl
Change-Id: I1e067235aa4b06391cff8ab0741a9d317ba5b7da
2017-03-17 17:27:36 -07:00