Commit graph

58451 commits

Author SHA1 Message Date
Josh Gao
30b0bbd4a2 adb: avoid crash when authenticating without vendor keys.
Bug: http://b/158232136
Test: manual
Change-Id: Ic8211335494a6acb703af5b82f52856223f538bb
2020-06-11 21:31:09 -07:00
Jooyung Han
7cc98e212b Merge "init: start ueventd in the default mount namespace" 2020-06-12 02:06:12 +00:00
Randall Huang
78e0d064c7 Merge "Try to recover corrupted ext4 /data with backup superblock" 2020-06-11 23:46:17 +00:00
Tom Cherry
8d3265539b Merge "logd: add a test for clearing logs with a reader present" 2020-06-11 22:33:21 +00:00
Tom Cherry
8319bb40d0 logd: add a test for clearing logs with a reader present
Test that:
1) Logs are cleared
2) More logs can be added after clear
3) Well behaving blocking readers stay connected and can read new logs
after clear.

Test: this unit test
Change-Id: I8497896f5fb068b1e50ff0dcaab1cf79aebae2bb
2020-06-11 14:13:39 -07:00
Tom Cherry
7a372d168a Merge "logd: simplify Clear() + Prune() logic" 2020-06-11 16:34:20 +00:00
Tom Cherry
a863b1a04b logd: simplify Clear() + Prune() logic
Clear() and Prune() return a boolean indicating whether or not their
operations failed because the log buffer was 'busy'.  This means that
they return false upon success and true upon failure, which is not
intuitive.

This change inverts their return value to simply be true if they were
successful or false otherwise.  It also simplifies the return value of
ChattyLogBuffer::Prune() to true if the requested number of rows have
been pruned or if all rows in the log buffer have been pruned, and
otherwise return false.

Test: logging unit tests
Test: clearing works even under logging pressure
Change-Id: I346bb945496ef62bf8e973298f81c5163f49bc57
2020-06-11 07:59:01 -07:00
Treehugger Robot
6c7b75b421 Merge "Fix a misleading warning message about sysprop overriding" 2020-06-11 14:50:05 +00:00
Jiyong Park
e714cde55d Fix a misleading warning message about sysprop overriding
Regardless of whether a system property is "ro." or not, it can be
overridden by build.prop from the more specific partition. i.e.
foo.bar=true in system/build.prop can be overridden by
foo.bar=false in vendor/build.prop. However, the warning message
was referring the overridden property as "ro." causing confusion
when reading the log. Fix it by not mentioning "ro.".

Bug: 117892318
Test: N/A
Change-Id: I13014522d0c6b507b30c8754e2087fd71cc39971
2020-06-11 19:45:14 +09:00
Jooyung Han
4f23d5a236 init: start ueventd in the default mount namespace
Init starts ueventd in the default mount namespace to support loading
firmware from APEXes.

Bug: 155023652
Test: devices boots
      adb$ nsenter -t (pid of ueventd) -m ls /apex
      => shows all APEXes
Change-Id: Ibb8b33a07eb014752275e3bca4541b8b694dc64b
2020-06-11 15:10:40 +09:00
Randall Huang
72abd7b246 Try to recover corrupted ext4 /data with backup superblock
If the superblock of /data is corrupted, fs_mgr would skip check_fs.
But, e2fsck actually may reference backup superblock to recover
the filesystem. This fix gives fs_mgr second chance to fix corrupted
ext4 /data.

Bug: 156200421
Test: boot with corrupted ext4 superblock

