Commit graph

68518 commits

Author SHA1 Message Date
Steven Moreland
1d68548823 libutils: add sp::cast method
Previously, sp::sp(T*) internally had a static cast, and people
frequently wrote code like this:

    sp<A> a = ...;
    sp<B> b(a.get()); // implicit static cast

Luckily, none of the other sp constructors have this implicit cast. So,
for explicit code, rather than making those use static_cast internally,
adding an sp::cast function.

Bug: 184190315
Test: use in libbinder
Change-Id: Id205c88d03e16cf85ccb8f493ce88b4bbc65a688
2021-04-07 20:30:21 +00:00
Yo Chiang
b20e9a3606 Merge "fs_mgr: SkipMountingPartitions() support glob patterns" 2021-04-07 05:04:21 +00:00
Treehugger Robot
02c97e837d Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/core" 2021-04-07 03:46:57 +00:00
Bob Badour
8c2fe15b47 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  libstats/pull_rust/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I362f72ab99850558ddc7b50108c1ec6a212cb258
2021-04-06 17:46:33 -07:00
Treehugger Robot
0cf8af6860 Merge "ueventd: Fix wrong argument index in devpath comparison" 2021-04-06 23:10:05 +00:00
David Anderson
0da1d617d2 Merge changes from topic "revert-1660531-max-boot-level-crypto-KFMCEDKSIV"
* changes:
  Revert "Expose AID_KEYSTORE"
  Revert "Set earlyBootEnded before apex starts"
2021-04-06 21:54:44 +00:00
Akilesh Kailash
591edca44d Merge "libsnapshot:snapuserd: Terminate daemon after applying OTA." 2021-04-06 18:02:52 +00:00
Ulyana Trafimovich
a801eabe11 Revert "Expose AID_KEYSTORE"
Revert "Cryptographic security for MAX_BOOT_LEVEL"

Revert submission 1660531-max-boot-level-crypto

Reason for revert: broken test com.android.tests.odsign.OnDeviceSigningHostTest#verifyArtUpgradeSignsFiles on aosp-master on aosp_cf_x86_64_phone-userdebug at 7261517

Reverted Changes:
Ia3b968afc:Set earlyBootEnded before apex starts
Ia69891291:Expose AID_KEYSTORE
I12530cd13:Cryptographic security for MAX_BOOT_LEVEL

Bug: 184635938
Change-Id: Id02f63a794544d650abb95c8e7f201eea03391eb
Test: forrest run for the broken test
2021-04-06 16:07:07 +00:00
Ulyana Trafimovich
82cfe66794 Revert "Set earlyBootEnded before apex starts"
Revert "Cryptographic security for MAX_BOOT_LEVEL"

Revert submission 1660531-max-boot-level-crypto

Reason for revert: broken test com.android.tests.odsign.OnDeviceSigningHostTest#verifyArtUpgradeSignsFiles on aosp-master on aosp_cf_x86_64_phone-userdebug at 7261517

Reverted Changes:
Ia3b968afc:Set earlyBootEnded before apex starts
Ia69891291:Expose AID_KEYSTORE
I12530cd13:Cryptographic security for MAX_BOOT_LEVEL

Bug: 184635938
Change-Id: Ibf63734a02a2c132142671c0fae5d0177bf46079
Test: forrest run for the broken test
2021-04-06 16:07:07 +00:00
Paul Crowley
de2769dc1e Merge changes from topic "max-boot-level-crypto"
* changes:
  Set earlyBootEnded before apex starts
  Expose AID_KEYSTORE
2021-04-06 11:15:29 +00:00
Paul Crowley
02e0ddcaf9 Set earlyBootEnded before apex starts
earlyBootEnded signals to keystore2 to read the database for the first
time, and start the MAX_BOOT_LEVEL system. It must therefore run
after /data is mounted and /data/misc/keystore is created, but before
apexd or odsign starts.

Bug: 176450483
Test: cuttlefish: check keystore2 logs to ensure all looks well.
Change-Id: Ia3b968afc38edf95712480e99e545ba88ea309c3
2021-04-05 21:40:36 -07:00
Yo Chiang
aeb962f09a Merge changes from topic "ReadDefaultFstab_requires_sepolicies"
* changes:
  fs_mgr: Refactor ReadDefaultFstab() and ReadFstabFromFile()
  fs_mgr: Strengthen ReadFstabFromFile() around gsi_public_metadata_file
