Commit Graph

31 Commits

Author SHA1 Message Date
followmsi 1b1346af80 flo/deb: Build power.stats@1.0-service.mock 2021-11-30 16:33:19 +01:00
followmsi fb57f2ffa9 flo/deb: sepolicy: Actually define clearkey DRM HIDL service 2021-11-30 16:28:36 +01:00
followmsi 65642af2ce flo: Uprev clearkey DRM HIDL to 1.4 2021-11-25 13:35:03 +01:00
voron00 152e763519 flo/deb: sepolicy: label misc block device to resolve uncrypt denial
Fixes Settings->Erase options->Erase all data and LineageOS updater installation.

Change-Id: I193583783fa5d344ed44b98a00c3281742a67ee0
2021-11-24 14:37:51 +01:00
followmsi 9d92737e75 flo/deb: Add gatekeeper@1.0-service.software 2020-11-26 20:53:24 +01:00
followmsi 35a1e8206f flo: Update sepolicies 2020-11-26 20:51:48 +01:00
followmsi 4da02e91f0 flo: Set selinux label for /firmware
Prevents this build error:
mkuserimg_mke2fs.py ERROR: Failed to run e2fsdroid_cmd: set_selinux_xattr: No such file or directory searching for label "/firmware"

Change-Id: Ia58a78edb01e21724ceedd64c2f5a0ae23018ff3
2019-09-25 19:56:03 +02:00
Artem Borisov c4a61c6b0a flo: sepolicy: Use genfs_contexts for file labeling
Change-Id: I09b02344152cc9315f8baabe879ee16d5e15a9e8
2018-02-10 09:58:29 +00:00
Wei Wang c4376f08be flo: Accelerate boot by paralleling device enable
Some QCOM devices require sysfs to trigger boot/init which are blocking
the init process.
[    7.453205] init: Command 'write /sys/kernel/boot_adsp/boot 1' action=post-fs-data (/init.angler.rc:166) returned 0 took 271.936ms.
This CL is to put those slow to start devices in a
separate service and wait for the service to be done later on.

Bug: 32712851
Test: On device
Change-Id: Idd4e965f122cbc8421b443a41573d363112dfa50
2018-01-13 11:58:00 +00:00
Artem Borisov 3013bfabcd flo: Enable ZRAM
I have backported enough kernel stuff to align our implementation
with android-3.10.
Use ~500MB disk, 4 compression streams, lz4 compression.

Change-Id: I82ee5c43aefb732ee603bdf1ae190e5e9936e660
2018-01-02 22:22:08 +03:00
Artem Borisov 21daf4bb06 flo: move proprietary modules to vendor
Change-Id: Ie51036d03f391d4581e555980fed2e7afe885b41
2017-12-17 15:10:57 +03:00
Artem Borisov 708fd9a379 flo: move device-specific modules to vendor
Change-Id: I79e26fe58dd393b9da04f3c99b3eadd263c40afa
2017-12-17 15:10:57 +03:00
Jeff Vander Stoep 3e14c2304b Label camera device and add permissions
(cherry picked from commit 15f5ee011a51e9e7574d1ecb1b82658281d294be)

Grant access to qualcomm camera daemon.

Bug: 28359909
Change-Id: I92520b4c9fe5d94a6c191f40963fec6b6ed1acb4
2017-11-11 23:08:36 +03:00
William Roberts 07c9e60de0 camera_device: remove type
camera_device didn't really offer much in terms of control considering
that most domains that need camera_device, also need video_device and
vice versa.

Thus, drop camera_device from the policy.

Change-Id: Ib7773985ba3b93537702b113a2deb5d2f6f3c7ef
2016-01-12 13:36:22 -08:00
Nick Kralevich fd58583439 flo: updates for SELinux
* Move binaries from /system/etc to /system/bin. That's the proper
place for binaries, and avoids having to preface each service entry
with /system/bin/sh

* Drop seclabel statements and rely on automatic domain transitions.

* remove call to init.qcom.class_main.sh , which doesn't exist.
This gets rid of the following unnecessary errors:
  <3>[    5.286834] init: Warning!  Service qcom-c_main-sh needs a SELinux domain defined; please fix!
  <5>[    5.288970] type=1400 audit(1425327865.651:5): avc:  denied  { execute_no_trans } for  pid=191 comm="init" path="/system/bin/sh" dev="mmcblk0p22" ino=341 scontext=u:r:init:s0 tcontext=u:object_r:shell_exec:s0 tclass=file

Fix some other minor policy issues.