Signed-off-by: Randall Huang <huangrandall@google.com>
Change-Id: Ia39af3340c0e241f62557b7c2cc8b800443342f9
2020-06-11 14:04:47 +08:00
Yo Chiang
3447cdc741 Merge "shell_and_utilities_recovery: Fix required dependencies" 2020-06-11 03:10:01 +00:00
Elliott Hughes
cec2d69a0b Merge "Remove zygote configuration for 32-bit primary, 64-bit secondary." 2020-06-10 23:52:34 +00:00
Elliott Hughes
409bca11de Remove zygote configuration for 32-bit primary, 64-bit secondary.
Bug: https://issuetracker.google.com/138812821
Test: treehugger
Change-Id: I67c59f1956cec7ea46ded6e0a772ac1226e2a7b3
Merged-In: I67c59f1956cec7ea46ded6e0a772ac1226e2a7b3
2020-06-10 22:52:52 +00:00
Marco Ballesio
75d9170454 Merge "libprocessgroup: support for cgroup v2 hierarchy" 2020-06-10 21:36:08 +00:00
Tom Cherry
18b5965e20 Merge "fastboot: don't print anything in Status() if the input is empty" 2020-06-10 19:03:18 +00:00
Tom Cherry
2217c50a4f fastboot: don't print anything in Status() if the input is empty
Status() is called with an empty string to handle `fastboot oem`
commands.  This currently emits a set of spaces and sets
last_start_time such that the epilog can track the time spent in this
command.  Emitting the spaces is problematic however, since it results
in the follow:

 $ fastboot oem device-info
                                                  (bootloader) Verity mode: false
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: true
(bootloader) Charger screen enabled: true
OKAY [  0.000s]
Finished. Total time: 0.000s

If we skip emitting the spaces, then we get the correct result:

 $ fastboot oem device-info
(bootloader) Verity mode: false
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: true
(bootloader) Charger screen enabled: true
OKAY [  0.001s]
Finished. Total time: 0.001s

There are no other uses of Status() with an empty string, so this
changes won't impact other commands.

Bug: 158310284
Test: fastboot formats this and other commands correctly.
Change-Id: I6294acefc65a8399160c0944b3fbc2f2ace919ed
2020-06-10 09:29:25 -07:00
Marco Ballesio
f16f9417b0 libprocessgroup: support for cgroup v2 hierarchy
for a first implementation the cgroup v2 freezer controller will be used in a
way similar to cgroup v1, that is a single child group will hold all frozen
processes. Some adjustments are needed for the new structure.

- Add support for cgroup v2 syntax under procfs.
- Separate creation of a directory with ownership/mode changes to allow changes
    after mounting the cgroup kernfs root.
- Allow the creation of sub-groups under a cgroup v2 hierarchy.

Bug: 154548692
Test: manually verified that a proper cgroup v2 hierarchy is created and
accessible

Change-Id: I9af59e8214acaead3f520a94c95e75394c0df948
2020-06-10 09:14:00 -07:00
Treehugger Robot
e4424ff422 Merge "Fix typo in android init language documentation." 2020-06-10 15:08:49 +00:00
Roland Levillain
f596dec176 Rename native code coverage paths env. variable in libsnapshot's fuzz test.
Rename `COVERAGE_PATHS` as `NATIVE_COVERAGE_PATHS`.

Test: n/a
Bug: 158212027
Change-Id: Ifea90488c1350a5f46d3065f2ec786ee93c3aae7
2020-06-10 13:04:53 +01:00
Yo Chiang
dc53f4c266 shell_and_utilities_recovery: Fix required dependencies
TARGET module shell_and_utilities_recovery requires non-existent: unzip.recovery

This should be referring to the "ziptool" module. "unzip" is a symlink
installed by "ziptool".

Bug: 7456955
Test: TH; boot/ramdisk/system/bin/ziptool installed in /boot partition
Change-Id: Ib9edf9c17b4dfdebdb8719fb7b9244fca6133f6d
2020-06-10 07:58:04 +00:00
Amos Bianchi
16bfe099f3 Fix typo in android init language documentation.
Test: N/A
Change-Id: I158294b59f120f5f1296f3c9e6e5357fb02ed6b8
2020-06-09 17:10:49 -07:00
Dan Willemsen
48d272c79c Merge "Fix visibility rules now that Make supports visibility checks" 2020-06-09 23:00:27 +00:00
Dan Willemsen
ed96fe1d30 Fix visibility rules now that Make supports visibility checks
Previously, Soong visibility rules did not affect Make modules. Now
these checks have been implemented in:

https://android-review.googlesource.com/c/platform/build/+/1324454

So this fixes the visibility rules to include modules that were
previously using libbacktrace_no_dex.

