Commit graph

80276 commits

Author SHA1 Message Date
Stephen Crane
0255766d6b storageproxyd: Add watchdog to log stuck requests
Adds a background watchdog thread to the Trusty storageproxy to monitor
and log any requests that are delayed for too long. This is intended to
assist in recognizing and debugging any sources of hangs related to
servicing Trusty storage requests in Android.

Test: Add sleep() and run trusty storage tests
Bug: 266595872
Change-Id: I98dfaff0dff04f97d5c657ee131e746f63b39739
2023-02-06 21:39:19 +00:00
Alex Hong
4c80eb13aa Merge "Reland "Set the log callback earlier for showing system property set denials"" 2023-02-02 14:04:35 +00:00
Kelvin Zhang
a0427c41c1 Merge "Set output value in error case" 2023-02-02 03:59:16 +00:00
Greg Kaiser
451dfee3c7 Set output value in error case
We want to set the contents of "out_size_num_byte", and not
the pointer value, in the error case.

Bug: 266757931
Change-Id: I02edddcbcc4fc80dbb61efe8dc7c45bd3ce1c904
Test: TreeHugger
2023-02-02 00:05:21 +00:00
David Anderson
7cf627bac9 Merge changes Ib744d763,I74278bb5,I3d240d6e,I1b41d233
* changes:
  fastboot: Move some helpers into util.h/.cpp.
  fastboot: Allow using LOG().
  fastboot: Use RAII for sparse_file objects.
  liblp: Add a helper class for building sparse-compatible super image layouts.
2023-02-01 21:27:03 +00:00
David Anderson
4c96a1673e Merge "OTA: make lp_metadata write more atomic" 2023-02-01 19:54:44 +00:00
David Anderson
aa87dc5a0d fastboot: Move some helpers into util.h/.cpp.
Bug: 266982466
Test: builds
Change-Id: Ib744d763e11d8a7f7e3f417b331defff61fe4559
2023-02-01 11:28:16 -08:00
Edward Liaw
b52704a608 Merge "sched_policy_test: set_sched_policy also set the cpuset policy as fallback" 2023-02-01 19:19:19 +00:00
David Anderson
a67fc32a8a fastboot: Allow using LOG().
The die() and verbose() macros are not really standard for AOSP. To
allow a gradual transition off them, call InitLogging on startup. This
will also allow seeing liblp logs when -v is passed.

Bug: 266982466
Test: builds
Change-Id: I74278bb5f698edb0dc81477a575b130b0bd11cdf
2023-02-01 11:09:29 -08:00
David Anderson
a1c983e800 fastboot: Use RAII for sparse_file objects.
Bug: 266982466
Test: fastboot flash
Change-Id: I3d240d6ecc8a37d968ffdef9d50e349e787e8d3e
2023-02-01 11:09:28 -08:00
Christopher Ferris
df10bfa19f Merge "Display offset in backtraces if necessary." 2023-02-01 18:12:12 +00:00
Zhou Xuezan
45eee7fe52 OTA: make lp_metadata write more atomic
Powerloss of OS failure occurs when super is merging,
then the device can't bring up again for no lp_metadata sync,
so make lp_metadata sync in time.

Change-Id: I1ea31662b838e35022a566b614796f2d5e05df4b
Signed-off-by: Jia Jia <jia.jia@zte.com.cn>
2023-02-01 08:17:38 +00:00
Edward Liaw
d5ffbdfc56 sched_policy_test: set_sched_policy also set the cpuset policy as fallback
get_sched_policy uses the cpuset policy as fallback if the cpu cgroup
is not recognized.  Pixel is currently not using the cpu cgroup for
background policy due to b/208895940.

Bug: 265852986
Test: atest libcutils_test:libcutils_test.SchedPolicy#set_sched_policy -- --abi arm64-v8a
Change-Id: Ia77ace7513c48b1a14290c6ecc0222b46d6bf927
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-02-01 03:06:45 +00:00
David Anderson
e6cef616f1 liblp: Add a helper class for building sparse-compatible super image layouts.
This class helps export a list of regions comprising a super partition,
and what the contents of those regions should be. It is very similar to
ImageBuilder, except that it does not require actual partition image
files, nor does it actually write an image file to disk.

