Skip to content
Snippets Groups Projects
Commit f7543d27 authored by Alex Klyubin's avatar Alex Klyubin
Browse files

Switch Keymaster HAL policy to _client/_server

This switches Keymaster HAL policy to the design which enables us to
conditionally remove unnecessary rules from domains which are clients
of Keymaster HAL.

Domains which are clients of Keymaster HAL, such as keystore and vold
domains, are granted rules targeting hal_keymaster only when the
Keymaster HAL runs in passthrough mode (i.e., inside the client's
process). When the HAL runs in binderized mode (i.e., in another
process/domain, with clients talking to the HAL over HwBinder IPC),
rules targeting hal_keymaster are not granted to client domains.

Domains which offer a binderized implementation of Keymaster HAL, such
as hal_keymaster_default domain, are always granted rules targeting
hal_keymaster.

Test: Password-protected sailfish boots up and lock screen unlocks --
      this exercises vold -> Keymaster HAL interaction
Test: All Android Keystore CTS tests pass -- this exercises keystore ->
      Keymaster HAL interaction:
      make cts cts-tradefed
      cts-tradefed run singleCommand cts --skip-device-info \
      --skip-preconditions --skip-connectivity-check --abi arm64-v8a \
      --module CtsKeystoreTestCases
Bug: 34170079

Change-Id: I2254d0fdee72145721654d6c9e6e8d3331920ec7
parent 0aca0241
No related branches found
No related tags found
No related merge requests found
...@@ -150,6 +150,8 @@ attribute hal_graphics_composer; ...@@ -150,6 +150,8 @@ attribute hal_graphics_composer;
attribute hal_health; attribute hal_health;
attribute hal_ir; attribute hal_ir;
attribute hal_keymaster; attribute hal_keymaster;
attribute hal_keymaster_client;
attribute hal_keymaster_server;
attribute hal_light; attribute hal_light;
attribute hal_memtrack; attribute hal_memtrack;
attribute hal_nfc; attribute hal_nfc;
......
# hwbinder access # HwBinder IPC from client to server
hwbinder_use(hal_keymaster) binder_call(hal_keymaster_client, hal_keymaster_server)
allow hal_keymaster tee_device:chr_file rw_file_perms; allow hal_keymaster tee_device:chr_file rw_file_perms;
allow hal_keymaster tee:unix_stream_socket connectto; allow hal_keymaster tee:unix_stream_socket connectto;
......
...@@ -8,14 +8,11 @@ binder_service(keystore) ...@@ -8,14 +8,11 @@ binder_service(keystore)
binder_call(keystore, system_server) binder_call(keystore, system_server)
# talk to keymaster # talk to keymaster
binder_call(keystore, hwservicemanager) hal_client_domain(keystore, hal_keymaster)
binder_call(keystore, hal_keymaster)
allow keystore keystore_data_file:dir create_dir_perms; allow keystore keystore_data_file:dir create_dir_perms;
allow keystore keystore_data_file:notdevfile_class_set create_file_perms; allow keystore keystore_data_file:notdevfile_class_set create_file_perms;
allow keystore keystore_exec:file { getattr }; allow keystore keystore_exec:file { getattr };
allow keystore tee_device:chr_file rw_file_perms;
allow keystore tee:unix_stream_socket connectto;
add_service(keystore, keystore_service) add_service(keystore, keystore_service)
allow keystore sec_key_att_app_id_provider_service:service_manager find; allow keystore sec_key_att_app_id_provider_service:service_manager find;
...@@ -23,9 +20,7 @@ allow keystore sec_key_att_app_id_provider_service:service_manager find; ...@@ -23,9 +20,7 @@ allow keystore sec_key_att_app_id_provider_service:service_manager find;
# Check SELinux permissions. # Check SELinux permissions.
selinux_check_access(keystore) selinux_check_access(keystore)
allow keystore ion_device:chr_file r_file_perms;
r_dir_file(keystore, cgroup) r_dir_file(keystore, cgroup)
allow keystore system_file:dir r_dir_perms;
### ###
### Neverallow rules ### Neverallow rules
......
...@@ -27,7 +27,6 @@ allow vold shell_exec:file rx_file_perms; ...@@ -27,7 +27,6 @@ allow vold shell_exec:file rx_file_perms;
typeattribute vold mlstrustedsubject; typeattribute vold mlstrustedsubject;
allow vold self:process setfscreate; allow vold self:process setfscreate;
allow vold system_file:dir r_dir_perms;
allow vold system_file:file x_file_perms; allow vold system_file:file x_file_perms;
allow vold block_device:dir create_dir_perms; allow vold block_device:dir create_dir_perms;
allow vold device:dir write; allow vold device:dir write;
...@@ -87,8 +86,6 @@ allow vold fsck_exec:file { r_file_perms execute }; ...@@ -87,8 +86,6 @@ allow vold fsck_exec:file { r_file_perms execute };
allow vold fscklogs:dir rw_dir_perms; allow vold fscklogs:dir rw_dir_perms;
allow vold fscklogs:file create_file_perms; allow vold fscklogs:file create_file_perms;
allow vold ion_device:chr_file r_file_perms;
# #
# Rules to support encrypted fs support. # Rules to support encrypted fs support.
# #
...@@ -131,9 +128,7 @@ binder_use(vold) ...@@ -131,9 +128,7 @@ binder_use(vold)
binder_call(vold, healthd) binder_call(vold, healthd)
# talk to keymaster # talk to keymaster
binder_call(vold, hwservicemanager) hal_client_domain(vold, hal_keymaster)
binder_call(vold, hal_keymaster)
allow vold tee_device:chr_file rw_file_perms;
# Access userdata block device. # Access userdata block device.
allow vold userdata_block_device:blk_file rw_file_perms; allow vold userdata_block_device:blk_file rw_file_perms;
......
type hal_keymaster_default, domain; type hal_keymaster_default, domain;
hal_impl_domain(hal_keymaster_default, hal_keymaster) hal_server_domain(hal_keymaster_default, hal_keymaster)
type hal_keymaster_default_exec, exec_type, file_type; type hal_keymaster_default_exec, exec_type, file_type;
init_daemon_domain(hal_keymaster_default) init_daemon_domain(hal_keymaster_default)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment