Commit graph

7952 commits

Author SHA1 Message Date
Jeff Sharkey
17c675b327 Allow system_server to measure emulated stats.
Historically we pushed all system_server SD card interactions through
DefaultContainerService to avoid holding open FDs, but it's safe to
measure disk usage for internal emulated storage when looking
directly at /data/media, since there is no risk of unsafe ejection.

These rule changes give us just enough access to measure statistics.

avc: denied { getattr } for path="/data/media/0/DCIM/.thumbnails" dev="sda35" ino=589892 scontext=u:r:system_server:s0 tcontext=u:object_r:media_rw_data_file:s0:c512,c768 tclass=dir permissive=1
avc: denied { open } for path="/data/media/0/DCIM/.thumbnails" dev="sda35" ino=589892 scontext=u:r:system_server:s0 tcontext=u:object_r:media_rw_data_file:s0:c512,c768 tclass=dir permissive=1
avc: denied { read } for name="0" dev="sda35" ino=589827 scontext=u:r:system_server:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=dir permissive=1

Test: builds, boots, and access allowed
Bug: 33298975
Change-Id: I9748608a5c1169d542e763c5a8f79c4f26f7a382
2016-12-02 13:16:05 -07:00
Max
2464a492b4 Merge "Added an auditallow rule to track vold remounting filesystems."
am: 685ef6b821

Change-Id: I8b1a5415261fcb6b939152ce2fe3b58b0353d1bd
2016-12-01 17:46:17 +00:00
Treehugger Robot
685ef6b821 Merge "Added an auditallow rule to track vold remounting filesystems." 2016-12-01 17:29:34 +00:00
Nick Kralevich
1780a627ae domain_deprecated.te: remove /proc/net access
am: dd649da84b

Change-Id: I648e8b2869b4b2d95255575e257f07f11153865d
2016-12-01 17:19:16 +00:00
Nick Kralevich
dd649da84b domain_deprecated.te: remove /proc/net access
Remove /proc/net access to domain_deprecated. Add it to domains where it
was missing before.

Other than these domains, SELinux denial monitoring hasn't picked up any
denials related to /proc/net

Bug: 28760354
Test: Device boots
Test: No unexpected denials in denial collection logs.
Change-Id: Ie5bfa4bc0070793c1e8bf3b00676fd31c08d426a
2016-11-30 15:23:26 -08:00
Steven Moreland
7aa5caf81c dumpstate: talk to vibrator hal
am: 839c7ded30

Change-Id: Ibbbc3e8e51cbe6a5e2f1e5be7839a1cc3341b33c
2016-11-30 05:38:13 +00:00
Max
314d8c5801 Added an auditallow rule to track vold remounting filesystems.
Vold shouldn't have this selinux permission, so this will be left in for
a few weeks to keep track of if removing it would be an issue to any
other processes. If not, then a follow-up CL will remove both the rule
and the auditallow

Test: This CL is a test in itself, auditallow rules shouldn't change
behavior of SELinux policy by themselves
Bug: 26901147
Change-Id: Ib076448863bd54278df59a3b514c9e877eb22ee5
2016-11-29 17:11:36 -08:00
Steven Moreland
839c7ded30 dumpstate: talk to vibrator hal
Bug: 33067126
Test: Dumpstate vibrator works.
Change-Id: I46ff453218ba77f156e13b448e3cba9a291df0e7
2016-11-29 15:44:40 -08:00
Daniel Rosenberg
e383684122 Merge "Allow sdcardd to remount sdcardfs"
am: 7b6dbd7360

Change-Id: I5ba0baabf29c67d6de10b673ae9948fdab7b78bd
2016-11-29 06:22:56 +00:00
Treehugger Robot
7b6dbd7360 Merge "Allow sdcardd to remount sdcardfs" 2016-11-29 06:15:34 +00:00
Connor O'Brien
3e2fed1a80 Merge "Add permissions for hal_boot"
am: 280ba8b712

