Commit graph

81125 commits

Author SHA1 Message Date
Mateus Azis
1a2f73d76a Improve the formatting for init's README.
Make sure the arguments to "mkdir" show up in the same block.

Before: c3a119caa3/init/README.md
After: https://android.googlesource.com/platform/system/core/+/refs/changes/60/2528060/1/init/README.md

Test: N/A
Change-Id: I88b4931e70e2793566cce53c38c0295168463971
2023-04-06 13:46:35 -07:00
Thiébaud Weksteen
c3a119caa3 Merge "Skip newlines for SELinux logs" 2023-04-05 23:37:51 +00:00
Kevin Jeon
2a70a7432c Merge "Add pointer dereference in debuggerd error msg" 2023-04-05 22:34:51 +00:00
Kevin Jeon
06af624e66 Add pointer dereference in debuggerd error msg
This change adds a missing pointer dereference to the InterceptResponse
when checking for a size mismatch.

Test: build
Bug: N/A
Change-Id: I88afed6f1c0f33fe237d337b0fb8fc0a0c0e3bac
2023-04-05 16:32:39 -04:00
Thiébaud Weksteen
f03dde8549 Skip newlines for SELinux logs
libselinux log messages usually end with a new line character. Android
log system does not require the new line character and will include the
character as-is in the log buffer.

This trimming was already implemented when the message is typed as
SELINUX_AVC (see SelinuxAvcLog). Move the truncation one level up so it
is occurring for all types of logs.

Test: boot & adb logcat & inspect SELinux logs
Change-Id: I360359c1b178ef24d555dd41f8d4a18b293a175c
2023-04-05 09:32:18 +10:00
Treehugger Robot
b2fdbef489 Merge "Revert "Cleaned up some slot logic"" 2023-04-03 21:49:25 +00:00
Kelvin Zhang
2a4a45f3e4 Revert "Cleaned up some slot logic"
This reverts commit bd85a18d0b.

Reason for revert: b/276759363

Change-Id: I3ba08cf4abeeb7769569512d50e7ff135438cf20
2023-04-03 20:44:05 +00:00
Treehugger Robot
6fac9acf2c Merge "Allow libmodprobe to be used by host binaries" 2023-04-01 03:49:04 +00:00
Treehugger Robot
1c324d3559 Merge "Handle with the nonnull case in a tricky way" 2023-04-01 02:46:24 +00:00
zijunzhao
fa8037c207 Handle with the nonnull case in a tricky way
The func readdir() is not allowed to pass a nullptr.
Bug: b/245972273
Test: mm

Change-Id: Idbb3f552b026dc6d727886d22989d3359ed6633b
2023-03-31 23:50:37 +00:00
mingzhu.wang
d5d7d20d3b dmctl: add repalce command to usage list
If you need to use the replace command, but you can't find it in the
usage list.

Change-Id: I8618ce4b0eff30507fc8846f76aaf858b1a6895e
Signed-off-by: mingzhu.wang <mingzhu.wang@transsion.com>
2023-03-31 15:20:06 +08:00
Daniel Zheng
b16aba889a Merge "Cleaned up some slot logic" 2023-03-30 21:49:15 +00:00
Daniel Zheng
719caca725 Merge "Added some error logs to wipe" 2023-03-30 21:30:11 +00:00
Daniel Zheng
76c9343339 Cleaning up main code
cleaning up main() code in fastboot.cpp to run off one task vector. The
eventual goal is to just have all functionality run off this vector.

Test: tested commands on raven
Bug: 194686221
Change-Id: I98d0ba33091eff31ff1bc338766c3689ffb54746
2023-03-30 18:35:14 +00:00
Daniel Zheng
1418fb8ce0 Correcting Reboot Task Functionality
Modifying fastboot-info.txt to directly call reboot fastboot instead of
reboot userspace -> so no longer need "userspace" in reboot task. Also
moving skip_reboot check to task since in old code we can have
skip_reboot be true and still reboot to bootloader, fastboot, or
recovery

Test: tested reboot commands on Raven
Change-Id: I98ba51747bf7229a88ba737540c81d20b42e5981
2023-03-30 18:35:14 +00:00
Daniel Zheng
4aa47338f2 Merge "Added check to copy AVB footer" 2023-03-30 18:24:31 +00:00
Daniel Zheng
bd85a18d0b Cleaned up some slot logic
Doesn't look like we actually need current_slot, since we can always
just call function get_current_slot