2021-04-06 03:37:58 +00:00
Suchang Woo
8681f7e7a3 ueventd: Fix wrong argument index in devpath comparison
args[2](user name to run as) is used instead of args[1](devpath).

Test: atest CtsInitTestCases
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
Change-Id: Id271755993d55e332bad54d0414e2232071e5e8e
2021-04-06 11:15:28 +09:00
Akilesh Kailash
e2883c1ea0 libsnapshot:snapuserd: Terminate daemon after applying OTA.
When all threads are terminated, dm-user handler's are removed
from the list. When the last handler is removed, daemon is
shutdown gracefully.

Bug: 183652708
Test: 1: Apply full OTA and verify daemon is terminated; reapply the OTA
      to verify daemon is restarted again.
      2:  vts_libsnapshot_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ibd41223fc0eba884993a533fcc95661f72805db2
2021-04-05 21:50:46 +00:00
Steven Moreland
99037347d6 Merge "ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION" 2021-04-05 20:00:39 +00:00
Joel Galenson
177f93f9cb Merge "Add Rust interface for the pull API." 2021-04-05 18:50:47 +00:00
Steven Moreland
da75cef983 ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION
In form, inspired by ANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION.

We get occasional bugs about sp double-ownership. When this flag is
enabled, we have:
- you must construct RefBase objects using sp<>::make
- you must construct wp<> objects by converting them to sp<>
- if you want to convert a raw pointer to an sp<> object (this is
  possible since the refcount is used internally, and is used commonly
  on this*), then you must use 'assertStrongRefExists' semantics which
  aborts if there is no strong ref held. That is, if a client uses
  std::make_shared and then calls a function which internally used to
  call `sp<T>(this)`, you would now call
  `sp<T>::assertStrongRefExists(this)`, and the double ownership
  problem would become a runtime error.

Bug: 184190315
Test: libutils_test
Change-Id: Ie18d3146420df1808e3733027070ec234dda4e9d
2021-04-05 17:45:18 +00:00
Paul Crowley
8306ab68f7 Expose AID_KEYSTORE
Keystore uses this as the user ID for keys that it creates for its
own use.

Bug: 176450483
Test: keystore2_test
Change-Id: Ia698912917cd209eebcfc007a8badce7a39159d6
2021-04-03 08:38:41 -07:00
Steven Moreland
767f264fa4 Merge "libutils: better docs for sp<>::make" 2021-04-02 21:16:52 +00:00
Steven Moreland
09b0495b47 libutils: better docs for sp<>::make
Bug: 184190315
Test: N/A
Change-Id: I56621058b9d85122b7dca3727e40c8c85595031f
2021-04-02 17:26:16 +00:00
Yi-Yo Chiang
1a3c050a35 fs_mgr: Refactor ReadDefaultFstab() and ReadFstabFromFile()
* Eliminate redundant std::move() by transforming
    ReadFstabFromDt(&dt_fstab, false);
    *fstab = std::move(dt_fstab);
  to
    fstab->clear();
    ReadFstabFromDt(fstab, false);

* Don't modify output parameter if ReadFstabFromFile() failed.

Bug: 181110285
Test: Presubmit
Change-Id: I4e4d9852cc618a66d79e423780bf97773dca2a58
2021-04-02 05:26:01 +00:00
Yi-Yo Chiang
ea4369d141 fs_mgr: Strengthen ReadFstabFromFile() around gsi_public_metadata_file
ReadFstabFromFile() calls access() to check the existence of DSU
metadata files to determine if device is in DSU running state. This is
error prone because a failed access() can mean non-exsitent file as well
as the caller lacking the permission to path resolute the pathname.

Strengthen ReadFstabFromFile() to check the errno after a failed
access() or open(), if the errno is not ENOENT, then return with error,
as this may be indicating the caller doesn't have sufficient access
rights to call ReadFstabFromFile().

After this change, processes would need these policies to call
ReadFstabFromFile():
  allow scontext { metadata_file gsi_metadata_file_type }:dir search;
