Commit Graph

2150 Commits

Author SHA1 Message Date
Peter Collingbourne 563ca38154 Link the sanitizer runtime libraries to the default unrestricted namespace.
Without this, binaries can't be run out of /data/local/tmp on a HWASANified
device.

Test: Chromium's /data/local/tmp/md5sum/md5sum_bin works on walleye_hwasan-userdebug
Change-Id: Ieceaab8aae0024864022ca42b38aa36e6212cf31
2019-06-13 18:50:46 -07:00
Min Yun d695733df9 Add libcgrouprc to ld.config.txt.
- In GSI, media.extractor has follow dependency.
media.extractor -> libmpeg2extractor (media ns) ->
libprocessgroup (media ns) -> libcgrouprc (default ns).
If libcgroupsrc can't link from libmpeg2extractor, media.extractor is crashed.

Test: media.extractor didn't die.
Bug: 134981805
Change-Id: I7d3e7e6477708a505b87a884e05cd719f5a3d496
2019-06-12 11:19:59 +09:00
Neil Fuller e59703319f Merge "Switch tzdatacheck to comparing tzdata module file" 2019-06-10 17:40:51 +00:00
Neil Fuller 09bdb325a7 Switch tzdatacheck to comparing tzdata module file
The old "time zone updates via APK" feature installs time zone data
files in /data. tzdatacheck is run during boot to guard against an
OTA leaving the data in /data older, or in a different format, than the
files that exist elsewhere on device. If such files existed the system
could use old versions of tzdb (and related) data or even end up
unstable.

Soon, the time zone data mainline module will be made "functionally
mandatory" by the removal of most time zone data files from the
runtime module APEX, i.e. the time zone data module cannot be absent,
and the runtime module won't have files to compare against.

This change modifies the command line args for tzdatacheck to reference
the contents of time zone data module instead of the runtime module.

Bug: 132168458
Test: Build / boot / inspect logcat
Change-Id: Iac8023b7cbb72213df344d603c121caa867a196f
2019-06-10 11:02:44 +00:00
Tom Cherry acf19e8031 Merge "init.rc: move rlimit setting earlier" 2019-06-07 15:59:40 +00:00
Tom Cherry fdeca99c4b init.rc: move rlimit setting earlier
There is no reason that rlimits cannot be set earlier than they are,
and apexd-bootstrap may want to set the priority service option, which
would require that these rlimits have been set, so we move these to
the beginning of early-init.

Bug: 134668377
Test: apexd-bootstrap can set the priorty service option
Change-Id: I8040190cd4dc5e141784496ae65cfab80d9cad53
2019-06-06 18:18:14 +00:00
Martin Stjernholm 0d28abc5b1 Update TODOs for ICU library links.
Test: Presubmit boot test
Bug: 120786417
Bug: 134659294
Change-Id: I362e0e67c5adfd510dda12bed52629af92bfcc3d
2019-06-06 14:11:04 +01:00
Peter Collingbourne 3e48b66578 Merge "Link the "runtime" namespace to more namespaces." 2019-05-21 02:29:46 +00:00
vichang de725e6e75 Merge "Allow linking to libicuuc.so and libicui18n.so from executable in /data" 2019-05-20 09:49:21 +00:00
Victor Chang 0c7edece94 Allow linking to libicuuc.so and libicui18n.so from executable in /data
Executable in /data/ runs in default linker namespace, not
classloader namespace.
In Q, we moved libicuuc.so and libicui18n into the runtime
namespace, and allow linking from runtime namespace and classloader
namespace.

This change further allows linking from default namespace, and tries
to fix the regression temporarily.

