xref: /aosp_15_r20/system/extras/mtectrl/mtectrl.rc (revision 288bf5226967eb3dac5cce6c939ccc2a7f2b4fe5)
1# Copyright (C) 2022 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15on property:arm64.memtag.bootctl=* && property:ro.arm64.memtag.bootctl_supported=1
16  wait_for_prop arm64.memtag.bootctl_loaded 1
17  exec -- /system/bin/mtectrl ${arm64.memtag.bootctl:-none} ${persist.device_config.runtime_native_boot.bootloader_override:-default}
18
19on property:persist.device_config.runtime_native_boot.bootloader_override=* && property:ro.arm64.memtag.bootctl_supported=1
20  wait_for_prop arm64.memtag.bootctl_loaded 1
21  exec -- /system/bin/mtectrl ${arm64.memtag.bootctl:-none} ${persist.device_config.runtime_native_boot.bootloader_override:-default}
22
23# adbd gets initialized in init, so run before that. this makes sure that the
24# user does not change the value before we initialize it
25on early-boot && property:ro.arm64.memtag.bootctl_supported=1
26  exec_background -- /system/bin/mtectrl -s arm64.memtag.bootctl -f arm64.memtag.bootctl_loaded
27
28on shutdown && property:ro.arm64.memtag.bootctl_supported=1 && property:arm64.memtag.bootctl_loaded=*
29  # This doesn't use wait_for_prop to not stall the shutdown.
30  exec -- /system/bin/mtectrl ${arm64.memtag.bootctl:-none} ${persist.device_config.runtime_native_boot.bootloader_override:-default}
31
32on property:persist.device_config.runtime_native_boot.bootloader_override=force_on
33  setprop persist.sys.mte.permissive 1
34