And these policies to call ReadFstabFromFile() within a DSU system:
  allow scontext gsi_public_metadata_file:file r_file_perms;

Bug: 181110285
Test: Presubmit
Change-Id: I1a6a796cb9b7b49af3aa5e7a5e8d99cde25e5857
2021-04-02 05:25:46 +00:00
Yi-Yo Chiang
2f2fe4afaf fs_mgr: SkipMountingPartitions() support glob patterns
Enhance skip_mount.cfg to be able to specify glob patterns.

Bug: 184132970
Test: GSI Boot test
Change-Id: I8e6528e4aff6ea176aa028c3c55d6cedaff3e181
2021-04-02 05:23:44 +00:00
Yo Chiang
a2b662cf23 Merge "fs_mgr: Suppress SkipMountingPartitions log in ReadFstabFromFile" 2021-04-02 05:23:16 +00:00
Yi-Yo Chiang
20579011cf fs_mgr: Suppress SkipMountingPartitions log in ReadFstabFromFile
Minor refactoring and renaming, goal is to make the follow-up patch
easier to read.

Bug: 184132970
Test: Presubmit
Change-Id: I66416161b30ac310934d901cbaf11bc926e2cbf7
2021-04-02 05:23:02 +00:00
Akilesh Kailash
ef8d3c39b5 Merge "libsnapshot:snapuserd: Fix memory leak" 2021-04-02 05:13:11 +00:00
Akilesh Kailash
e722a1b169 libsnapshot:snapuserd: Fix memory leak
When worker threads were created, snapuserd was converted to a
shared_pointer. Earlier, memory was forcefully released
by setting snapuserd to nullptr which worked as it
was a unique pointer. Now, every worker thread holds
a reference. Clear the vector once all the worker
threads are terminated.

Test: Apply OTA and verify memory is released after OTA is applied
Bug: 183652708
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I256d26d98b02ad599aff49b92192226546c59b17
2021-04-02 00:49:18 +00:00
Treehugger Robot
6463f60a56 Merge "Populate all other emulator properties as ro.boot.qemu.*" 2021-04-01 22:39:55 +00:00
Treehugger Robot
71a220901a Merge changes I5989f49c,I394b5aa9
* changes:
  Update owners for modprobe.c
  libmodprobe: refactor blocklist functionality
2021-04-01 22:34:27 +00:00
Will McVicker
ff825b29b1 Update owners for modprobe.c
Test: treehugger
Change-Id: I5989f49c284b4f06a24b6350a531902832e2eef5
2021-04-01 12:42:21 -07:00
Roman Kiryanov
bcc7946ef0 Populate all other emulator properties as ro.boot.qemu.*
Bug: 182291166
Test: getprop | grep "ro\.boot\.qemu\."
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I0d2a4a9edd87999b35fac8496e9cda93fc7d0cf1
2021-04-01 11:39:30 -07:00
Nikita Ioffe
89e50ee521 Merge "Revert "libdexfile_external is being replaced by libdexfile."" 2021-04-01 14:22:53 +00:00
Nikita Ioffe
698370e933 Revert "libdexfile_external is being replaced by libdexfile."
Revert "Merge libdexfile_external into libdexfile."

Revert "libdexfile_external is replaced by libdexfile."

Revert "Rename libdexfile_external_static to libdexfile_static."

Revert "Rename libdexfile_external_static to libdexfile_static."

Revert "Allow dependencies from platform variants to APEX modules."

Revert submission 1658000

Reason for revert: Breaks full-eng build: b/184239856
Reverted Changes:
I4f8ead785:Avoid internal APEX stubs for libsigchain and clea...
I68affdf69:Allow dependencies from platform variants to APEX ...
I54b33784e:Rename libdexfile_external_static to libdexfile_st...
Id68ae9438:libdexfile_external is being replaced by libdexfil...
I12ac84eb4:libdexfile_external is replaced by libdexfile.
If05dbffc8:Rename libdexfile_external_static to libdexfile_st...
Ia011fa3a8:Merge libdexfile_external into libdexfile.