Bug: 158599308
Test: treehugger
Change-Id: I8f242015ce72ad989e13d56ab085f2abe2f8ce92
2020-06-09 21:02:30 +00:00
Josh Gao
536f220f55 Merge "adbd: remove ifdefs guarding root/secure." 2020-06-09 20:05:29 +00:00
Tianjie
0d05b7a8fa Update libsnapshot to handle partial update
For partial update, the payload will not include all dynamic
partitions on the device, update the logic libsnapshot to better
handle such case.

Bug: 157778739
Test: run a partial OTA, unit tests pass

Change-Id: I4339a81ed31161bab3ba9666c1d05fb8bf57dbf9
2020-06-09 12:53:45 -07:00
Tom Cherry
bd742a15ab Merge "Adding wait for a device file before mount" 2020-06-09 16:36:42 +00:00
Treehugger Robot
389d8885a8 Merge "init: fix README.md about perform_apex_configs" 2020-06-09 15:06:54 +00:00
Josh Gao
d076857c4f adbd: remove ifdefs guarding root/secure.
The same adbd module prebuilt will get used for both user and userdebug
builds in the post-APEX world, so we can't guard functionality with
product variable ifdefs anymore.

The code that was previously compiled out runs before we drop root, so
the increased attack surface essentially consists of an attacker having
control over system properties, and that likely implies that we're
doomed already (either they have filesystem control, or they have code
execution in init).

Bug: http://b/158156979
Test: treehugger
Change-Id: Ia70d3140189e5212beb813ff719355e30ca5fa04
2020-06-08 17:57:33 -07:00
Alistair Delva
a3ed46533c Merge changes from topic "default-fstab-swapon_all"
* changes:
  Respect ro.boot.fstab_suffix in swapon_all
  Add documentation for umount_all
2020-06-08 23:41:51 +00:00
Alistair Delva
de28a8651f Respect ro.boot.fstab_suffix in swapon_all
While mount_all and umount_all were updated to use ro.boot.fstab_suffix,
I neglected to update swapon_all. Trivially copied from umount_all.

Bug: 142424832
Change-Id: Icd706fe7a1fe16c687cd2811b0a3158d7d2e224e
Merged-In: Icd706fe7a1fe16c687cd2811b0a3158d7d2e224e
2020-06-08 23:41:40 +00:00
Treehugger Robot
ad3874e025 Merge "Stop using varargs in libkeyutils." 2020-06-08 21:24:18 +00:00
Josh Gao
b99f194d05 Merge "Move libadbd_auth, libadbd_fs to adbd_system_binaries." 2020-06-08 21:00:19 +00:00
Alistair Delva
6c6a36fb31 Add documentation for umount_all
The mount_all and swapon_all commands are documented, but umount_all
is not. Add some documentation.

Bug: 142424832
Change-Id: I7e4dcb4d222b787350a79c9e312062cac9eeb4d8
2020-06-08 10:51:40 -07:00
Treehugger Robot
cbe630dbc6 Merge "Logtags for input flinger" 2020-06-08 17:47:31 +00:00
Paul Lawrence
2709331f90 Merge "Set block size in dm-bow" 2020-06-08 17:07:36 +00:00
Elliott Hughes
44a5f0ed7f Stop using varargs in libkeyutils.
It's error-prone, and our specific usage of it here upsets ubsan.

Bug: https://issuetracker.google.com/158428513
Test: treehugger
Change-Id: I3a6b68865e6b4c37ac005f5f24c3d6e1de7c5bac
2020-06-08 09:27:17 -07:00
Tom Cherry
71de690f60 Merge "logcat: filter based on UID" 2020-06-08 15:58:39 +00:00
Jooyung Han
ea138c8695 init: fix README.md about perform_apex_configs
parse_apex_configs was renamed with
13e51e7f0b.

Bug: n/a
Test: n/a
Change-Id: I6e60d64f915fa9ed47c5ec1195a9b371f68f1134
2020-06-08 18:22:15 +09:00
Jooyung Han
cba44a3c56 Merge "Make libsync a stubs library" 2020-06-08 07:11:10 +00:00
Treehugger Robot
a552265ec9 Merge "Fix fastboot flash-all on Nexus 7." 2020-06-06 00:26:19 +00:00
Rick Yiu
cb63bed8b5 Merge "Fine tune blkio setting to improve boot time" 2020-06-06 00:17:09 +00:00
Elliott Hughes
6a7ff5811d Fix fastboot flash-all on Nexus 7.
The Nexus 7 bootloader just returns the empty string for unknown
variables, which confused the new snapshot code.