Change-Id: I40ea119e77002f6d71a1b0125c9420c24fc54d49
2016-11-29 00:55:08 +00:00
Connor O'Brien
280ba8b712 Merge "Add permissions for hal_boot" 2016-11-29 00:49:20 +00:00
Daniel Rosenberg
df59b9f9f1 Allow sdcardd to remount sdcardfs
Sdcardfs now supports bind mounts and remounts
instead of needing several separate mounts

bug: 30954918
Test: Enable Sdcardfs, verify mounts
Change-Id: Id94713752a08ceeb6aea7d3c29a29d3293a9b0c8
2016-11-28 16:10:27 -08:00
William Roberts
191e8b3b2d Merge "zygote: drop braces on single item rule"
am: a8340521e5

Change-Id: I0dc7cdaacd65f027f8615e5201f9357001e5b40b
2016-11-28 18:34:42 +00:00
Treehugger Robot
a8340521e5 Merge "zygote: drop braces on single item rule" 2016-11-28 18:27:53 +00:00
Nick Kralevich
d9bd9e69fc Add directory read permissions to certain domains.
am: 49e3588429

Change-Id: Ib96dbc7f6467e55d595426242c59b9551e9ae75f
2016-11-28 17:12:36 +00:00
Nick Kralevich
49e3588429 Add directory read permissions to certain domains.
Addresses the following denials and auditallows:

avc: denied { read } for pid=561 comm="hwservicemanage" name="hw"
dev="dm-0" ino=1883 scontext=u:r:hwservicemanager:s0
tcontext=u:object_r:system_file:s0 tclass=dir permissive=0

avc: denied { read } for pid=748 comm="gatekeeperd" name="hw" dev="dm-0"
ino=1883 scontext=u:r:gatekeeperd:s0 tcontext=u:object_r:system_file:s0
tclass=dir permissive=0

avc: granted { read open } for pid=735 comm="fingerprintd"
path="/system/lib64/hw" dev="dm-0" ino=1883 scontext=u:r:fingerprintd:s0
tcontext=u:object_r:system_file:s0 tclass=dir

Test: no denials on boot
Change-Id: Ic363497e3ae5078e564d7195f3739a654860a32f
2016-11-28 17:03:41 +00:00
Nick Kralevich
3f77c683da Merge "system_server: Delete system_file:file execute_no_trans;"
am: 8fe7b8d2a7

Change-Id: I904920227113f9b8e43182a4b3ba22b191cceb64
2016-11-28 16:58:43 +00:00
Nick Kralevich
97aff6aefc Merge "Remove domain_deprecated from some domains."
am: 2affae65dc

Change-Id: I9f5c692674c60b526b0ed7ac2bc46610b9e3c5ab
2016-11-28 16:58:33 +00:00
Nick Kralevich
f42128af64 Merge "Delete more from domain_deprecated.te"
am: fae2794e44

Change-Id: Iba87329c6ae3de6ad95868a9237eec83fd76da05
2016-11-28 16:58:22 +00:00
Treehugger Robot
8fe7b8d2a7 Merge "system_server: Delete system_file:file execute_no_trans;" 2016-11-28 16:55:09 +00:00
Treehugger Robot
2affae65dc Merge "Remove domain_deprecated from some domains." 2016-11-28 16:52:21 +00:00
Treehugger Robot
fae2794e44 Merge "Delete more from domain_deprecated.te" 2016-11-28 16:51:25 +00:00
William Roberts
96385a7534 zygote: drop braces on single item rule
commit 221938cbee
introduces a fix that uses braces around a single item.
This is not within the normal style of no brace around
a single item. Drop the braces.

Change-Id: Ibeee1e682c0face97f18d5e5177be13834485676
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-11-28 08:07:25 -08:00
Nick Kralevich
067bdcfb61 Merge "Remove "eng" macro"
am: 03e74a2026

Change-Id: I168746eb6e2fded35d2da632731d4300522e0afd
2016-11-28 16:02:15 +00:00
Nick Kralevich
73ea360542 logd.te: Remove setting persist.sys. and sys.powerctl
am: 31e9f39f59

Change-Id: I763244982b9e104f3a2ef68a81609db0b5ca9f39
2016-11-28 16:02:02 +00:00
Treehugger Robot
03e74a2026 Merge "Remove "eng" macro" 2016-11-28 15:56:59 +00:00
Nick Kralevich
d070b67190 Remove "eng" macro
Never used.