The goal is to support building an in-memory super image that uses as
little memory and backing storage as possible. For example, fastboot can
use this to upload a super image without having to read and write
gigabytes of unnecessary data.

Since the goal is to optimize fastboot, we've taken some shortcuts here.
Retrofit devices and other edge-casey behavior are safely rejected. We
also don't rely on libsparse behavior here, and attempt to make the
translation to sparse records as trivial as possible, by explicitly
declaring where fill/dontcare gaps are, and only exporting 4KB aligned
regions. Hopefully this will allow the code to be portable to
non-fastboot consumers.

Bug: 266982466
Test: liblp_test
Change-Id: I1b41d233bc4512c4b62e19603e8e77bc5867cfab
2023-01-31 18:46:35 -08:00
Christopher Ferris
22035ccb01 Display offset in backtraces if necessary.
When moving to a proto tombstone, backtraces no longer contain
an offset when a frame is in a shared library from an apk.
Add the offset display again if needed, and add a test to
verify this behavior.

Bug: 267341682

Test: All unit tests pass.
Test: Dumped a process running through an apk to verify the offset
Test: is present.
Change-Id: Ib720ccb5bfcc8531d1e407f3d01817e8a0b9128c
2023-01-31 17:53:45 -08:00
Treehugger Robot
06a150b9f5 Merge "Report partition sizes to avb" 2023-01-31 20:07:54 +00:00
Hongwei Wang
a1db003a29 Merge "Grant wmtrace access to platform_app:systemui" 2023-01-31 19:38:15 +00:00
Kelvin Zhang
dbc4a788f7 Report partition sizes to avb
This might allow avb to save some memory by only allocate as much memory
needed to hold the partition data, instead of allocating for maximum
possible partition size(64K).

Bug: 266757931

Change-Id: I82a4b1ba3544910072050e45a7cb91e0dcbc4d05
2023-01-31 10:20:25 -08:00
Alex Hong
057b94215a Reland "Set the log callback earlier for showing system property set denials"
PropertyInit loads the build.prop files and set the system properties.
Set the SELinux log callback before that to show the avc denials for debugging.

Test: $ make init_system
      Push this module and ensure system property set denials are shown during boot
Bug: 185920634
Bug: 211547922
Change-Id: If9f34d469d3da2ebdfe64bb611de85a3ca37e000
2023-01-31 22:11:16 +08:00
Yi-yo Chiang
1946945ac0 Merge "fs_mgr: Add one space between [libfs_mgr] tag and log msg" 2023-01-31 09:42:32 +00:00
Yi-Yo Chiang
bc851b6dbf fs_mgr: Add one space between [libfs_mgr] tag and log msg
This is but a cosmetic change. Before:

