Commit graph

58678 commits

Author SHA1 Message Date
Hongguang Chen
f248cc5a98 Use more inclusive language for #inclusivefixit
Updating language to comply with Android’s inclusive language guidance.

See https://source.android.com/setup/contribute/respectful-code for reference.

Bug: 161896447
Test: make
Change-Id: I3e43a9a0f09b0587ec95de886705f03c1a430ef6
2020-07-23 11:13:37 -07:00
Tom Cherry
d36f4a36ed init: set $PATH in second stage init
If the system partition has been updated and _PATH_DEFPATH has a new
value, then we must set $PATH in second stage init to take on the new
value, as well as having set it in first stage init.

Bug: 160210288
Test: build
Change-Id: I18765709dc9bff9379b0ae39272199cf74a79d2f
2020-07-23 09:13:37 -07:00
Tom Cherry
bc72197b33 logd: use the compressed (serialized) log buffer by default
The serialized log buffer along with compression results in:
* ~3.5x more logs than chatty
* Less CPU usage
* Less memory usage
* Equivalent log range

Also, delete tests that assume that the device logd implementation is
chatty.  There are actual unit tests for this same behavior that don't
rely on the device logd.

Test: serialized log buffer is used
Change-Id: Ie12898617429a75b6caff92725aa7145650f8fc6
2020-07-22 20:21:09 -07:00
Treehugger Robot
b8bcd11f8b Merge "Use more inclusive language for #inclusivefixit" 2020-07-23 02:14:16 +00:00
Hongguang Chen
5330ccdd5b Use more inclusive language for #inclusivefixit
Updating language to comply with Android’s inclusive language guidance.

See https://source.android.com/setup/contribute/respectful-code for reference.

Bug: 161896447
Test: Trivial changes
Change-Id: Ia84d47930b5d9ca4a5f7c809777c886bece4f512
2020-07-23 01:23:45 +00:00
Tri Vo
28215f8d36 Merge "trusty: spi: Add SPI proxy daemon" 2020-07-22 23:26:00 +00:00
Tri Vo
4e94e5bcfa trusty: spi: Add SPI proxy daemon
Bug: 118762930
Test: /data/nativetest64/trusty-ut-ctrl/trusty-ut-ctrl \
-D /dev/trusty-ipc-dev0 com.android.trusty.swspi.test

Change-Id: I6589009b2570f1101fed73197997d31a454887eb
2020-07-22 11:19:02 -07:00
Peter Collingbourne
4058c5cf59 Merge changes from topics "I1e5610d1353b4f5b718c1259825421c0c07d7c24", "I52da338347ff6b7503cf5ac80763c540695dc061", "I94e4b7124b7735b92fd83a49c80ebded3483cd4e"
* changes:
  Include memory tags in memory dump output.
  Adjust conditions for dumping the memory around a register.
  Statically link libminijail to debuggerd_test.
2020-07-22 18:04:17 +00:00
Peter Collingbourne
fe8997aff8 Include memory tags in memory dump output.
Tags appear in the addresses printed in the memory dump, which seems
like a reasonable place to put them because tagged addresses will
also appear in other places in the tombstone, such as registers and
the fault address.

Bug: 135772972
Change-Id: I52da338347ff6b7503cf5ac80763c540695dc061
2020-07-21 19:05:16 -07:00
Peter Collingbourne
b1fcedb928 Adjust conditions for dumping the memory around a register.
Previously, we would do a simple bounds check before deciding
whether to dump the memory around a register. On 64-bit platforms,
the register's value was required to be less than (4 << 60). However,
after stripping tags on AArch64 as part of r.android.com/1365229, all
pointer values became less than (4 << 60), so the check became useless
for filtering out invalid pointers. As a result, we would attempt to
dump memory for all registers, which for a register not containing
a valid pointer would typically consist of 16 lines of dashes.