Test: policy compiles.
Change-Id: I0ce6c46bb05925a4b3eda83531b28f873b0c9b99
2016-11-27 16:03:26 -08:00
Nick Kralevich
31e9f39f59 logd.te: Remove setting persist.sys. and sys.powerctl
As of system/core commit a742d1027784a54c535cff69b375a9f560893155, this
functionality is no longer used.

Test: device boots and no obvious problems.
Change-Id: Ia3ad8add92f1cdaaff36f4935be8b03458fed7f2
2016-11-27 15:34:18 -08:00
Nick Kralevich
0fa81a27a0 Remove domain_deprecated from some domains.
No denials showing up in collected audit logs.

Bug: 28760354
Test: Device boots
Test: No unexpected denials in denial collection logs.
Change-Id: I5a0d4f3c51d296bfa04e71fc226a01dcf5b5b508
2016-11-25 17:37:30 -08:00
Nick Kralevich
06da58b9ab Delete more from domain_deprecated.te
No unexpected usages.

Bug: 28760354
Test: Device boots
Test: No unexpected denials in denial collection logs.
Change-Id: I43226fd0b8103afb1b25b1eb21445c04bc79954e
2016-11-25 17:14:45 -08:00
Nick Kralevich
80659f5508 Merge "Move to ioctl whitelisting for /dev/pts/* files"
am: d1228f2e70

Change-Id: Ic825465ad7cf20ebe26cb1f0a4e6077bf3648ce9
2016-11-26 00:27:28 +00:00
Treehugger Robot
d1228f2e70 Merge "Move to ioctl whitelisting for /dev/pts/* files" 2016-11-26 00:23:49 +00:00
Nick Kralevich
55e86a3a34 system_server: Delete system_file:file execute_no_trans;
auditallow has been in place since Apr 2016
(f84b798151) and no SELinux denials have
been generated / collected. Remove unused functionality.