Bug: 130788466
Test: The app issue is fixed after this CL
Change-Id: Ifae52b554124514e433cfe78875643a7450fbabd
2019-05-14 20:22:34 +01:00
Treehugger Robot 9243da9008 Merge "Apply initial settings for blkio cgroup" 2019-05-07 08:15:35 +00:00
Martijn Coenen fc78be2935 Merge "Support for stopping/starting post-data-mount class subsets." 2019-05-07 06:41:01 +00:00
Rick Yiu a8aaf198d5 Apply initial settings for blkio cgroup
Bug: 111422845
Test: values are applied
Change-Id: Id28d9619fc2fd2287fe656b8032025184ae7f631
2019-05-03 11:58:13 +08:00
Peter Collingbourne fb1c5a724e Link the "runtime" namespace to more namespaces.
The canonical location of the HWASAN runtime, an LL-NDK library, is being moved
to the runtime APEX. It is apparently the first LL-NDK library in the runtime
APEX that does not require a legacy symlink in /system/${LIB}. Therefore we
need to link the HWASAN runtime in the runtime namespace to various namespaces
so that the library can be loaded from outside of the namespace.

Also, add $SANITIZER_RUNTIME_LIBRARIES to
namespace.default.link.system.shared_libs. This is necessary because in
the accompanying Soong change, we cause the HWASAN runtime to be removed
from $LLNDK_LIBRARIES. In most cases, except for this one, this was a no-op
because we were already including both sets of libraries in shared_libs.

Change-Id: I67d64788855d28f3a156a1b9cf8a897617277730
2019-05-01 18:00:33 -07:00
Martin Stjernholm c57ed29dd5 Reland: Fix libnativeloader to correctly link to the platform namespace.
This relands http://r.android.com/951440:

This affected binaries in the Runtime APEX, where the platform namespace is
"platform" rather than "default".

Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to
platform and runtime namespaces, so that it can be used to open up access to
internal libraries in the Runtime APEX as well, which is used by ART gtests
and run tests.

Also update some comments in the ld.config*.txt files to accurately explain
why some namespaces need to be visible, and some other minor changes for
consistency. There are no semantically significant changes in those files.

Test: Flash and boot
Test: Run an ART run test with the internal libarttest.so library
Test: lunch aosp_cf_x86_phone-eng;
  atest android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile \
    com.android.cts.dexmetadata.InstallDexMetadataHostTest#testProfileSnapshotAfterInstall \
    installd_dexopt_test
Bug: 130293232
Bug: 121117762
Change-Id: I3d9f2102a03e83843e15bc78b5ad347220c52769
2019-05-01 16:46:06 +01:00
Martin Stjernholm 8a50dad467 Add linker entries for the new libdexfiled_external.so.
Follow up to http://r.android.com/943476. This library is only available in
debug builds of the Runtime APEX.

Test: Flash and boot with eng build
Change-Id: I260f9b838f44ba3f8976c117d9e42fc456239e88
2019-04-30 16:11:30 +01:00
Martin Stjernholm b9259a9cbe Revert "Fix libnativeloader to correctly link to the platform namespace."
This reverts commit 4ca0ca67bf.

Reason for revert: Breaks android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile and others: http://g/art-team/R2nEDA1Ka_s

Change-Id: Ia6285648133d21e61040efafc73cac97d702a7c4
2019-04-29 20:57:16 +00:00
Martin Stjernholm 4ca0ca67bf Fix libnativeloader to correctly link to the platform namespace.
This affected binaries in the Runtime APEX, where the platform namespace is
"platform" rather than "default".

Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to
platform and runtime namespaces, so that it can be used to open up access to
internal libraries in the Runtime APEX as well, which is used by ART gtests
and run tests.

Also update some comments in the ld.config*.txt files to accurately explain
why some namespaces need to be visible, and some other minor changes for
consistency. There are no semantically significant changes in those files.

Test: Flash and boot
Test: Run an ART run test with the internal libarttest.so library
Bug: 130293232
Bug: 121117762
Change-Id: I7ebaf5370dd0f533b1bb5f0e67e7c3c1df48e512
2019-04-29 13:09:08 +01:00
Martijn Coenen 70788f93ba Support for stopping/starting post-data-mount class subsets.
On devices that use FDE and APEX at the same time, we need to bring up a
minimal framework to be able to mount the /data partition. During this
period, a tmpfs /data filesystem is created, which doesn't contain any
of the updated APEXEs. As a consequence, all those processes will be
using the APEXes from the /system partition.

