# Description: Patch LV1 checks
# Option --patch-lv1checks: Disables many checks in lv1
# Type --patch-lv1checks: boolean
namespace eval :: patch_lv1checks {
array set :: patch_lv1checks:: options {
--patch-lv1checks true
}
proc main { } {
set self "lv1.self"
::modify_coreos_file $self :: patch_lv1checks:: patch_self
}
proc patch_self {self} {
if {!$:: patch_lv1checks:: options(--patch-lv1checks)} {
log "WARNING: Enabled task has no enabled option" 1
} else {
::modify_self_file $self :: patch_lv1checks:: patch_elf
}
}
proc patch_elf {elf} {
if {$:: patch_lv1checks:: options(--patch-lv1checks)} {
log "Patching LV1 Checks"
# ss_server1
# Patch core OS Hash check // product mode always on
log "--------------- Patching ss_server1.fself ----------------------------"
log "Patch core OS Hash check // product mode always on"
set search "\x41\x9E\x00\x1C\x7F\x63\xDB\x78\xE8\xA2\x85\x68\ x38\x80\x00\x01"
set replace "\x60\x00\x00\x00\x7F\x63\xDB\x78\xE8\xA2\x85\x68\ x38\x80\x00\x01"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
# Patch check_revoke_list_hash check // product mode always on
log "Patch check_revoke_list_hash check // product mode always on"
set search "\x41\x9E\x00\x1C\x7F\xA3\xEB\x78\xE8\xA2\x85\x68\ x38\x80\x00\x01"
set replace "\x60\x00\x00\x00\x7F\xA3\xEB\x78\xE8\xA2\x85\x68\ x38\x80\x00\x01"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
# In product mode erase standby bank skipped
log "Patch In product mode erase standby bank skipped"
set search "\x41\x9E\x00\x0C\xE8\xA2\x8A\x38\x48\x00\x00\xCC\ x7B\xFD\x00\x20"
set replace "\x60\x00\x00\x00\xE8\xA2\x8A\x38\x48\x00\x00\xCC\ x7B\xFD\x00\x20"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
# Patching System Manager to disable integrity check
log "Patching System Manager to disable integrity check"
set search "\x38\x60\x00\x01\xf8\x01\x00\x90\x88\x1f\x00\x00\ x2f\x80\x00\x00"
set replace "\x38\x60\x00\x00"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
# Patching LV1 to enable skipping of ACL checks for all storage devices
log "Patching LV1 to enable skipping of ACL checks for all storage devices"
set search "\x54\x63\x06\x3e\x2f\x83\x00\x00\x41\x9e\x00\x14\ xe8\x01\x00\x70\x54\x00\x07\xfe"
append search "\x2f\x80\x00\x00\x40\x9e\x00\x18"
set replace "\x38\x60\x00\x01\x2f\x83\x00\x00\x41\x9e\x00\x14\ x38\x00\x00\x01"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
# LV1 0021D0B4@355 patch (?Patch sys_mgr integrity lv1 and lv0 integrity check?)
log "?Patch sys_mgr integrity lv1 and lv0 integrity check?"
set search "\x48\x00\xD7\x15\x2F\x83\x00\x00\x38\x60\x00\ x01"
set replace "\x38\x60\x00\x00\x2F\x83\x00\x00\x38\x60\x00\ x01"
catch_die {:: patch_elf $elf $search 0 $replace} "Unable to patch self [file tail $elf]"
}
}
}