Commit graph

1374 commits

Author SHA1 Message Date
Nick Kralevich
6bf9bbc829 label app_process64 as zygote_exec
... otherwise zygote 64 won't run in the correct SELinux domain.

Bug: 13647418
Change-Id: Iada2bf26623784535b70647c472f69b735b8f4fc
2014-04-04 09:48:41 -07:00
Stephen Smalley
e8c9fdac46 Exclude audit-related capabilities from unconfined domains.
Require them to be explicitly granted by specific allow rules.
audit_write is required to write an audit message from userspace.
audit_control is required to configure the audit subsystem.

Change-Id: I5aa4e3228f9b0bde3570689fe7a0d68e56861a17
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-04-03 08:51:38 -04:00
Nick Kralevich
888d283c30 Merge "Drop dontaudit sys_admin rule from rild." 2014-04-02 19:21:54 +00:00
Stephen Smalley
997d4a189f Drop dontaudit sys_admin rule from rild.
Old Android kernels (e.g. kernel/goldfish android-2.6.29 commit 2bda29)
fell back to a CAP_SYS_ADMIN check even before checking uids if the cgroup
subsystem did not define its own can_attach handler.  This doesn't appear
to have ever been the case of mainline, and is not true of the 3.4 Android
kernels.  So we no longer need to dontaudit sys_admin to avoid log noise.

Change-Id: I2faade6665a4adad91472c95f94bd922a449b240
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-04-02 14:19:42 -04:00
Stephen Smalley
016e636539 Drop dontaudit sys_admin rule from installd.
Old Android kernels (e.g. kernel/goldfish android-2.6.29 commit 2bda29)
fell back to a CAP_SYS_ADMIN check even before checking uids if the cgroup
subsystem did not define its own can_attach handler.  This doesn't appear
to have ever been the case of mainline, and is not true of the 3.4 Android
kernels.  So we no longer need to dontaudit sys_admin to avoid log noise.

Change-Id: I3822600a06c242764a94f9b67d9fcd6f599d3453
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-04-02 14:05:46 -04:00
Nick Kralevich
1cb990de6d Merge "Remove errant newline from generated policy file." 2014-04-01 21:19:08 +00:00
Mark Salyzyn
238a654f4a logd: add auditd
Change-Id: Iec4bfc08ced20c0d4c74e07baca6cff812c9ba00
2014-04-01 12:37:45 -07:00
Robert Craig
3ea628fccc Remove errant newline from generated policy file.
When running the post_process_mac_perms script
an unneeded newline is appended to modified
mac_permissions.xml file. Use sys.stdout.write
instead which avoids any formatting when printing.

Change-Id: Ib662dab1566299467371389dc236619aec40f5ac
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-04-01 11:22:53 -04:00
Stephen Smalley
6d8fa69548 Move shell entry up with other platform UID entries.
This is a trivial change to seapp_contexts to force a relabel
of /data/data directories by PMS/installd by yielding a
different hash value for comparison against /data/system/seapp_hash.
This change does not alter any actual app process or data directory
labeling decisions.  The seapp_contexts entries are sorted upon
loading by libselinux to match the precedence rules described
in the comment header, so ordering in this file should not matter.

This should not be merged before the code changes with the same Change-Id.

Change-Id: Ie440cba2c96f0907458086348197e1506d31c1b6
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-28 08:25:22 -04:00
Stephen Smalley
9fc0d40eff Label /dev/uio[0-9]* with its own type.
Change-Id: Ibeeec6637022ee8bc9868e102b3d55e3b0d4762c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-26 15:37:54 -04:00
Nick Kralevich
ca11a1edf7 Merge "Update README concerning post_process_mac_perms script." 2014-03-26 15:45:38 +00:00
Stephen Smalley
ea219e37f6 Allow domains to stat and open their entrypoint executables.
Resolves denials such as:
 avc:  denied  { open } for  pid=2758 comm="mediaserver" name="mediaserver" dev="mmcblk0p22" ino=169 scontext=u:r:mediaserver:s0 tcontext=u:object_r:mediaserver_exec:s0 tclass=file
 avc:  denied  { getattr } for  pid=2758 comm="mediaserver" path="/system/bin/mediaserver" dev="mmcblk0p22" ino=169 scontext=u:r:mediaserver:s0 tcontext=u:object_r:mediaserver_exec:s0 tclass=file