Bug: https://issuetracker.google.com/158232468
Test: no Nexus 7 available during covid-19 :-(
Change-Id: I35ff8889b27944e8b7426eca4f513d9fa562c6d4
2020-06-05 14:09:21 -07:00
Siarhei Vishniakou
9243090395 Logtags for input flinger
Reserve logtags 62000 -> 62199 for inputflinger

Bug: 153092301
Test: build with ag/10998853
Change-Id: If87f8e8e39bd445dfa7c96a542482c9ff3bf3fd3
2020-06-05 12:37:43 -07:00
Tom Cherry
9291f0f566 logcat: filter based on UID
Bug: 153761317
Test: logging works normally without --uid
Test: logging filters based on uid with --uid
Change-Id: I6843fa635831c727c0236ac5534862e11447484b
2020-06-05 10:02:44 -07:00
Tom Cherry
a1f1775172 Merge changes I957c519b,Iaf4e389e,I92f8056b
* changes:
  logd: remove faulty optimization
  logd: don't store the map key in its value
  logd: use libbase logging
2020-06-05 15:21:13 +00:00
Paul Lawrence
2f0c6cb0f7 Set block size in dm-bow
Fix block-level checkpointing to work correctly when used in combination with
512 byte hardware sectors and metadata encryption with dm-default-key v2.

Bug: 153512828
Test: Parameter is passed to dm-bow based on first_api_level
Change-Id: Ic0a071221559271db20b06b2f17459b5b041e02d
2020-06-05 07:47:45 -07:00
Jooyung Han
78fc553d68 Make libsync a stubs library
libsync is an NDK/LLNDK library but it's missing "stubs" key. So, when
it is referenced by an APEX, it is bundled in APEX package.

By adding "stubs" property, we can make it a stubs library and APEXes
use it from the system instead of bundling it.

Note that the symbol(sync_wait) is exposed to APEX because it is used
by libui which is used by media APEXes again.

Bug: 158270824
Test: lunch mini_armv7a_neon   # no VNDK
      m com.andorid.media.swcodec
      // see if libsync is not in the APEX
Change-Id: I39e682328acb5cc363a4242601e5bf1470938dac
2020-06-05 17:13:57 +09:00
Tom Cherry
b0263af5a8 logd: remove faulty optimization
TagNameKey contains a pointer to a std::string and a std::string_view,
such it can both own a string or reference a different string.  This
is meant to be a memory optimization.

This, however, is actually a net pessimization.  Due to these three
below cases and typical usage pattern.

Cases:
1) In the case where TagNameKey owns the string, 3 words are wasted,
one for the pointer and two for the std::string_view.

2) In the case where TagNameKey references a short string, the same 3
words are wasted.  This is because std::string has a feature called
"Short String Optimization" that means std::string does not allocate
for strings of sizes <= 10 on 32bit devices and <= 22 on 64bit
devices.

3) In the case where TagNameKey references a longer string than the
"Short String Optimization" limits, then this saves the string's
length in bytes.

Usage pattern:
After boot on 32 bit cuttlefish, there were 679 entries for the first
case, and only 69 in the third case.  The 679 entries have an overhead
of 679 * 3 * sizeof(void*) = 679 * 12 = 8148 bytes.  The 69 strings in
the third case have a total length and therefore savings of 1352
bytes.  This is a net pessimization of 6796 bytes.

I expect this same ratio to be similar throughout the device's uptime.

This situation is worse on 64 bit devices.  If cuttlefish were 64 bit,
then there would have been only 18 items in the third case due to the
larger "Short String Optimization" capacity, and the cost for the
first case would have doubled.

Given the above and the cost of maintaining extra code, this
optimization is removed and a std::string is used as the hash table
key instead.

Test: logging unit tests
Change-Id: I957c519b19edca4f7fc531d96b7144cf68bf4e16
2020-06-04 10:33:07 -07:00
Rick Yiu
ad74d8dee0 Fine tune blkio setting to improve boot time
Bug: 133200996
Test: boot time test
Change-Id: I5262c28596adb7e849b202b8a163c190818f271a
2020-06-04 14:28:19 +08:00