Change-Id: I2448810c9a863cde32b6ed98d9ed0a99cf260d34
2021-04-01 10:58:24 +00:00
Martin Stjernholm
3080a06431 Merge "libdexfile_external is being replaced by libdexfile." 2021-04-01 06:53:13 +00:00
Treehugger Robot
817f8971ac Merge "trusty: apploader: Log errors to logcat" 2021-04-01 05:30:25 +00:00
Joel Galenson
559379ea58 Add Rust interface for the pull API.
Test: Manually run statsd_testdrive
Change-Id: Ib2e99ddbd60d054189caac712e0ae5438045f0bc
2021-03-31 14:41:24 -07:00
Tri Vo
413ab28953 trusty: apploader: Log errors to logcat
Otherwise, these error logs don't end up in bugreports, making it very
difficult to debug.

When using locally, users will have to check logcat instead of stderr.

Bug: 183919392
Bug: 115420908
Test: m
Change-Id: I3b829347971d05968b851e11ce784829d12ef098
2021-03-31 13:27:57 -07:00
Will McVicker
87b2ef0edf libmodprobe: refactor blocklist functionality
Remove the function EnableBlocklist() and add a constructor argument to
enable/disable the use of modules.blocklist. In all cases, the
enabling/disabling of the blocklist happens immediately after creating
the Modprobe object. So this simplies libmodprobe.

Additionally, the use of the blocklist by libmodprobe should be enabled
by default unless explicitly disabled during creation of the Modprobe
object. Currently, only modprobe(8) defaults to not using the blocklist
and includes the argument -b BLOCKLIST for enabling it. That
functionality remains.

This refactor allows us to use the blocklist during first stage init.
However, additional logic is needed to not return an error for the
blocked non-aliased modules during first stage init; otherwise, the
error would result in an init crash leading to a device reboot. So fixup
LoadListedModules() to allow blocking modules without returning an
error.

Bug: 182582036
Test: boot test on pixel 5 with a module in modules.blocklist
Change-Id: I394b5aa98fa98821011982cfe693749010c381f7
2021-03-31 09:34:47 -07:00
Josh Gao
007d7941c8 Merge "debuggerd: store commandline instead of process name." 2021-03-31 08:29:54 +00:00
Treehugger Robot
911850ecc3 Merge "Copy vendor.sys.usb.adb.enabled to sys.usb.adb.enabled." 2021-03-31 00:06:44 +00:00
Josh Gao
31348a74e0 debuggerd: store commandline instead of process name.
Bug: http://b/180605583
Test: debuggerd_test
Change-Id: I018d399a5460f357766dc1b429f645f78fe88565
2021-03-30 12:15:56 -07:00
David Anderson
7ab8f2eeba Merge "libsnapshot: Ensure we can remove bad snapshots when beginning an update." 2021-03-30 18:48:28 +00:00
satayev
f6b2b201fd Merge "Delay running derive_classpath." 2021-03-30 13:57:30 +00:00
satayev
39a151114a Merge "Attempt to fix labels on /data/system/environ/." 2021-03-30 13:57:10 +00:00
Martin Stjernholm
3ecc22fd20 libdexfile_external is being replaced by libdexfile.
Test: atest CtsSimpleperfTestCases
Bug: 143978909
Change-Id: Id68ae9438e8e7a902ee00e00f53018aa90e92c7b
2021-03-30 12:19:49 +01:00
Artur Satayev
7df79970ad Delay running derive_classpath.
It must run before odsign; and now runs after restorecon on /data as well.

Bug: 183861600
Bug: 180105615
Test: presubmit && cuttlefish boots
Change-Id: Iefe59d94a7a40ed1e526c189cbc2baf69156f334
2021-03-30 11:57:38 +01:00
Artur Satayev
441e6b91e1 Attempt to fix labels on /data/system/environ/.
Bug: 183861600
Bug: 180105615
Test: presubmit && cuttlefish boots
Change-Id: Ic5206eb28e8028ec3c9c4b5a756c46ddb6e68b58
2021-03-30 11:49:05 +01:00
David Anderson
527cdd4617 Merge "fastboot: Don't fail when unable to get boot partition size" 2021-03-29 18:56:28 +00:00
Jeffrey Vander Stoep
0b99f553ae Merge "Add UID for virtmanager" 2021-03-29 07:26:44 +00:00
Oleg Matcovschi
b16ef309d6 Merge "fastboot: derive device locked state from Android property" 2021-03-26 01:26:57 +00:00