Change-Id: Ifee9e6fa87ae933639ce0b1d69a2feee460cf31f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-26 10:32:09 -04:00
Robert Craig
4caa6d4b89 Update README concerning post_process_mac_perms script.
Change-Id: Iabda448d252d3b1ce19809c7f5de0dca3942f60c
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-03-25 13:51:59 -04:00
Nick Kralevich
18f2b80e62 Merge "Allow surfaceflinger to read /proc/pid/cmdline of dumpstate." 2014-03-24 22:45:59 +00:00
Nick Kralevich
3f869f0cba Merge "Allow binder services to use pipes passed over binder." 2014-03-24 22:45:33 +00:00
Stephen Smalley
e06e536388 Allow inputflinger to call system_server.
Resolves denials such as:
avc:  denied  { read } for  pid=752 comm="ActivityManager" name="stat" dev="proc" ino=1878 scontext=u:r:system_server:s0 tcontext=u:r:inputflinger:s0 tclass=file
avc:  denied  { open } for  pid=752 comm="ActivityManager" name="stat" dev="proc" ino=1878 scontext=u:r:system_server:s0 tcontext=u:r:inputflinger:s0 tclass=file
avc:  denied  { search } for  pid=752 comm="ActivityManager" name="214" dev="proc" ino=1568 scontext=u:r:system_server:s0 tcontext=u:r:inputflinger:s0 tclass=dir
avc:  denied  { read } for  pid=752 comm="ActivityManager" name="stat" dev="proc" ino=1878 scontext=u:r:system_server:s0 tcontext=u:r:inputflinger:s0 tclass=file
avc:  denied  { call } for  pid=187 comm="Binder_2" scontext=u:r:inputflinger:s0 tcontext=u:r:system_server:s0 tclass=binder

Change-Id: I099d7dacf7116efa73163245597c3de629d358c1
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-21 10:40:56 -04:00
Stephen Smalley
57955712d0 Allow surfaceflinger to read /proc/pid/cmdline of dumpstate.
Resolves denials such as:
avc:  denied  { open } for  pid=3772 comm="Binder_4" name="cmdline" dev="proc" ino=26103 scontext=u:r:surfaceflinger:s0 tcontext=u:r:dumpstate:s0 tclass=file

This seems harmless, although I am unclear as to why/where it occurs.
Likely just for logging/debugging.

Change-Id: I7be38deabb117668b069ebdf086a9ace88dd8dd1
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-21 10:36:24 -04:00
Stephen Smalley
644279ba06 Allow binder services to use pipes passed over binder.
Resolves denials such as:
avc:  denied  { write } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:surfaceflinger:s0 tcontext=u:r:untrusted_app:s0 tclass=fifo_file
avc:  denied  { use } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:keystore:s0 tcontext=u:r:untrusted_app:s0 tclass=fd
avc:  denied  { use } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:healthd:s0 tcontext=u:r:untrusted_app:s0 tclass=fd
avc:  denied  { write } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:drmserver:s0 tcontext=u:r:untrusted_app:s0 tclass=fifo_file
avc:  denied  { use } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:inputflinger:s0 tcontext=u:r:untrusted_app:s0 tclass=fd
avc:  denied  { write } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:inputflinger:s0 tcontext=u:r:untrusted_app:s0 tclass=fifo_file
avc:  denied  { write } for  pid=18959 comm="dumpsys" path="pipe:[42013]" dev="pipefs" ino=42013 scontext=u:r:mediaserver:s0 tcontext=u:r:untrusted_app:s0 tclass=fifo_file

Change-Id: I289dcf4b2c5897b7a10e41e5dd8d56ef4b9a4a08
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-21 10:31:43 -04:00
Paul Lawrence
01ba6834c1 Allow vold to call to healthd
vold needs to be able to check remaining battery to safely abort
certain operations

Bug: 11985952
Change-Id: I7dfe83f7d1029593882e0e5ad33f90fb29e5532b
2014-03-20 09:52:36 -07:00
Stephen Smalley
ee5ddb213e Allow installd to restorecon /data/data.
Ability to relabel from/to any of the types that can be assigned
to /data/data directories as per seapp_contexts type= assignments.

Change-Id: I05e8b438950ddb908e46c9168ea6ee601e6d674f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-19 15:28:29 -04:00
Nick Kralevich
c43448985c Merge "Remove write access to system_data_file from rild." 2014-03-19 13:01:04 +00:00
Stephen Smalley
9e012cde7b Remove write access to system_data_file from rild.
Anything writable by rild should be in radio_data_file or efs_file.
System data should be read-only.

Change-Id: I442a253c22f567a147d0591d623e97a6ee8b76e3
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-18 14:01:27 -04:00
Robert Craig
a00fb29b19 Label /data/misc/sms as a radio_data_file.
This change helps with the following denials.
  avc:  denied  { write } for  pid=14157 comm="Thread-88" name="premium_sms_policy.xml" dev="mmcblk0p28" ino=618998 scontext=u:r:radio:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
  avc:  denied  { write } for  pid=14293 comm="Thread-89" name="sms" dev="mmcblk0p28" ino=618952 scontext=u:r:radio:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir

Prior to this patch the directory was labeled as
system_data_file which is a bit too generic. This
directory contains xml files with regexs which
represent premium numbers that are used to warn
the user before sending.

Change-Id: I98288b25aa1546477e05eee9f7622324b013e695
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-03-18 17:29:14 +00:00
Nick Kralevich
2257ca7a3c Merge "Allow netd-spawned domains to use inherited netd unix_dgram_socket." 2014-03-18 15:33:03 +00:00
Nick Kralevich
a478477c8d Merge "Allow system_server to set ctl.bugreport property." 2014-03-18 15:32:08 +00:00
Stephen Smalley
971b5d7c9f Allow system_server to set ctl.bugreport property.
Resolves denials such as:
avc:  denied  { set } for property=ctl.bugreport scontext=u:r:system_server:s0 tcontext=u:object_r:ctl_bugreport_prop:s0 tclass=property_service

Change-Id: I6c3085065157f418fc0cd4d01fa178eecfe334ad
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-18 10:49:34 -04:00
Stephen Smalley
08461cb039 Allow netd-spawned domains to use inherited netd unix_dgram_socket.
Resolves denials such as:
 avc:  denied  { read write } for  pid=4346 comm="hostapd" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:hostapd:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket
 avc:  denied  { read write } for  pid=4348 comm="dnsmasq" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:dnsmasq:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket

Change-Id: Ie82f39c32c6e04bc9ef1369ca787cf80b3b4141c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-18 10:46:48 -04:00
Nick Kralevich
34e8465ccb Merge "Allow drmserver and mediaserver to read apk files." 2014-03-18 03:57:56 +00:00
Nick Kralevich
b97ed1ad04 Merge "Fix broken halt while in healthd charger mode" 2014-03-17 22:10:37 +00:00
Mark Salyzyn
ad5315d442 shell: access to clear logs
Bug: 13464830

Change-Id: Ib0a627e6d5c0114d269bb3bf8dc29a945768081d
2014-03-17 13:02:14 -07:00
Nick Kralevich
9ada894a43 Fix broken halt while in healthd charger mode
Reboots/halts aren't working in healthd charger mode. This is
causing high power draw in an unplugged, powered off state.

Steps to reproduce (on Nexus 5):
  Unplug device from USB charger/computer
  Turn device off
  Wait for device to turn off
  Plug in USB cable/charger
  Wait for charge animation (wait for animation, not just lightning bolt, may have to press power button briefly to get animation going)
  Wait for panel to turn off
  Unplug USB cable/charger
  Press power button again, notice screen turns on at some frame in the animation.
  (not important) Each press of the power button advances the animation
  Power on.
  Examine denials from /proc/last_kmsg

Addresses the following denials:

[   24.934809] type=1400 audit(12534308.640:8): avc:  denied  { write } for  pid=130 comm="healthd" name="sysrq-trigger" dev="proc" ino=4026533682 scontext=u:r:healthd:s0 tcontext=u:object_r:proc_sysrq:s0 tclass=file
[   24.935395] type=1400 audit(12534308.640:9): avc:  denied  { sys_boot } for  pid=130 comm="healthd" capability=22  scontext=u:r:healthd:s0 tcontext=u:r:healthd:s0 tclass=capability

Bug: 13229119
Change-Id: If14a9c373bbf156380a34fbd9aca6201997d5553
2014-03-17 10:36:28 -07:00
Stephen Smalley
721f1adf53 Allow drmserver and mediaserver to read apk files.
Required to support passing resources via open apk files over Binder.
Resolves denials such as:
 avc:  denied  { read } for  pid=31457 comm="SoundPoolThread" path="/mnt/asec/au.com.shiftyjelly.pocketcasts-1/pkg.apk" dev="dm-10" ino=12 scontext=u:r:mediaserver:s0 tcontext=u:object_r:asec_apk_file:s0 tclass=file
 avc:  denied  { read } for  pid=31439 comm="Binder_2" path="/mnt/asec/au.com.shiftyjelly.pocketcasts-1/pkg.apk" dev="dm-10" ino=12 scontext=u:r:drmserver:s0 tcontext=u:object_r:asec_apk_file:s0 tclass=file

We do not allow open as it is not required (i.e. the files
are passed as open files over Binder or local socket and opened by the
client).

Change-Id: Ib0941df1e9aac8d20621a356d2d212b98471abbc
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-15 02:42:55 +00:00
Nick Kralevich
d70e6f325c Merge "Get rid of separate download_file type." 2014-03-15 02:16:44 +00:00
Nick Kralevich
b699dfd495 Merge "Get rid of separate platform_app_data_file type." 2014-03-15 00:52:27 +00:00
Nick Kralevich
1ba58a1a99 Merge "Introduce post_process_mac_perms script." 2014-03-15 00:25:29 +00:00
Nick Kralevich
0cad7fa543 Merge "Make dnsmasq enforcing." 2014-03-14 23:50:01 +00:00
Nick Kralevich
69eb3c7842 Merge "Make hostapd enforcing." 2014-03-14 23:48:52 +00:00
Nick Kralevich
23f04d31d9 Merge "Make mdnsd enforcing." 2014-03-14 23:46:54 +00:00
Nick Kralevich
2ebecfdd9e Merge "Make gpsd enforcing." 2014-03-14 23:46:24 +00:00
Nick Kralevich
c8012152e4 Allow healthd sys_tty_config
healthd performs privileged ioctls on the tty device
when in charger mode. Allow it.

This fixes a bug where off charging mode is forcing the device
to reboot into recovery.

Addresses the following denial:

type=1400 audit(15080631.900:4): avc:  denied  { sys_tty_config } for  pid=130 comm="healthd" capability=26  scontext=u:r:healthd:s0 tcontext=u:r:healthd:s0 tclass=capability

Bug: 13472365
Change-Id: I402987baf62ba0017e79e30e370850c32c286a6a
2014-03-14 15:37:25 -07:00
Nick Kralevich
09a1719c4d Merge "Allow system_server to read from log daemon." 2014-03-14 20:28:26 +00:00
Stephen Smalley
0eaf7629b3 Make gpsd enforcing.
Change-Id: I68a8f37576d0d04d0f9df9ef8991407b6846ba15
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:42:53 -04:00
Stephen Smalley
935abced52 Make mdnsd enforcing.
Change-Id: I610723eb9f2edcb4525b0e2d7e55616a1d93957d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:41:47 -04:00
Stephen Smalley
e3d0e655e8 Make hostapd enforcing.
Change-Id: Ica367f34156a7a460e3663589a29743c4a9e955c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:41:03 -04:00
Stephen Smalley
78a58dd921 Make dnsmasq enforcing.
Change-Id: I546c1bcf373f161b7bf5706053340c4f6482b8b9
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:40:23 -04:00
Stephen Smalley
bafbf81330 Allow system_server to read from log daemon.
Addresses denials such as:
avc:  denied  { write } for  pid=1797 comm="logcat" name="logdr" dev="tmpfs" ino=7523 scontext=u:r:system_server:s0 tcontext=u:object_r:logdr_socket:s0 tclass=sock_file
avc:  denied  { connectto } for  pid=1797 comm="logcat" path="/dev/socket/logdr" scontext=u:r:system_server:s0 tcontext=u:r:logd:s0 tclass=unix_stream_socket

Change-Id: Idc4f48519ca3d81125102e8f15f68989500f5e9e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:37:16 -04:00
Stephen Smalley
e42cebe6a0 Allow clatd to use local/unix datagram socket inherited from netd.
Addresses denials such as:
avc:  denied  { read write } for  pid=3142 comm="clatd" path="socket:[12029]" dev="sockfs" ino=12029 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket

Change-Id: I5111410870c71bbfaf6b5310d8f5fd8f10db4f20
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 08:22:19 -04:00
Stephen Smalley
f9c3257fba Get rid of separate download_file type.
This appears to have been created to allow untrusted_app to
access DownloadProvider cache files without needing to allow
open access to platform_app_data_file.  Now that platform_app_data_file
is gone, there is no benefit to having this type.

Retain a typealias for download_file to app_data_file until
restorecon /data/data support is in place to provide compatibility.

This change depends on:
https://android-review.googlesource.com/#/c/87801/

Change-Id: Iab3c99d7d5448bdaa5c1e03a98fb6163804e1ec4
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-14 12:17:06 +00:00
Stephen Smalley
6fe899a0d1 Silence /proc/pid denials.
system_server components such as ActivityManager and CpuTracker
try to access all /proc/pid directories, triggering denials on
domains that are not explicitly allowed to the system_server.
Silence these denials to avoid filling the logs with noise
and overwriting actual useful messages in the kernel ring buffer.

Change-Id: Ifd6f2fd63e945647570ed61c67a6171b89878617
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-13 16:20:50 -04:00
Stephen Smalley
64c0ff0079 Audit attempts by rild to create/write to system_data_file.
Audit attempts by rild to create/write to system_data_file
with avc:  granted messages so that we can identify any such
instances and put such directories/files into radio_data_file or
some other type and then remove these rules.

Change-Id: Ice20fed1733a3f4208d541a4baaa8b6c6f44fbb0
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-13 13:36:51 +00:00