Change-Id: Ib47d49b6c239ab7a2ebe6159465deb98b4b8cecb
2015-04-01 15:20:41 -07:00
Nick Kralevich 654be83f16 flo: label boot block device
Bug: 19534538
Change-Id: I13856956cb2565682f17e01fd3e2c9bceed8d52a
2015-02-28 07:59:56 -08:00
Stephen Smalley d38e50e765 Assign specific type to metadata block device.
This assigns the type defined by Id3bea28f5958086716cd3db055bea309b3b5fa5a
to the block device file for the metadata partition specified via the
encryptable= option for the userdata entry in the fstab.<board> file.

Change-Id: I0ef96fa716be89fa9f8b6c03014a76ac2556d06e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-10-21 09:27:16 -04:00
Stephen Smalley cd87a3e46c Assign specific types to system and recovery block devices.
This assigns the types defined by Ie9c1f6d632f6e9e8cbba106f07f6b1979d2a3c4a
to the block device files for the system and recovery partitions
as per the fstab.<board> file.

Also rewrite the existing /dev/block entries for other partitions to
use the by-name symlinks where possible.

Change-Id: Ia1fbe871b567b5c4a7004b07c84d8d6348b81c47
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-10-02 10:32:56 -04:00
Stephen Smalley 10b77eb212 Assign specific types to userdata and cache block devices.
This assigns the types defined by I99d24f06506f51ebf1d186d9c393b3cad60e98d7
to the block device files for userdata and cache for this device.

Change-Id: I731ba250d694a080857e19ab996f4229bf003e30
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-24 15:23:48 -04:00
Robert Craig 159a3411c2 Drop ppd selinux policy.
The ppd service which runs the mm-pp-daemon binary appears
to no longer be used. The last occurrence of the binary for
either flo or deb is with the jss15r and jls36i builds
respectively. In fact, current builds report that the ppd
service is explicitly being disabled.

<3>[    5.023345] init: cannot find '/system/bin/mm-pp-daemon', disabling 'ppd'

Thus, just drop the selinux policy for it. While we're
at it, drop the ppd service entries from the init.flo.rc
file too.

Change-Id: I5902b6876d5bea33bb65dcaa505fc4ee13a61677
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-05-30 13:41:35 -04:00
Stephen Smalley d8984a2e1e Escape dot (.) when it is intended to be literal.
Otherwise it is treated as a regex and matches any character.

Change-Id: Ic36c1329d446c03a38cb09745b03be28333d9a50
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-05 14:21:52 -04:00
Robert Craig 9a5556ff39 SELinux policy for rmt_storage process.
Initial policy helps address some of the following denials:

Wake lock access:
    avc:  denied  { append } for  pid=171 comm="rmt_storage" name="wake_lock" dev="sysfs" ino=57 scontext=u:r:rmt:s0 tcontext=u:object_r:sysfs_wake_lock:s0 tclass=file
    avc:  denied  { open } for  pid=171 comm="rmt_storage" name="wake_lock" dev="sysfs" ino=57 scontext=u:r:rmt:s0 tcontext=u:object_r:sysfs_wake_lock:s0 tclass=file

Capabilities (dropping uid and gid):
    avc:  denied  { setgid } for  pid=171 comm="rmt_storage" capability=6  scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=capability
    avc:  denied  { setuid } for  pid=171 comm="rmt_storage" capability=7  scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=capability

Cgroup controls:
    avc:  denied  { add_name } for  pid=171 comm="rmt_storage" name="9999" scontext=u:r:rmt:s0 tcontext=u:object_r:cgroup:s0 tclass=dir
    avc:  denied  { create } for  pid=171 comm="rmt_storage" name="9999" scontext=u:r:rmt:s0 tcontext=u:object_r:cgroup:s0 tclass=dir

Socket creation:
    avc:  denied  { read } for  pid=209 comm="rmt_storage" scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket
    avc:  denied  { create } for  pid=169 comm="rmt_storage" scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket
    avc:  denied  { ioctl } for  pid=169 comm="rmt_storage" path="socket:[7463]" dev="sockfs" ino=7463 scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket
    avc:  denied  { setopt } for  pid=169 comm="rmt_storage" scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket
    avc:  denied  { bind } for  pid=169 comm="rmt_storage" scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket
    avc:  denied  { read } for  pid=210 comm="rmt_storage" scontext=u:r:rmt:s0 tcontext=u:r:rmt:s0 tclass=socket

Access to certian modem and root block devices:
    avc:  denied  { read } for  pid=171 comm="rmt_storage" name="mmcblk0" dev="tmpfs" ino=6554 scontext=u:r:rmt:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file
    avc:  denied  { open } for  pid=171 comm="rmt_storage" name="mmcblk0" dev="tmpfs" ino=6554 scontext=u:r:rmt:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file