One possible fix may be to replace the constant (4 << 60) with the
process's actual address space limit (known as TASK_SIZE inside the
kernel; typically 39 bits on AArch64 and 48 bits on x86_64), but the
kernel provides no API for retrieving a process's TASK_SIZE value. We
could guess it by looking at for example the highest bit set in the
value of getauxval(AT_EXECFN), which points to an address on the stack
which typically is mapped at the end of the address space on program
startup, but at least on AArch64 it is possible to dynamically extend
TASK_SIZE at runtime by providing a hint to mmap(), so this is not
always sufficient.

Instead, it seems best to remove most of the early bounds check, and
simply issue ptrace() calls for each register value, bailing out of
the entire output if none of the calls ended up succeeding. This also
has the nice side effect of avoiding 16 lines of noise per register
whose value looks like a pointer but actually points to unmapped
memory. We still retain part of the bounds check in order to avoid
integer overflow during the dump (including overflows into the tag
part of the address on architectures that support tagging).

Bug: 154272452
Change-Id: I94e4b7124b7735b92fd83a49c80ebded3483cd4e
2020-07-21 16:59:24 -07:00
Peter Collingbourne
d00a577c97 Statically link libminijail to debuggerd_test.
We do not install a 32-bit version of libminijail to 64/32 devices,
which means that "atest -a debuggerd_test" always fails on 32-bit.
Fix it by statically linking libminijail.

Change-Id: I1e5610d1353b4f5b718c1259825421c0c07d7c24
2020-07-21 16:59:24 -07:00
Tom Cherry
e122701142 Merge "Ueventd: Fix a corner case in ReadUevent() that triggers duplicate firmware loading." 2020-07-21 21:14:52 +00:00
Tom Cherry
dfdc9b105a Merge "ueventd: bump UEVENT_MSG_LEN to 8192" 2020-07-20 22:24:14 +00:00
P.Adarsh Reddy
a86bf05a01 Ueventd: Fix a corner case in ReadUevent() that triggers duplicate firmware loading.
Presently, within ReadUevent(), true is returned for a successful case
as well as for the case where we read an invalid uevent (overflowed
buffer)where the Uevent object is not cleared, and the caller calls the
callback (with the earlier stored uevent object),leading to duplicate
firmware loading.

Uevent uevent;
while (ReadUevent(&uevent)) {
  if (callback(uevent) == ListenerAction::kStop) return;
}

Scenario:
1. Proper Uevent received and callback is called (firmware loading
   is triggered).
2. Overflowed uevent is received as part of the same ReadUevent session,
   ReadUevent() returns true, but the uevent object is not cleared and
   still has earlier event values.
3. Callback is called again, leading to duplicate firmware load.

Handle it by adding explicit return codes to let the caller know if the
uevent read is invalid, and the caller can ignore it and read
further pending uevents.

Bug: 161580785

Change-Id: I09e80052337fd1495b968dc02ecff5ceb683da18
2020-07-21 03:09:28 +05:30
Jaegeuk Kim
a389610d9c support f2fs casefolding formatting tool
Bug: 159672232
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ia9dd5d63f03c2365b5d82a84ff93263424f116bb
2020-07-20 13:18:09 -07:00
Tom Cherry
939b41c79b ueventd: bump UEVENT_MSG_LEN to 8192
The previous size, 2048, is only the size of the 'environment' for the
uevent message, but doesn't include the <action>@<dev path> portion.
The <action> portion has a max length < 10, but the <dev path> portion
is unbounded.

8192 should be plenty to capture all of these parameters.

Bug: 161580785
Test: ueventd still works
Change-Id: I6de6fd3a444ac91b3b4df154097abde3696e21b3
2020-07-20 13:18:01 -07:00
Tom Cherry
7a6191ce2e Merge "logd: record and replay log messages" 2020-07-20 15:44:44 +00:00
Peter Collingbourne
af7c3d5873 Merge "Fix dumping of heap memory." 2020-07-18 02:06:45 +00:00
Peter Collingbourne
10e428dd77 Fix dumping of heap memory.
After r.android.com/1288984 we started failing to dump memory contents
for heap addresses because the tag started causing any addresses to
fail this bounds check. Add an untag_address() call to the bounds check
so that the tag is ignored.