Test: tested flashall on raven
Change-Id: Icba64bc9fdd08f36d44965e32558a73d0beab0e1
2023-03-30 18:21:28 +00:00
Daniel Zheng
6f213b2c79 Added some error logs to wipe
Changed so if we call wipe on a partition that doesn't exist we'll get
some helpful error messages.

Test: tested wipe test
Bug: 194686221
Change-Id: I19dc0396a7a98d0b2be7859edbffeb8acdc9850a
2023-03-30 18:19:04 +00:00
Daniel Zheng
e33e8a8685 Added check to copy AVB footer
is_logical shouldn't work in bootloader for some devices, so we also need to check
using should_flash_in_userspace to see if partition is dynamic

Test: tested to flash {partition} on raven and checked to see avb
footers are not copied from dynamic partitions

Change-Id: Iabb3ea535fa80b26cf1c08040beb3d4ea5e8c2ae
2023-03-30 18:19:04 +00:00
Kelvin Zhang
bdd595f0f9 Allow libmodprobe to be used by host binaries
Cuttlefish tooling need libmodprobe to determine if a kernel module is
signed.

Bug: 273752147
Test: th
Change-Id: Icea49802d032b27bd89ed8f0bee1bc4814298774
2023-03-29 15:29:02 -07:00
Mitch Phillips
5a2a302108 Merge "[debuggerd] New protocol to AM to handle recoverable crashes." 2023-03-29 20:28:35 +00:00
Treehugger Robot
c1798def91 Merge "libprocessgroup: Check validity of uid and pid arguments" 2023-03-29 19:49:18 +00:00
Vova Sharaienko
a662169c44 Merge "[TeX] Introduced Telemetry Express Logging APIs" 2023-03-28 22:05:28 +00:00
Treehugger Robot
c631556363 Merge "Updated fuzz_config in Android.bp file" 2023-03-28 04:05:22 +00:00
Lingxue Luo
1295d2e8bb Merge "Add ability to automatically bootup" 2023-03-24 21:41:06 +00:00
Vova Sharaienko
c246440dc5 [TeX] Introduced Telemetry Express Logging APIs
- provided C++ Histogram metric logging API with UID

Bug: 266586106
Test: m
Change-Id: I2ee92d423be5f9c137fa160d8c744340972f8036
2023-03-24 21:39:53 +00:00
Mike McCreavy
5766fe7dee Add ability to automatically bootup
Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Upstreaming from Wear: b/272526799
Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:82d8011f170d5b1c936d117f4fb74836333714b6)
Merged-In: I98f37a840a43cb5216319457027b76fc493e3f62
Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62

NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
0,6 +620,18 @@
         kick_animation(&batt_anim_);
     }
     health_info_ = health_info;