Change-Id: Ia01257891eb2315632cef45dde7a099c3c042432
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-02-19 20:31:35 -05:00
Robert Craig 78c3127390 Add SELinux policy for kickstart denials.
Access to m9kefs* block devices.
    avc: denied { getattr } for pid=215 comm="sh" path="/dev/block/mmcblk0p5" dev="tmpfs" ino=7618 scontext=u:r:kickstart:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file
    avc: denied { setattr } for pid=216 comm="chown" name="mmcblk0p5" dev="tmpfs" ino=7618 scontext=u:r:kickstart:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file

Change owner and perms on /dev/block/platform/msm_sdcc.1/by-name/m9kefs*
    avc: denied { chown } for pid=216 comm="chown" capability=0 scontext=u:r:kickstart:s0 tcontext=u:r:kickstart:s0 tclass=capability
    avc: denied { fowner } for pid=220 comm="chmod" capability=3 scontext=u:r:kickstart:s0 tcontext=u:r:kickstart:s0 tclass=capability

Label and give access to specific rmnet usb files.
    avc: denied { write } for pid=182 comm="sh" name="rmnet_data_init" dev="sysfs" ino=4275 scontext=u:r:kickstart:s0 tcontext=u:object_r:sysfs:s0 tclass=file

Change-Id: I2a1edda0efdfc57615c56c61ee446c343d7d875b
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-02-19 19:43:30 -05:00
Stephen Smalley b7ca5a706c Add file_contexts entries for socket files.
So that we do not relabel them on a restorecon -R /data.

Change-Id: Ibf51efcbe8fed395b214ee81c097c4b04d4ce335
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-04 15:58:27 -05:00
Nick Kralevich a37cbdbfff initial irsc_util domain
Initially unconfined and enforcing.

Change-Id: I49be1c53afb1f91836d5e49dbce84c4a0c789478
2013-12-18 12:46:24 -08:00
Robert Craig df2aa61a2d SELinux policy updates.
* Make gpu_device a trusted object since all apps can
  write to the device.
    denied  { write } for  pid=3460 comm="ense_free.menus" name="kgsl-3d0" dev="tmpfs" ino=7606 scontext=u:r:untrusted_app:s0:c92,c256 tcontext=u:object_r:gpu_device:s0 tclass=chr_file

* Drop dead type mpdecision_device.

* Create policy for mm-pp-daemon and keep it permissive.
  Address the following initial denials.
    denied  { write } for  pid=220 comm="mm-pp-daemon" name="property_service" dev="tmpfs" ino=7289 scontext=u:r:ppd:s0 tcontext=u:object_r:property_socket:s0 tclass=sock_file
    denied  { connectto } for  pid=220 comm="mm-pp-daemon" path="/dev/socket/property_service" scontext=u:r:ppd:s0 tcontext=u:r:init:s0 tclass=unix_stream_socket
    denied  { read write } for  pid=220 comm="mm-pp-daemon" name="fb0" dev="tmpfs" ino=8523 scontext=u:r:ppd:s0 tcontext=u:object_r:graphics_device:s0 tclass=chr_file
    denied  { open } for  pid=220 comm="mm-pp-daemon" name="fb0" dev="tmpfs" ino=8523 scontext=u:r:ppd:s0 tcontext=u:object_r:graphics_device:s0 tclass=chr_file
    denied  { ioctl } for  pid=220 comm="mm-pp-daemon" path="/dev/graphics/fb0" dev="tmpfs" ino=8523 scontext=u:r:ppd:s0 tcontext=u:object_r:graphics_device:s0 tclass=chr_file

* Add kickstart_exec labels for kickstart binaries
  that are used by deb devices.

* Add tee policy. Label /data/misc/playready and
  allow tee access.
    denied  { write } for  pid=259 comm="qseecomd" name="misc" dev="mmcblk0p30" ino=635233 scontext=u:r:tee:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
    denied  { read } for  pid=232 comm="qseecomd" name="/" dev="mmcblk0p30" ino=2 scontext=u:r:tee:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
    denied  { create } for  pid=306 comm="qseecomd" name="playready" scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=dir
    denied  { search } for  pid=282 comm="qseecomd" name="playready" dev="mmcblk0p30" ino=635262 scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=dir
    denied  { read } for  pid=282 comm="qseecomd" name="playready" dev="mmcblk0p30" ino=635262 scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=dir
    denied  { write } for  pid=265 comm="qseecomd" name="playready" dev="mmcblk0p30" ino=635262 scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=dir
    denied  { create } for  pid=252 comm="qseecomd" name="tzdrm.log" scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=file
    denied  { read write open } for  pid=271 comm="qseecomd" name="tzdrm.log" dev="mmcblk0p30" ino=635264 scontext=u:r:tee:s0 tcontext=u:object_r:drm_data_file:s0 tclass=file