Bug: 154272452
Change-Id: I3a6d1a078b21871bd93164150a123549f83289f6
2020-07-17 17:35:49 -07:00
Joshua Duong
4aa073337d Merge "[clang-tidy] Add bugprone-inaccurate-erase check." 2020-07-17 23:13:01 +00:00
Tom Cherry
ec39a3f6df logd: record and replay log messages
To profile different log buffer types and configuration, this change
adds the ability to record log messages and adds a tool that will
replay those log messages through different log buffer implementations
and collect stats about the execution.

Test: log messages replay correctly
Change-Id: I0dc6c545b782fa7732e325dde109c496b137d0dd
2020-07-17 15:08:21 -07:00
Yifan Hong
3e31ec8392 Merge changes from topic "odm_dlkm"
* changes:
  rootdir: add odm_dlkm symlinks
  fastboot: Add odm_dlkm
  Load sysprops from odm_dlkm.
2020-07-17 22:05:26 +00:00
Joshua Duong
89169a372f [clang-tidy] Add bugprone-inaccurate-erase check.
This will hopefully identify misusage of the erase-remove idiom.

Test: "foo.erase(std::remove_if(...))" produces error.
Test: mmm system/core/adb -j (no warnings)
Change-Id: Iba0a6fc40cb6e7c65a7a3926d915874dc89a60c6
2020-07-17 14:50:45 -07:00
Treehugger Robot
a22e74cd4e Merge "fs_mgr: overlayfs: check if scratch device is ext4 dedupe" 2020-07-17 19:32:19 +00:00
Treehugger Robot
949f453f7d Merge changes Ie2749dcc,Id1c97b9c,I68d1757d,I8e4b6a80
* changes:
  fs_mgr: adb-remount-test.sh: use 24-bit forground colors
  fs_mgr: adb-remount-test.sh: Port to MAC OS/X
  fs_mgr: adb-remount-test.sh report kernel version of device
  fs_mgr: adb-remount-test.sh filter out ramdumpfs administrative mount
2020-07-17 19:00:38 +00:00
Elliott Hughes
1270608dbf Merge "libunwindstack: support for Armv8.3-A Pointer Authentication" 2020-07-17 18:01:19 +00:00
Tom Cherry
aa0358b8fe Merge "logd: always compress SerializedLogChunk in FinishWriting()" 2020-07-17 17:02:20 +00:00
Mark Salyzyn
93ce58d24a fs_mgr: overlayfs: check if scratch device is ext4 dedupe
Do not attempt to mount scratch r/w if it is ext4 dedupe, this causes
too much noise and troubling but innocuous error reports.

Assumption is we normally try f2fs first on all devices, we only try
ext4 first if we do not have f2fs tools, or if the existing
filesystem is ext4.  That said, we only have to check if it is ext4
dedupe during the first mount attempt, the fallback mount attempt for
ext4 is unlikely to need this checking.

Changes the output report for a retrofit DAP device from:

$ adb remount
Disabling verity for /system
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/by-name/system_b
[libfs_mgr]check_fs(): mount(/dev/block/by-name/system_b,/mnt/scratch,ext4)=-1: Invalid argument
[libfs_mgr]Running /system/bin/e2fsck on /dev/block/sda6
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=ext4)=-1: Invalid argument
[libfs_mgr]Running /system/bin/fsck.f2fs -a /dev/block/sda6
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=f2fs)=0: Success
Using overlayfs for /system
. . .

To the more pleasant:

$ adb $BL1 remount
Disabling verity for /system
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/by-name/system_b
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=ext4)=0: Success
[libfs_mgr]umount(/mnt/scratch)
[libfs_mgr]Running /system/bin/fsck.f2fs -a /dev/block/sda6
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=f2fs)=0: Success
Using overlayfs for /system
. . .

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Change-Id: Ic8c642912b1bafe0b4210c69c99a1d89fa20f204
2020-07-17 07:47:02 -07:00
Mark Salyzyn
c9a69b1df1 fs_mgr: adb-remount-test.sh: use 24-bit forground colors
This allows colors to rendor according to user preferences
in terminal emulator settings.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 161454607
Test: make sure colors make sense
Change-Id: Ie2749dcce66954deddbca2863dadfa270cc6633e
2020-07-17 07:46:54 -07:00
Mark Salyzyn
d88715aae6 fs_mgr: adb-remount-test.sh: Port to MAC OS/X
This script did not run on a MAC, adjust so that it is usable.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 161454607
Test: script can be used to test and replicate reported problem
Change-Id: Id1c97b9cd85d150a96733b8d39e40f6a4bcc0721
2020-07-17 07:46:39 -07:00
Mark Salyzyn
3591c2a661 fs_mgr: adb-remount-test.sh report kernel version of device
Report kernel version as part of the report.  Also warn user that
they are waiting for the screen to come up, and if the delay is
far too long, or the device is headless, then consider using the
--no-wait-screen option

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Bug: ????
Change-Id: I68d1757da62d028dc3633b1175b06af19e469d9f
2020-07-17 07:46:29 -07:00
Mark Salyzyn
128155017a fs_mgr: adb-remount-test.sh filter out ramdumpfs administrative mount
Causes flakes as the ramdumpfs may temporarily be applied
to check and/or retrieve content.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 161454607
Test: no more flakes
Change-Id: I8e4b6a808ab81ec5b4f760a810b9b651a0b329d0
2020-07-17 07:46:13 -07:00
Tom Cherry
59caa7a045 logd: always compress SerializedLogChunk in FinishWriting()
When calculating the space used for pruning, if a log chunk is
compressed, that size is used otherwise the uncompressed size is
used.  This is intended to reach a steady state where 1/4 of the log
buffer is the uncompressed log chunk that is being written to and the
other 3/4 of the log buffer is compressed logs.

If we wait until there are no readers referencing the log chunk before
compressing it, we end up with 2 uncompressed logs (the one that was
just filled, that readers are still referencing, and the new one that
was allocated to fit the most recent log), which take up 1/2 of the
log buffer's allotted size and will thus cause prune to delete more
compressed logs than it should.

Instead, we should always compress the log chunks in FinishWriting()
such that the compressed size will always be used for log chunks other
than the one that is not actively written to.

Decompressed logs due to readers are ephemeral by their nature and
thus don't add to the log buffer size for pruning.

Test: observe that log buffers can be filled in the presence of a reader.
Change-Id: Ie21ccff032e41c4a0e51710cc435c5ab316563cb
2020-07-16 20:46:14 -07:00
Treehugger Robot
e866ce04a7 Merge "Revert "Temporarily disable init_kill_services_test."" 2020-07-16 21:29:33 +00:00
Treehugger Robot
b371af9e0f Merge "Fix quoting of paths in auth code." 2020-07-16 16:47:20 +00:00
Michael Wright
2ea91cfe76 Merge "Soften BitSet class comment." 2020-07-16 12:28:03 +00:00
Alex Buynytskyy
35f3169c5c Merge "install-multi-package fix" 2020-07-16 05:34:44 +00:00
Alex Buynytskyy
71afeb9a5e install-multi-package fix
Fixes: 158851500
Test: adb install-multi-package -d -g $HOME/tmp/base-master.apk:$HOME/tmp/base-en.apk
Change-Id: I92e034c0a8c27eab6d5a82e96817af4a7555388f
Merged-In: I92e034c0a8c27eab6d5a82e96817af4a7555388f
2020-07-16 04:57:07 +00:00
Yifan Hong
e306bce927 rootdir: add odm_dlkm symlinks
Test: builds and boots
Bug: 156020364
Change-Id: I678b787cbf81ea6038936a4059e0bf5adfe3274f
2020-07-15 17:15:49 -07:00
Yifan Hong
be78bb624c fastboot: Add odm_dlkm
Test: add odm_dlkm partition and flash
Bug: 156020364
Change-Id: I577b4420f2be8e8141d967f0d9107cae381c7675
2020-07-15 17:15:49 -07:00
Yifan Hong
9258f2e423 Load sysprops from odm_dlkm.
Load sysprops from /odm_dlkm/etc/build.prop. Note that no
property contexts are loaded from odm_dlkm.