This is obviously not desired, as APEXes in /system may be old and/or
contain security issues. Additionally, it would create a difference
between FBE and FDE devices at runtime.

Ideally, we restart all processes that have started after we created the
tmpfs /data. We can't (re)start based on class names alone, because some
classes (eg 'hal') contain services that are required to start apexd
itself and that shouldn't be killed (eg the graphics HAL).

To address this, keep track of which processes are started after /data
is mounted, with a new 'mark_post_data' keyword. Additionally, create
'class_reset_post_data', which resets all services in the class that
were created after the initial /data mount, and 'class_start_post_data',
which starts all services in the class that were started after /data was
mounted.

On a device with FBE, these keywords wouldn't be used; on a device with
FDE, we'd use them to bring down the right processes after the user has
entered the correct secret, and restart them.

Bug: 118485723
Test: manually verified process list
Change-Id: I16adb776dacf1dd1feeaff9e60639b99899905eb
2019-04-26 14:04:59 +02:00
Dongwon Kang 5744cc4e99 Fix a warning on namespace.media.link.default.shared_libs
Test: build & dumpsys media.extractor
Bug: 130882530
Change-Id: Ifd46858b5a864f0fbed87baa3321f233ea12954e
Merged-In: Ifd46858b5a864f0fbed87baa3321f233ea12954e
2019-04-23 23:15:24 +00:00
Treehugger Robot 2ddb8df2ef Merge "Adding adb_debug.prop into debug ramdisk" 2019-04-23 02:01:36 +00:00
Bowgo Tsai 05f07d89a6 Adding adb_debug.prop into debug ramdisk
The debug ramdisk can only be used if the device is unlocked.
When it's used, init will load adb_debug.prop and the userdebug
sepolicy from the debug ramdisk, to allow adb root on a user build.

Bug: 126493225
Test: 'make' and checks the file is installed
Change-Id: Id6962414197fc8f47f7c07818e8fb16107dc17a3
2019-04-20 06:08:51 +00:00
Treehugger Robot e7d0c83d3c Merge "init.rc: set fsck log permission on post-fs-data" 2019-04-20 00:12:47 +00:00
Treehugger Robot 72d8d2f2c6 Merge "Copying debug ramdisk files to /debug_ramdisk/*" 2019-04-19 23:54:53 +00:00
Wei Wang a91c5f700e init.rc: set fsck log permission on post-fs-data
Fixes: 130829745
Test: build and trigger fsck
      crosshatch:/ # ls -l /dev/fscklogs/log
      -rwxrwx--- 1 root system 1584 1970-04-08 14:48 /dev/fscklogs/log