> [libfs_mgr]__mount(...

After:

> [libfs_mgr] __mount(...

Also change liblp, libfs_avb and libvbmeta.

Bug: 241688845
Test: Presubmit
Change-Id: I7d408a94a7fe279d9b65d699e22159b167f34526
2023-01-31 09:41:43 +00:00
Hongwei Wang
231e80db35 Grant wmtrace access to platform_app:systemui
Grant read/write access to anyone for /data/misc/wmtrace folder on
debuggable builds, it's further protected by the selinux policy.

This is to allow systemui process to write proto logs to the same folder
on device as WindowManager, both can contribute to the transitions like
PiP, Split-Screen and etc.

Bug: 251513116
Test: adb shell dumpsys activity service SystemUIService \
      WMShell protolog [start | stop]
Change-Id: Ice57efa17c61d132b02c0a11a762c24d772bd90a
2023-01-30 12:03:54 -08:00
Vincent Donnefort
d34157e26e Merge "toolbox/modprobe: Fallback to /lib/modules/<uname>" 2023-01-27 17:35:01 +00:00
Vincent Donnefort
8320778425 toolbox/modprobe: Fallback to /lib/modules/<uname>
Make the module directory optional by reading the kernel release
version. This path is where the kernel installs modules by default.
Similar behaviour can be found in several modprobe implementations.

Bug: 254835242
Change-Id: I61707636705e5b4d9bd8ccf6351e7057eae6bcf5
2023-01-27 12:58:50 +00:00
Treehugger Robot
545141f405 Merge "qtaguid.cpp - improvements" 2023-01-27 07:25:57 +00:00
Maciej Żenczykowski
a5083ab7a7 qtaguid.cpp - improvements
Resolves a pair of TODO's, and makes a pair of error return
code paths not return null function pointers.

Note that:
  system/netd/client/NetdClient.cpp
implements this as:

int checkSocket(int socketFd) {
    if (socketFd < 0) {
        return -EBADF;
    }
    int family;
    socklen_t familyLen = sizeof(family);
    if (getsockopt(socketFd, SOL_SOCKET, SO_DOMAIN, &family, &familyLen) == -1) {
        return -errno;
    }
    if (!FwmarkClient::shouldSetFwmark(family)) {
        return -EAFNOSUPPORT;
    }
    return 0;
}

$define CHECK_SOCKET_IS_MARKABLE(sock) \
    do {                               \
        int err = checkSocket(sock);   \
        if (err) return err;           \
    } while (false)

extern "C" int tagSocket(int socketFd, uint32_t tag, uid_t uid) {
    CHECK_SOCKET_IS_MARKABLE(socketFd);
    FwmarkCommand command = {FwmarkCommand::TAG_SOCKET, 0, uid, tag};
    return FwmarkClient().send(&command, socketFd, nullptr);
}

extern "C" int untagSocket(int socketFd) {
    CHECK_SOCKET_IS_MARKABLE(socketFd);
    FwmarkCommand command = {FwmarkCommand::UNTAG_SOCKET, 0, 0, 0};
    return FwmarkClient().send(&command, socketFd, nullptr);
}

which means it *already* verifies that the passed in sockfd
is >= 0 and a socket via getsockopt(SOL_SOCKET, SO_DOMAIN),
as such the 'fcntl(sockfd, F_GETFD)' check is spurious.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I91ef68be5b0cc6b1972d514c13a76eaf834a3d5d
2023-01-26 22:39:04 +00:00
Dai Li
03ddd96b48 Merge "Add libtrusty to recovery image" 2023-01-26 20:05:12 +00:00
Treehugger Robot
1eaf3302ff Merge changes I091d3dc9,Id06e4329
* changes:
  [MTE] add link to SAC docs to tombstones
  [Refactor] move memory map printing to helper
2023-01-26 04:30:52 +00:00
Dai Li
17ac2b6061 Add libtrusty to recovery image
Make libtrusty available to boot control

Bug: 232277507
Change-Id: Ie6a83fd37689c09c5f0542fa9bbead6c5326f309
2023-01-26 02:45:36 +00:00
Florian Mayer
1d79a07586 [MTE] add link to SAC docs to tombstones
Test: m, flash, look at tombstone
Change-Id: I091d3dc9207d0ba7e692dcc28adc04aec33cf336
2023-01-26 02:09:57 +00:00
Florian Mayer
8b91862b8f [Refactor] move memory map printing to helper
An early return out of this function makes it harder to add new prints
after the memory maps.

Test: m, flash, look at tombstone
Change-Id: Id06e432918d69ac3307761b244473b6b7ab769e8
2023-01-26 01:39:15 +00:00
David Anderson
09545d1454 Merge "libdm: Remove dm_linear_fuzzer." 2023-01-25 18:05:25 +00:00
Treehugger Robot
4b0091cc8e Merge "Remove RemoteProvsioner tests from presubmit" 2023-01-25 17:29:43 +00:00
Seth Moore
ac5638bdbb Remove RemoteProvsioner tests from presubmit
RemoteProvsioner is deprecated, and already disabled/non-functional
on some builds. Turn off the tests because they are causing spurious
presubmit failures.

Test: n/a
Bug: 266181756
Change-Id: I9b8d3e742ef2b2448a798b1e96b6f3e02695e2be
2023-01-25 08:14:16 -08:00
Vincent Donnefort
0359833014 Merge "Add ramdisk_node_list" 2023-01-25 12:20:08 +00:00
David Anderson
b888430f15 libdm: Remove dm_linear_fuzzer.
This fuzzer can only mutate the numerical inputs to a dm-linear table,
which is unlikely to find kernel bugs, and very unlikely to find libdm
bugs. There are a number of automated notifications from it due to
making ASSERT_EQ a no-op, which causes misuse of libdm API calls. None
of these appear to be real bugs.

Bug: 174907083
Test: N/A
Change-Id: Iaa8955eaa4423e4315b8cb74741e6425a56cc303
2023-01-24 21:37:18 -08:00
David Anderson
0c1d449f29 Merge "libsnapshot: Test more configurations in presubmit." 2023-01-25 00:07:43 +00:00
David Anderson
f723ef3043 Merge "libdm: Fix failing test on older kernels." 2023-01-24 23:51:08 +00:00
David Anderson
124d980aad libsnapshot: Test more configurations in presubmit.
Take 2: remove the shell script, which wasn't working very well, and
just provide different builds of the same binary.

Bug: 208944665
Test: presubmit
Change-Id: I994a93e4e364bc210ddd2eb60025c656caa86b1c
2023-01-24 14:11:00 -08:00
Vincent Donnefort
79ac2ad6d4 Add ramdisk_node_list
This file contains a description of dev nodes added to the CPIO archive
for the Android ramdisks. /dev/null is a security requirement for
bionic, /dev/console is needed so the kernel can set-up stdout stderr
and stdin before running /init.

Bug: 254835242
Change-Id: I111e2db53fabd63d070b8e9ab9c52faebf484ab3
2023-01-24 18:36:43 +00:00
David Anderson
717b97a201 libdm: Fix failing test on older kernels.
This test was added only for behavior introduced in the 5.15 kernel, where uevents are delayed until a table is laoded.

Bug: 263291020
Test: libdm_test
Change-Id: I6236c4304d8e6b780704df405290f7361d5827cc
2023-01-24 05:20:57 +00:00
Treehugger Robot
1e53806ad9 Merge changes from topic "251425963"
* changes:
  BatteryMonitor: fix build error with health hal v2 updraged
  fastboot: Update health AIDL HAL to V2
  storage: Update health AIDL HAL to V2
  BatteryMonitor: get battery health data from sys file nodes
2023-01-24 00:52:34 +00:00
Jack Wu
2ed5c9c1a7 BatteryMonitor: fix build error with health hal v2 updraged
libbatterymonitor_V1 is used for some libraries linking health
aidl_interface V1 but at the same time BatteryMonitor also uses
battery hal V2 structure, it will cause compiling error.

Folk BatteryMonitor is also required along with folk libbatterymonitor

Bug: 251425963
Test: build
Change-Id: I796db83b1a67ad63e7f75f966e829a790b5c9c89
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:28:23 +08:00
Jack Wu
0635794d2d fastboot: Update health AIDL HAL to V2
Bug: 251425963
Test: Build
Change-Id: I538ebee69ebe69a1ad1fa934bb7440ef12fc2cc2
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:21:00 +08:00
Jack Wu
ef38a14bef storage: Update health AIDL HAL to V2
Bug: 251425963
Test: Build
Change-Id: I477023edb68fdefdce5a46bde2bd1538e58c5c21
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:20:41 +08:00
Jack Wu
e561d03cdf BatteryMonitor: get battery health data from sys file nodes
Requirements for battery health aidl hal v2, include sysfs nodes:
  - Battery state of health
  - Charging state
  - Charging policy
  - Date of manufacturing of the battery
  - Date of first use of the battery

and functions
  - setChargingPolicy
  - getChargingPolicy
  - getBatteryHealthData

Bug: 251425963
Test: m
Change-Id: I210dc403ba95b1b75759227f84bc32f32be1bbaf
Signed-off-by: Jack Wu <wjack@google.com>
2023-01-21 15:20:19 +08:00
Florian Mayer
3d11890797 Merge "[MTE] warn about async crashes being imprecise" 2023-01-20 02:12:42 +00:00
Florian Mayer
5fcdfd2504 [MTE] warn about async crashes being imprecise
Bug: 175335730
Change-Id: If666c98b53dee1c63c48887f4448bc54f78a0a9f
2023-01-20 00:33:29 +00:00
Eric Biggers
90b384adb7 Merge "bootstat.rc: remove trigger that logged post_decrypt_time_elapsed" 2023-01-18 19:44:44 +00:00
Eric Biggers
381c884a96 Merge "Clean up references to FDE in documentation and comments" 2023-01-18 19:43:50 +00:00