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
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
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
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
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
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
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
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
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
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
The mount_all and swapon_all commands are documented, but umount_all
is not. Add some documentation.
Bug: 142424832
Change-Id: I7e4dcb4d222b787350a79c9e312062cac9eeb4d8
It's error-prone, and our specific usage of it here upsets ubsan.
Bug: https://issuetracker.google.com/158428513
Test: treehugger
Change-Id: I3a6b68865e6b4c37ac005f5f24c3d6e1de7c5bac
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
Bug: 153761317
Test: logging works normally without --uid
Test: logging filters based on uid with --uid
Change-Id: I6843fa635831c727c0236ac5534862e11447484b
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
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
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
Adding the function, fs_mgr_wait_for_file(), to ensure the
device file exists before to mount
Bug: 154278078
Change-Id: I74a68224073932773be18a79f9334d83ea5b6947
The keys are already available when iterating through the maps, so
this only serves to waste memory.
Test: unit tests
Change-Id: Iaf4e389eb0f0990e7113cd78be1773e767a356d4
We can use libbase logging to output to the kernel log instead of the
'prdebug' function, so use that instead.
Bonus #1: we can now use CHECK().
Bonus #2: logging unit tests automatically output to stderr.
Bonus #3: We see dependent library's logs instead of losing them to
the void.
Test: logging unit tests
Test: logs show appropriately in dmesg / stderr
Test: CHECK() works
Change-Id: I92f8056b4820dc4998996cf46460568085299700