cd40aa0ab7
SLCAN setup requires certain ioctls and read/write operations to certain tty's. This change allows the HAL to set up SLCAN devices while complying with SEPolicy. In addition to adding support for SLCAN, I've also included permissions for using setsockopt. In order for the CAN HAL receive error frames from the CAN bus controller, we need to first set the error mask and filter via setsockopt. Test: manual Bug: 144458917 Bug: 144513919 Change-Id: I63a48ad6677a22f05d50d665a81868011c027898
36 lines
1.2 KiB
Text
36 lines
1.2 KiB
Text
type hal_can_socketcan, domain;
|
|
hal_server_domain(hal_can_socketcan, hal_can_controller)
|
|
hal_server_domain(hal_can_socketcan, hal_can_bus)
|
|
|
|
type hal_can_socketcan_exec, exec_type, vendor_file_type, file_type;
|
|
init_daemon_domain(hal_can_socketcan)
|
|
|
|
# Managing SocketCAN interfaces
|
|
allow hal_can_socketcan self:capability net_admin;
|
|
allow hal_can_socketcan self:netlink_route_socket { create bind write nlmsg_write read };
|
|
|
|
# Calling if_nametoindex(3) to open CAN sockets
|
|
allow hal_can_socketcan self:udp_socket { create ioctl };
|
|
allowxperm hal_can_socketcan self:udp_socket ioctl {
|
|
SIOCGIFINDEX
|
|
};
|
|
|
|
# Communicating with SocketCAN interfaces and bringing them up/down
|
|
allow hal_can_socketcan self:can_socket { bind create read write ioctl setopt };
|
|
allowxperm hal_can_socketcan self:can_socket ioctl {
|
|
SIOCGIFFLAGS
|
|
SIOCSIFFLAGS
|
|
};
|
|
|
|
# Un-publishing ICanBus interfaces
|
|
allow hal_can_socketcan hidl_manager_hwservice:hwservice_manager find;
|
|
|
|
allow hal_can_socketcan usb_serial_device:chr_file { ioctl read write open };
|
|
allowxperm hal_can_socketcan usb_serial_device:chr_file ioctl {
|
|
TCGETS
|
|
TCSETSW
|
|
TIOCGSERIAL
|
|
TIOCSSERIAL
|
|
TIOCSETD
|
|
SIOCGIFNAME
|
|
};
|