Commit graph

58513 commits

Author SHA1 Message Date
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
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
Tom Cherry
c1edd66317 logd: allow opting into simple or serialized log buffers
Test: set properties and see logd use the appropriate buffer.
Change-Id: I2dcce7d9661a43adfafb69427d9271ee7ee29f43
2020-07-14 11:52:06 -07:00
Tom Cherry
4f8125af38 logd: don't use a thread for deleting log chunks
This was a premature optimization.  Profiling shows that decompressing
and deleting these logs is rather fast and overall CPU utilization is
lower without the added thread.

Test: profile logd with/without this thread
Change-Id: I31bd52077b495d562dd5797585191dc200ad3859
2020-07-14 18:50:45 +00:00
Steven Moreland
3619489de6 Merge "String8: explicit int -> char cast." 2020-07-14 16:30:42 +00:00
Tom Cherry
63e7541faa Merge "logd: update SerializedLogChunk for new prune calcuations" 2020-07-14 01:22:05 +00:00
Tom Cherry
44e1a5d59c logd: update SerializedLogChunk for new prune calcuations
A previous change included sizeof(SerializedLogChunk) to the size of a
log chunk to more accurately track logd's log usage, but did not
update the tests that check this value, so this change updates them
appropriately.

Bug: 161179582
Test: logd-unit-tests
Change-Id: Ic37f07fff98c260dcf39b7cc79504c1c3fc2149d
2020-07-13 17:29:55 -07:00
Steven Moreland
fdbc565dd5 String8: explicit int -> char cast.
Since tolower/toupper take and return integer arguments, ascii chars in
the extended range will be converted from positive int values to
negative char values. In order to silence an error here, which was added
recently with integer sanitization here, casting explicitly.

Fixes: 160831549
Test: w/ libutils_fuzz_string8
Change-Id: Iedcd6643f95f84ce662a80e38931d918a200f508
2020-07-13 23:33:25 +00:00
Treehugger Robot
aa64d3b23f Merge "extend syscall minijail for clang code coverage" 2020-07-13 22:21:12 +00:00
Ray Essick
a20596752c extend syscall minijail for clang code coverage
cutover to clang-based code coverage uses extra system call (ftruncate)
when writing coverage data. exposed while generating coverage for media.extractor.

Bug: 160917521
Test: build, boot, kill -37 extractors for {arm,x86}x{32,64}
Change-Id: I555b168c7aab43caa590df951861b92e8fa14bc3
2020-07-13 13:39:05 -07:00
Tom Cherry
478d93846d Merge "logd: optionally track the full size of log buffers" 2020-07-13 19:34:15 +00:00
Treehugger Robot
5f33339b2f Merge "toolbox: make all janitors the owners." 2020-07-13 17:31:11 +00:00
Michael Wright
71f4494bd1 Merge "Cast away signedness of built-ins in BitSet." 2020-07-13 15:45:40 +00:00
Yo Chiang
9a57044ab3 Merge "Move SingletonTest back to libutils_test" 2020-07-13 03:49:17 +00:00