+
+    if (property_get_bool("ro.charger_mode_autoboot", false)) {
+        if (health_info_.battery_level >= boot_min_cap_) {
+            if (property_get_bool("ro.enable_boot_charger_mode", false)) {
+                LOGW("booting from charger mode\n");
+                property_set("sys.boot_from_charger_mode", "1");
+            } else {
+                LOGW("Battery SOC = %d%%, Automatically rebooting\n", health_info_.battery_level);
+                reboot(RB_AUTOBOOT);
+            }
+        }
+    }
 }

 int Charger::OnPrepareToWait(void) {

Original patch:
From 82d8011f170d5b1c936d117f4fb74836333714b6 Mon Sep 17 00:00:00 2001
From: Alice Sheng <alicesheng@google.com>
Date: Fri, 18 Mar 2022 10:25:31 -0700
Subject: [PATCH] Add ability to automatically bootup

Based on a new system property. This won't change any behavior if that
new system property isn't set.

Ignore-AOSP-First: WearOS specific change

Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots

Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62
(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
---
2023-03-24 17:22:17 +00:00
David Tracy
691d805d30 bootstat: Adds additional reboot reason patterns
- Adding allowance for arbitrary ota subreason details, such as
  success or failure conditions
- Adding the new subreason "periodic", which is useful for POS devices
  which require e.g. daily reboots as part of security requirements
Test: Full Android build

Change-Id: Id0a6d38ed902e2b25fbb050980c763912c948f27
Signed-off-by: David Tracy <dtracy@squareup.com>
2023-03-24 09:04:07 -07:00
Eric Biggers
aa70ac106a Merge "libsparse: fix double free after block splitting" 2023-03-24 00:39:04 +00:00
Eric Biggers
ef4507b6c8 libsparse: fix double free after block splitting
Due to https://r.android.com/1310496, sparse_file_write() splits all
blocks larger than 64 MiB.  However, the code that splits file-backed
blocks copies the pointer to the filename without duplicating the
underlying memory, causing a double free in backed_block_destroy()
later.  Fix this by using strdup().  Also, as long as that is being
fixed, also check for failure.

Test: SANITIZE_HOST=address mmm external/e2fsprogs
      mkdir mnt
      mkfs.ext4 img 1G
      sudo mount img mnt
      sudo cp /dev/urandom mnt/file
      sudo umount mnt
      ext2simg img simg

Before this fix it gave:

    ==2216498==ERROR: AddressSanitizer: attempting double-free on 0x602000000090 in thread T0:
        #0 0x55a52454c9a2 in free out/stage2/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/out/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
        #1 0x7ffa247c82ee in backed_block_destroy(backed_block*) system/core/libsparse/backed_block.cpp:106:5
        #2 0x7ffa247c82ee in backed_block_list_destroy(backed_block_list*) system/core/libsparse/backed_block.cpp:124:7
        #3 0x7ffa247cd055 in sparse_file_destroy system/core/libsparse/sparse.cpp:49:3
        #4 0x55a524587b75 in main external/e2fsprogs/contrib/android/ext2simg.c:239:2

Change-Id: I4607ef5adcf6512645342beaf91aff6033414e54
2023-03-23 20:23:00 +00:00
David Anderson
e74976cccd Merge changes Ib90ae553,I3ca3ad9c
* changes:
  RESTRICT AUTOMERGE: snapuserd: Remove DaemonOps.
  RESTRICT AUTOMERGE: snapuserd: Split the server into two classes.
2023-03-23 18:29:40 +00:00
David Anderson
b634c6f527 Merge "Remove unused variable mount_point" 2023-03-23 15:39:49 +00:00
David Anderson
0172b1cc34 snapuserd: Remove legacy xor code.
Legacy snapuserd had xor optimizations implemented since at the time the
userspace snapshot implementation was a work in progress. We forgot to
ultimately remove the legacy xor code however, so let's do that now.

This should have no impact on devices. An S-frozen device will not be
getting this code because there's no vendor update happening. A T-frozen
device will be using userspace snapshots.

The only scenario this could happen is if a device starts on S vendor,
upgrades to T vendor, enables xor compression, and then updates to U
vendor. This configuration is not supported. Any device with a T+ vendor
should be using userspace snapshots.

Bug: N/A
Test: vabc_legacy_tests
Change-Id: If484a53cb0527393898a7ea703ba6f12d4c9a310
2023-03-23 14:46:28 +00:00
Bart Van Assche
f94035552f Merge "[DO NOT MERGE] Migrate the blkio controller to the v2 cgroup hierarchy" 2023-03-23 13:47:34 +00:00
Ayushi Khopkar
33ff88f9c3 Updated fuzz_config in Android.bp file
Added new fields in fuzz_config like - hotlists,
description, vector, service_privilege, users, fuzzed_code_usage, etc.

Bug: 271384401
Test: Build fastboot_fuzzer

Change-Id: I7799ffcb7f11202711b19cf40e8c05e050d3b519
2023-03-23 16:06:24 +05:30
zhangyongpeng
18b3fda9b7 Remove unused variable mount_point
Since aosp/929692, this variable has been discard.

Test: manual

Signed-off-by: zhangyongpeng <zhangyongpeng@xiaomi.com>
Change-Id: I164766c9af06c0c19bc19b258cb866ed7cf36853
2023-03-23 14:14:21 +08:00
Bart Van Assche
5a3c3f7ccf libprocessgroup: Check validity of uid and pid arguments
A user ID (uid) must be greater than or equal to zero to be valid. Only
strictly positive process IDs are valid. Add argument checks in
libprocessgroup of uid and pid arguments to make it easier to determine
the origin of invalid arguments.

Change-Id: I8a6d96ca4576bc9c329498c6a804dd05a02afca5
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-03-22 18:35:41 -07:00
David Anderson
1f527c34dd RESTRICT AUTOMERGE: snapuserd: Run snapuserd threads in-process.
This removes the temporary daemon and socket and instead directly embeds
SnapshotHandlerManager. We can also remove the test flags for io_uring
as with this they're no longer necessary.

Bug: 269361087
Test: snapuserd_test
Change-Id: I728186d9bc90c98fabd76d3f86569840488ada96
2023-03-22 19:30:11 +00:00
David Anderson
369c993f5d RESTRICT AUTOMERGE: snapuserd: Remove DaemonOps.
These are only used for a single switch statement. Just compare the
input strings instead.

Bug: 269361087
Test: builds, ota applies

Change-Id: Ib90ae55309ea99c181585c64ed2ac814e5ed6c72
2023-03-22 19:30:04 +00:00
David Anderson
4983e1d33c RESTRICT AUTOMERGE: snapuserd: Split the server into two classes.
This splits server into two classes: one that handles the IPC requests,
and one that managers snapshot handlers. This will allow embedding of
the snapshot handling code, without booting up a server. It'll also make
testing much easier.

The handler code has been further placed behind a virtual interface,
though this is likely unnecessary unless we start testing the server
logic itself (or attempt to unify the S and T+ versions of snapuserd).

Bug: 269361087
Test: ota
Change-Id: I3ca3ad9c8c1fb910a1c7bf9f44165e2f44c930c9
2023-03-22 19:29:15 +00:00
Bart Van Assche
eef0f563fd [DO NOT MERGE] Migrate the blkio controller to the v2 cgroup hierarchy
There are multiple use cases in Android for which background writes need
to be controlled via the cgroup mechanism. The cgroup mechanism can only
control background writes if both the blkio and memcg controllers are
mounted in the v2 cgroup hierarchy. Hence this patch that migrates the
blkio controller from the v1 to the v2 cgroup hierarchy.

The blkio controller has been marked as optional since not all Android
kernels enable this controller (CONFIG_BLK_CGROUP).

This patch increases the TOTAL_BOOT_TIME for devices with a 4.19 kernel
(redfin) from 18.9 s to 20 s. This patch does not affect the boot time
for devices with a 5.10 or 5.15 kernel.

This patch increases the time spent in CgroupMap::ActivateControllers()
by 25 microseconds in Cuttlefish on an x86-64 CPU.
CgroupMap::ActivateControllers() is called by Service::Start().

Bug: 213617178
Test: Cuttlefish and various phones
Change-Id: I3c07c1be84c3feb277b7d7003652d5d3b57c6541
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-03-22 11:39:53 -07:00
David Anderson
ecdbbbda82 Merge changes Ie68aed2f,Ic40696b3
* changes:
  fastboot: Handle libsparse failures better.
  libsparse: Fix allocation failures on 32-bit systems.
2023-03-22 00:02:13 +00:00
Elliott Hughes
3b1e71c63b Merge "riscv64: fix debuggerd_test build." 2023-03-21 18:56:36 +00:00
Shikha Panwar
e11ab73647 Merge "Add tombstone_handler for crashes in Microdroid" 2023-03-21 18:14:12 +00:00
Elliott Hughes
2077cea07d Merge "riscv64: fix mips-ism." 2023-03-21 16:58:19 +00:00
David Anderson
49cc3f0784 Merge "libsparse: Propagate failures when resparsing files." 2023-03-21 15:48:44 +00:00
Daniel Zheng
bf18673dee Merge changes I82ac2392,Ie0dd7acd,I8018e48f
* changes:
  Updating Flashall to work off tasks
  Updated location of initialization
  Updating FlashTask to require img-name
2023-03-21 01:59:33 +00:00
Vova Sharaienko
0ffaad7007 Merge "[TeX] Introduced Telemetry Express Logging APIs" 2023-03-21 01:14:36 +00:00
Armelle Laine
8a42990cc6 Merge "trusty: Add trusty stats test" 2023-03-21 00:51:30 +00:00
Elliott Hughes
857e29c356 riscv64: fix debuggerd_test build.
This adds the missing assembler for riscv64, even though I don't have a
working tombstoned yet to test it with. There's a distinct possibility
we'll be back to fix the test (because although "register 1" is harmless
for the other architectures, it's the ra register on riscv64; the default
link register), but at least this lets us build the test.

I've also simplified all the assembly to be the simplest sequence I
know that writes 0 to address 0 (because if there was a reason to use
so many instructions before, I want to know what it is so I can write
the missing comment!).

Test: treehugger
Change-Id: I10d117eaedf361d9759a450e0973d07c4f97090e
2023-03-20 17:48:53 -07:00