* Give surfaceflinger access to /dev/socket/pps and allow
  access to certain sysfs nodes.
    denied  { write } for  pid=181 comm="surfaceflinger" name="pps" dev="tmpfs" ino=7958 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:ppd_socket:s0 tclass=sock_file
    denied  { write } for  pid=182 comm="surfaceflinger" name="hpd" dev="sysfs" ino=9639 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:sysfs:s0 tclass=file

Change-Id: Ia7a5c63365593af7ac5adc207b27fad113b01dd3
2013-11-25 11:43:49 -05:00
Robert Craig 9d6624a0b5 Add to selinux policy.
Bring policy over from the mako board which
has a lot of similar domains and services.
mako is also a Qualcomm board which allows
a lot of that policy to be directly brought
over and applied.

Included in this are some radio specific
pieces. Though not directly applicable to
flo, the deb board inherits this policy.

Change-Id: I6b294c7dc830189c08f1f981a239234a2c3f577f
2013-11-15 14:24:59 -05:00
Robert Craig 6e899c8568 Create new security labels for device nodes.
Labeling nodes with appropriate types doesn't
introduce any new denials to the mix. This
list largely addresses the Qualcomm specific
nodes.

Various nodes are labeled with radio specific
types. Since the deb build inherits from this flo
policy, it is a good idea to include them.

Change-Id: Ia55a80af027c8bde933d45c41f4ed287f01adb2e
2013-11-14 13:10:30 -08:00
Robert Craig c1dd2c8312 Label kgsl (graphics) nodes.
Created a new label and addressed the following denials.

* For system server
    denied  { read write } for  pid=800 comm="ndroid.systemui" name="kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file
    denied  { open } for  pid=800 comm="ndroid.systemui" name="kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file
    denied  { ioctl } for  pid=800 comm="ndroid.systemui" path="/dev/kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file

* For surfaceflinger
    denied  { ioctl } for  pid=286 comm="SurfaceFlinger" path="/dev/kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:device:s0 tclass=chr_file
    denied  { read write } for  pid=286 comm="SurfaceFlinger" path="/dev/kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:device:s0 tclass=chr_file

* For app domains
    denied  { read write } for  pid=800 comm="ndroid.systemui" name="kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file
    denied  { open } for  pid=800 comm="ndroid.systemui" name="kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file
    denied  { ioctl } for  pid=800 comm="ndroid.systemui" path="/dev/kgsl-3d0" dev="tmpfs" ino=8426 scontext=u:r:platform_app:s0 tcontext=u:object_r:device:s0 tclass=chr_file

Change-Id: I417bbd12fbdc17cd3d1110dcf3bff73dd5e385a4
2013-11-14 13:01:50 -08:00
Nick Kralevich 40b7b28ddf Move rmt into its own domain.
Don't run rmt in init's domain. /system/bin/rmt_storage
is a qualcomm specific daemon responsible for servicing modem
filesystem requests. It doesn't make sense to run rmt_storage
in init's domain, as doing so prevents us from fine tuning
its policy.

Keep the domain in permissive mode right now until we address
the following denials:

<5>[    7.497467] type=1400 audit(1383939680.983:5): avc:  denied  { read write } for  pid=193 comm="rmt_storage" name="mem" dev="tmpfs" ino=4010 scontext=u:r:rmt:s0 tcontext=u:object_r:kmem_device:s0 tclass=chr_file
<5>[    7.497741] type=1400 audit(1383939680.983:6): avc:  denied  { open } for  pid=193 comm="rmt_storage" name="mem" dev="tmpfs" ino=4010 scontext=u:r:rmt:s0 tcontext=u:object_r:kmem_device:s0 tclass=chr_file

We still need to get a better understanding of what rmt_storage
does and what rules should be applied to it.

Change-Id: I45d03fb93870f1b4bb64215f5dcd9a2a443f5566
2013-11-08 12:35:41 -08:00
Nick Kralevich 203fd0df67 Label /dev/qseecom
Otherwise keystore in enforcing is broken.

Bug: 11518274
Change-Id: I10ead7cabe794d1752a8cba4dc3193217aad7805
2013-11-06 15:22:32 -08:00