Test: Device boots with no problems.
Test: no SELinux denials of this type collected.
Bug: 28035297
Change-Id: I52414832abb5780a1645a4df723c6f0c758eb5e6
2016-11-25 16:20:34 -08:00
Nick Kralevich
07c3a5a522 Move to ioctl whitelisting for /dev/pts/* files
In particular, get rid of TIOCSTI, which is only ever used for exploits.

http://www.openwall.com/lists/oss-security/2016/09/26/14

Bug: 33073072
Bug: 7530569
Test: "adb shell" works
Test: "adb install package" works
Test: jackpal terminal emulator from
      https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en
      works
Change-Id: I96b5e7059d106ce57ff55ca6e458edf5a4c393bf
2016-11-22 18:59:38 -08:00
Nick Kralevich
97494e4ae0 Merge "label /bugreports"
am: e6a20295c8

Change-Id: Ib769255c5c35ffbc47cd81c9592046b0a6282379
2016-11-23 00:11:15 +00:00
Treehugger Robot
e6a20295c8 Merge "label /bugreports" 2016-11-23 00:06:30 +00:00
Tao Bao
0733c2066f Merge "recovery.te: Allow writing to sysfs_devices_system_cpu."
am: 94d76c877b

Change-Id: I3d4343c5c1bc210253e24de8aeec192e331ffebb
2016-11-22 23:57:21 +00:00
Treehugger Robot
94d76c877b Merge "recovery.te: Allow writing to sysfs_devices_system_cpu." 2016-11-22 23:48:44 +00:00
Nick Kralevich
a824fa33ca neverallow some /proc file reads
am: 0b7506ff53

Change-Id: I8093d316ef2f0e5839073b88351bca4eace75b7b
2016-11-22 23:26:07 +00:00
Tao Bao
ee7960c05d recovery.te: Allow writing to sysfs_devices_system_cpu.
recovery (update_binary) may need to set up cpufreq during an update.

avc:  denied  { write } for  pid=335 comm="update_binary" name="scaling_max_freq" dev="sysfs" ino=7410 scontext=u:r:recovery:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file permissive=0

Bug: 32463933
Test: Build a recovery image and apply an OTA package that writes to
      /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq.

Change-Id: Ia90af9dd15e162dd94bcd4722b66aa296e3058c5
2016-11-22 14:03:25 -08:00
Nick Kralevich
0b7506ff53 neverallow some /proc file reads
Lock in the gains we've made so far in restricting access to generically
labeled /proc files. There's more we can do here, but let's avoid
inadvertent regressions.

Test: policy compiles. Only compile time assertions added.
Bug: 26813932
Change-Id: If354c2ddc1c59beed7f0eb4bcbd3f0d9971c3b8a
2016-11-22 13:18:02 -08:00
Nick Kralevich
d314376da9 label /bugreports
/data/bugreports is moving to /bugreports

Bug: 27262109
Bug: 27204904
Bug: 32799236
Test: new symlink is in /bugreports and is labeled correctly
Change-Id: Ib6a492fba8388bf43debad28cfc851679f8c6151
2016-11-22 08:59:08 -08:00
Nick Kralevich
1d18ef4486 access_vectors: Remove unused permission definitions
am: 11dc03e5a2

Change-Id: Ie2c7f871c47d378cc3b8399e174b229439511452
2016-11-22 01:39:56 +00:00
Nick Kralevich
11dc03e5a2 access_vectors: Remove unused permission definitions
Description stolen from
42a9699a9f

Remove unused permission definitions from SELinux.
Many of these were only ever used in pre-mainline
versions of SELinux, prior to Linux 2.6.0.  Some of them
were used in the legacy network or compat_net=1 checks
that were disabled by default in Linux 2.6.18 and
fully removed in Linux 2.6.30.

Permissions never used in mainline Linux:
file swapon
filesystem transition
tcp_socket { connectto newconn acceptfrom }
node enforce_dest
unix_stream_socket { newconn acceptfrom }

Legacy network checks, removed in 2.6.30:
socket { recv_msg send_msg }
node { tcp_recv tcp_send udp_recv udp_send rawip_recv rawip_send dccp_recv dccp_send }
netif { tcp_recv tcp_send udp_recv udp_send rawip_recv rawip_send dccp_recv dccp_send }

Test: policy compiles and no boot errors (marlin)
Change-Id: Idaef2567666f80db39c3e3cee70e760e1dac73ec
2016-11-21 23:41:18 +00:00
Jorge Lucangeli Obes
2c2ee69500 Merge "Add WITH_DEXPREOPT_PIC to 'with_dexpreopt' SELinux macro."
am: f25e5550a7

Change-Id: I267d30094daf909158f720fa8e7c501e13a5ccc3
2016-11-21 23:28:38 +00:00
Treehugger Robot
f25e5550a7 Merge "Add WITH_DEXPREOPT_PIC to 'with_dexpreopt' SELinux macro." 2016-11-21 23:16:53 +00:00
Connor O'Brien
12443b7a51 Add permissions for hal_boot
The service running the boot control HAL needs the permissions
provided by the boot_control_hal attribute. update_engine and
update_verifier still also need these permissions in order
to successfully call the new HAL in pass-through mode, but also
need permission to call the new service.

Bug: 31864052
Test: Built and confirmed no permission denials.
Change-Id: I2a6fdd5cf79b9e461d7cc14bd5b7abd6481ed911
Signed-off-by: Connor O'Brien <connoro@google.com>
2016-11-21 10:09:40 -08:00
Jorge Lucangeli Obes
2899434716 Add WITH_DEXPREOPT_PIC to 'with_dexpreopt' SELinux macro.
|WITH_DEXPREOPT_PIC = false| will still cause code to be loaded from
/data.

Bug: 32970029
Test: On HiKey and Marlin:
Test: Add |WITH_DEXPREOPT_PIC = false|, see SELinux denial.
Test: Apply this CL, no SELinux denials.
Change-Id: I0a1d39eeb4d7f75d84c1908b879d9ea1ccffba74
2016-11-21 11:57:08 -05:00
Nick Kralevich
b9566eff33 Collapse urandom_device into random_device
am: 5eadcb8cb1

Change-Id: I79ed60bfb69e16c0e55ff84583e0930a7adf7cb8
2016-11-21 16:41:26 +00:00