Change-Id: Ifd0734e121d07b941a73d7cabde04928ce5e5c59
2019-04-19 11:46:21 -07:00
Treehugger Robot a7c103eb8e Merge "init: set oom_adj early before fork vendor_init" 2019-04-19 02:17:50 +00:00
Bowgo Tsai 30afda71c0 Copying debug ramdisk files to /debug_ramdisk/*
In previous implementation, userdebug sepoilcy and property files are
loaded from the system.img. This CL changes this to:

  - first-stage init copies userdebug files from ramdisk to /debug_ramisk/*
  - second-stage init loads files from /debug_ramdisk/*.

Note: same as before, the above can only be triggered, if the device
is UNLOCKED

With this, we don't have to put userdebug related files into the USER
system.img.

Bug: 126493225
Test: boot device with a ramdisk with /force_debuggable, checks related
      files are loaded
Change-Id: I63f5f846e82ba78427062bf7615c26173878d8f3
2019-04-19 09:56:14 +08:00
Wei Wang 45d8174fe7 init: set oom_adj early before fork vendor_init
right now vendor_init is forked before we set oom_adj for init which
leaves a chance vendor_init could be killed in heavy memory pressure.

this CL set the oom_adj before forking everything to ensure all native
have correct oom_adj settings.

Fixes: 130824864
Test: procrank -o
Change-Id: I8af129076c3efa29f7b781459449f8f2dc853c98
2019-04-18 16:14:08 -07:00
Dongwon Kang aa952fa545 Merge "Remove libandroid.so from media namespace." 2019-04-18 20:54:40 +00:00
Dongwon Kang 4b2b76e101 Remove libandroid.so from media namespace.
Test: adb shell dumpsys media.extractor
Bug: 130637522
Change-Id: I6bcdac60a740d19a97bbac19e6339e0552b0d572
Merged-In: Ia6366834613d1e12498fa90377e79f62a2149776
2019-04-17 18:05:51 +00:00
Tom Cherry 3ec821fcfb Do not create /sbin
/sbin was traditionally used for static binaries on the ramdisk for
Android, but now everything is a shared binary, so this directory is
empty and we do not want to encourage creation of new libraries in
this directory.

Bug: 73660730
Test: build
Change-Id: I0d0aa052e1eaf529d18921c45169473df0ee51ff
2019-04-16 15:22:33 -07:00
Martin Stjernholm 609236f66c Describe the reason for the allow_all_shared_libs from the runtime namespace
better.

Test: N/A - comment change only
Bug: 119867084
Change-Id: I80743236f95cedc43b8f80ac32a09ac0094f779e
2019-04-11 13:54:44 +01:00
Yifan Hong 122e78248e charger: Allow to rw /sys/power/[state,wakeup_count]
charger needs to suspend the device when the power goes away
when it doesn't have root. These two files are marked with
group system, user system, mode 0600 in 'on boot', but
it is not executed in charger. Hence, move these actions
to 'on init'.

Test: no failure in libsuspend in charger

Bug: 129138950

Change-Id: I787b935b4ff6177601329aeedccdac361b119ca3
Merged-In: I787b935b4ff6177601329aeedccdac361b119ca3
2019-04-09 13:35:07 -07:00
Oliver Nguyen 3a6a01bdee Merge "Move gcov output to /data/misc/trace" 2019-04-05 18:11:30 +00:00
Victor Hsieh 851026d569 Do not restrict .fs-verity keyring in debuggable build
Test: add logs, see expected behavior
Bug: 112038861
Change-Id: Ib133d2206a7696caaf42ab5f0a6d79aa5308b332
2019-04-04 16:48:57 -07:00
Oliver Nguyen 360eb055e0 Move gcov output to /data/misc/trace
Gcov output location has world write on debuggable builds.

Test: N/A
Bug: 128524141
Change-Id: Ia6b94e26352dd66f5c6819f6157b4b73dd777a90
2019-04-04 13:57:59 -07:00
Yifan Hong 063b6beef0 Add libcgrouprc to ld.config.*.txt.
Test: boots (sanity)
Bug: 123664216
Change-Id: I23c3ece44816e4e213f9630b915e19978a259823
Merged-In: I23c3ece44816e4e213f9630b915e19978a259823
2019-04-02 22:31:57 -07:00
Treehugger Robot 5ccb6a5cdc Merge "Search rs namespace prior to vndk namespace" 2019-04-02 08:24:42 +00:00
Jiyong Park fa4971f3c3 Search rs namespace prior to vndk namespace
With the recent change that removed get_exported_namespace out of libdl,
the RenderScript SP-HAL stopped using android_dlopen_ext which it used
to load libRS_internal.so in the "rs" namespace. Instead, it now falls
back to the ordinary dlopen() call. The dlopen() call tries to load the
lib in the current namespace (which is sphal) and then falls back to the
linked namespaces: default, vndk, rs.

The problem is that rs is listed as the last namespace and therefore the
linker tries the namespace only when it failed to load the library in
other namespaces: default and vndk. libRS_internal.so is accessible to
both vndk and rs namespaces. So, the dlopen() call always goes into the
vndk namespace and there is no chance for the lib to be loaded in the rs
namespace.

To fix the problem, the rs namespace is placed before vndk so that the
namespace is tried first.

Bug: 129550847
Test: runtest -x cts/tests/camera/src/android/hardware/
Change-Id: Idafc32f8a309dd12495768931d7ea17a2f791c50
2019-04-02 02:43:23 +00:00
Treehugger Robot 99ba4b36e8 Merge "init.rc: tune F2FS to be aligned to system settings" 2019-04-01 16:10:28 +00:00
Treehugger Robot ddaf736a88 Merge "Adding GSI public keys" 2019-04-01 13:43:34 +00:00
Bowgo Tsai 5fdd7861bb Adding GSI public keys
This CL adds three GSI keys, to allow booting a GSI with AVB
to enable dm-verity.

   https://android.googlesource.com/platform/external/avb/

The keys for R and S GSI is to allow a device boots a new
version of GSI in a Treble-compatible manner.

For more information about GSI, please visit:

    https://source.android.com/setup/build/gsi

Bug: 112293933
Test: m q-gsi.avbpubkey r-gsi.avbpubkey s-gsi.avbpubkey
Change-Id: I4439e44fbd5da3240d7f6c7987f66445ec4590c5
2019-03-30 03:07:31 +00:00
Jaegeuk Kim f65df964c0 init.rc: tune F2FS to be aligned to system settings
Android sets /proc/sys/vm/dirty_expire_centisecs to 200, so f2fs
doesn't need to do checkpoint in 60 seconds.

Bug: 127511432
Change-Id: I2ba0623053d4480b82003eb1cca85ff03c61fc0f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-03-29 22:43:29 +00:00
Tim Murray 1504cb5b6e Set /proc/pressure/memory file permissions
Change access mode and ownership for /proc/pressure/memory file
to allow system components access memory pressure information.

Bug: 129476847
Change-Id: I25b6bc9d47aee857936f050b66e7bee6363b53be
Signed-off-by: Tim Murray <timmurray@google.com>
2019-03-28 22:12:06 +00:00
Martin Stjernholm 60de348654 Merge "Apply the standard system linker config to all of /data." 2019-03-28 12:37:29 +00:00
Treehugger Robot 7f43e9fa40 Merge "Initialize fs-verity keys in shell script" 2019-03-27 20:31:19 +00:00
Martin Stjernholm adf4503de1 Apply the standard system linker config to all of /data.
This is necessary to get the correct APEX namespace setup for apps that
executes binaries from there.

In older releases no linker config applied to binaries in /data, so the
fallback config in /system/bin/linker was used, which basically just looked
up libraries in /system/{lib,lib64}. With the introduction of APEXes that
location no longer contains the complete set of libraries, so this is
necessary to retain functional parity.

Strictly speaking this fallback rule should apply as last resort for a
binary in any location, but the linker does not accept "dir.system = /".

Test: Flash and boot
Test: The app regression in b/128569634
Bug: 128569634
Change-Id: Icfcd66f0a7d8d898618be1b6186bb1111d20d688
2019-03-26 18:10:51 +00:00
Martin Stjernholm 5c074e0ab9 Remove links to libart(d).so in the runtime.
They are not needed since the binaries and relevant exported libraries have
moved to the Runtime APEX.

Test: Flash and boot
Test: atest CtsJniTestCases CtsJdwpTestCases
Bug: 119867084
Change-Id: If416fbae7057aec02059bb31a4dcd8b63dcc0cad
2019-03-26 17:24:12 +00:00
Pete Bentley d2c4eb0dae Merge "Tighten native API surface." 2019-03-26 09:19:37 +00:00
Victor Hsieh 59183120c2 Initialize fs-verity keys in shell script
This gives us two benefits:
  - Better compatibility to keyctl(1), which doesn't have "dadd"
  - Pave the way to specify key's security labels, since keyctl(1)
    doesn't support, and we want to avoid adding incompatible option.

Test: See keys loaded in /proc/keys
Bug: 128607724
Change-Id: Ia45f6e9dea80d037c0820cf1fd2bc9d7c8bb6302
2019-03-22 09:18:00 -07:00