Test: getprop | grep odm_dlkm
Bug: 156020364
Change-Id: I90c3a54a110462736d9888101d4281100d586632
2020-07-15 17:15:49 -07:00
Michael Wright
f32317c869 Soften BitSet class comment.
std::bitset<> doesn't have exact replacements for all of the
functionality of BitSet32/64, so there are still places we want to use
these classes.

Bug: 160010896
Test: test BitSet_test.cpp
Change-Id: Ica59a138e014d82139fb6dcea0597a207faecc2a
2020-07-16 00:04:20 +00:00
Tom Cherry
7c95de7591 Merge "logd: don't use a thread for deleting log chunks" 2020-07-15 22:57:50 +00:00
Tom Cherry
ed99870f79 Merge "logd: allow opting into simple or serialized log buffers" 2020-07-15 22:56:57 +00:00
Elliott Hughes
bdb5233f0c Fix quoting of paths in auth code.
Noticed looked at the log in http://b/160831491.

Test: builds
Change-Id: I95c595ba433a868dedeee8059cfba4c6de8ba91b
2020-07-15 11:55:40 -07:00
Treehugger Robot
37b0d41faf Merge "Fix an issue with C-compatibility due to a missing tag name" 2020-07-14 22:15:36 +00:00
Stephen Hines
84fac2c5d0 Fix an issue with C-compatibility due to a missing tag name
system/core/libpixelflinger/include/pixelflinger/format.h:85:15: error: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Werror,-Wnon-c-typedef-for-linkage]
typedef struct {
              ^
              GGLFormat
system/core/libpixelflinger/include/pixelflinger/format.h:98:5: note: type is not C-compatible due to this member declaration
     inline uint32_t mask(int i) const {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
system/core/libpixelflinger/include/pixelflinger/format.h:124:3: note: type is given name 'GGLFormat' for linkage purposes by this typedef declaration
} GGLFormat;
  ^

Bug: http://b/155835175
Test: m with aosp_blueline
Change-Id: I2819427e2c9e885f7b66527d5268987e8cc73f31
Merged-In: I73b95ff1d6d17af512ce2226b6324e5da0343c39
2020-07-14 14:38:43 -07:00
Steven Moreland
a3d40729a5 Revert "Temporarily disable init_kill_services_test."
This reverts commit bd68757d44.

Reason for revert: reland test

The test now reboots after it is completed, in case there is some state it doesn't catch locally, and servicemanager restarts more of the system.

Change-Id: I1d6d021f75ef091aa7d6973b80ed162253514697
Fixes: 156380383
Test: atest init_kill_services_test # several times on cf, check logs to confirm system finishes in clean rebooted state
2020-07-14 21:14:19 +00:00
Tamas Petz
6835d019b2 libunwindstack: support for Armv8.3-A Pointer Authentication
This patch adds support for handling return addresses signed with
pointer authentication. It simply strips the authentication code
without verifying its correctness, and thus works with both A and B
keys and through key-change boundaries.

Additons:
  * DW_CFA_AARCH64_negate_ra_state: new CFA operation.
  * RA_SIGN_STATE: new pseudo register.
  * Pass the arch to DwarfCfa so that the new op is only executed
    on aarch64.

The stripping uses the xpaclri instruction. This is a hint space
instruction which is compatible with pre Armv8.3-A devices. For cases
where it cannot be used, a mask can be set instead.

Test: libunwindstack_test
      Without this patch all UnwindTest.* testcases should fail if
      compiled with Pointer Authentication.

The tests should be executed with both -mbranch-protection=pac-ret and
pac-ret+leaf flags so that either some or all functions have pointer
authentication instructions.

Change-Id: Id7c3f1d0e2fc7fccb19bd1430826264405a9df7c
2020-07-14 13:31:59 -07:00
Yifan Hong
7ca7680ec5 Merge changes from topic "vendor_dlkm"
* changes:
  load sysprops from vendor_dlkm.
  fastboot: Add vendor_dlkm
  rootdir: add vendor_dlkm symlinks
2020-07-14 19:15:12 +00:00