Snap for 7801109 from 4224e6af27 to sc-d2-release

Change-Id: Id902eb2ad7abc1af74bc919f49b6aa5037f12f40
This commit is contained in:
Android Build Coastguard Worker 2021-10-07 02:18:23 +00:00
commit 735c264fa5
2 changed files with 30 additions and 1 deletions

View File

@ -27,6 +27,7 @@
#include <sys/mount.h>
#include <sys/signalfd.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
@ -554,6 +555,19 @@ static void SetUsbController() {
}
}
/// Set ro.kernel.version property to contain the major.minor pair as returned
/// by uname(2).
static void SetKernelVersion() {
struct utsname uts;
unsigned int major, minor;
if ((uname(&uts) != 0) || (sscanf(uts.release, "%u.%u", &major, &minor) != 2)) {
LOG(ERROR) << "Could not parse the kernel version from uname";
return;
}
SetProperty("ro.kernel.version", android::base::StringPrintf("%u.%u", major, minor));
}
static void HandleSigtermSignal(const signalfd_siginfo& siginfo) {
if (siginfo.ssi_pid != 0) {
// Drop any userspace SIGTERM requests.
@ -824,6 +838,7 @@ int SecondStageMain(int argc, char** argv) {
export_oem_lock_status();
MountHandler mount_handler(&epoll);
SetUsbController();
SetKernelVersion();
const BuiltinFunctionMap& function_map = GetBuiltinFunctionMap();
Action::set_function_map(&function_map);

View File

@ -590,9 +590,23 @@ on late-fs
# Load trusted keys from dm-verity protected partitions
exec -- /system/bin/fsverity_init --load-verified-keys
# Only enable the bootreceiver tracing instance for kernels 5.10 and above.
on late-fs && property:ro.kernel.version=4.9
setprop bootreceiver.enable 0
on late-fs && property:ro.kernel.version=4.14
setprop bootreceiver.enable 0
on late-fs && property:ro.kernel.version=4.19
setprop bootreceiver.enable 0
on late-fs && property:ro.kernel.version=5.4
setprop bootreceiver.enable 0
on late-fs
# Bootreceiver tracing instance is enabled by default.
setprop bootreceiver.enable ${bootreceiver.enable:-1}
on property:ro.product.cpu.abilist64=* && property:bootreceiver.enable=1
# Set up a tracing instance for system_server to monitor error_report_end events.
# These are sent by kernel tools like KASAN and KFENCE when a memory corruption
# is detected.
# is detected. This is only needed for 64-bit systems.
mkdir /sys/kernel/tracing/instances/bootreceiver 0700 system system
restorecon_recursive /sys/kernel/tracing/instances/bootreceiver
write /sys/kernel/tracing/instances/bootreceiver/buffer_size_kb 1