Commit graph

3547 commits

Author SHA1 Message Date
dcashman
3e6da1472f Enable selinux read_policy for adb pull.
Remove permission from appdomain.

(cherry picked from commit 309cc668f9)

Bug: 16866291

Change-Id: I37936fed33c337e1ab2816258c2aff52700af116
2014-09-26 14:33:42 -07:00
Martijn Coenen
2126f1a82f am 9ac7df22: Allow NFC to read/write nfc. system properties.
* commit '9ac7df22802e91c58ecc2e05a3f515962457a266':
  Allow NFC to read/write nfc. system properties.
2014-09-26 21:04:42 +00:00
Martijn Coenen
9ac7df2280 Allow NFC to read/write nfc. system properties.
(cherry pick of commit 05383ebfb4)

Bug: 17298769
Change-Id: I1994ff9f9da9b13249099f6c9bcec88dcdc2bb97
2014-09-26 13:57:02 -07:00
Nick Kralevich
77f9ea42b1 am 2de02877: zygote: allow replacing /proc/cpuinfo
* commit '2de02877a30e73bdf30fb2bf9cc4957f9ddbf996':
  zygote: allow replacing /proc/cpuinfo
2014-09-26 20:14:20 +00:00
Nick Kralevich
f2c011892d zygote: allow replacing /proc/cpuinfo
Android's native bridge functionality allows an Android native
app written on one CPU architecture to run on a different architecture.
For example, Android ARM apps may run on an x86 CPU.

To support this, the native bridge functionality needs to replace
/proc/cpuinfo with the version from /system/lib/<ISA>/cpuinfo
using a bind mount. See commit ab0da5a9a6860046619629b8e6b83692d35dff86
in system/core.

This change:

1) Creates a new label proc_cpuinfo, and assigns /proc/cpuinfo
that label.
2) Grants read-only access to all SELinux domains, to avoid
breaking pre-existing apps.
3) Grants zygote mounton capabilities for that file, so zygote
can replace the file as necessary.

Addresses the following denial:

  avc: denied { mounton } for path="/proc/cpuinfo" dev="proc" ino=4026532012 scontext=u:r:zygote:s0 tcontext=u:object_r:proc:s0 tclass=file

Bug: 17671501

(cherry picked from commit 2de02877a3)

Change-Id: I2c2366bee4fe365288d14bca9778d23a43c368cb
2014-09-26 13:06:22 -07:00
Martijn Coenen
49fd9567d9 Merge "Allow NFC to read/write nfc. system properties." into lmp-dev 2014-09-26 19:14:20 +00:00
Nick Kralevich
2de02877a3 zygote: allow replacing /proc/cpuinfo
Android's native bridge functionality allows an Android native
app written on one CPU architecture to run on a different architecture.
For example, Android ARM apps may run on an x86 CPU.

To support this, the native bridge functionality needs to replace
/proc/cpuinfo with the version from /system/lib/<ISA>/cpuinfo
using a bind mount. See commit ab0da5a9a6860046619629b8e6b83692d35dff86
in system/core.

This change:

1) Creates a new label proc_cpuinfo, and assigns /proc/cpuinfo
that label.
2) Grants read-only access to all SELinux domains, to avoid
breaking pre-existing apps.
3) Grants zygote mounton capabilities for that file, so zygote
can replace the file as necessary.

Addresses the following denial:

  avc: denied { mounton } for path="/proc/cpuinfo" dev="proc" ino=4026532012 scontext=u:r:zygote:s0 tcontext=u:object_r:proc:s0 tclass=file

Bug: 17671501
Change-Id: Ib70624fba2baeccafbc0a41369833f76b976ee20
2014-09-26 18:35:26 +00:00
Martijn Coenen
05383ebfb4 Allow NFC to read/write nfc. system properties.
Bug: 17298769
Change-Id: I1994ff9f9da9b13249099f6c9bcec88dcdc2bb97
2014-09-25 15:36:03 -07:00
Nick Kralevich
afae50c1d1 am 826bc5d6: allow apps to read the contents of mounted OBBs
* commit '826bc5d6c90260f4294f52265cccb76c5103cf37':
  allow apps to read the contents of mounted OBBs
2014-09-25 02:32:12 +00:00
Nick Kralevich
826bc5d6c9 allow apps to read the contents of mounted OBBs
Apps should be able to read the contents of mounted OBBs.

Steps to reproduce:

  1) Install com.namcobandaigames.soulcaliburgp (SoulCalibur)
  2) Attempt to run the app.

Expected:
  App runs successfully.

Actual:
  App crashes. See denials below.

This can also be reproduced by running the newly introduced CTS
test in I2018b63b0236ce6b5aee4094e40473315b1948c3

Addresses the following denials:

  avc: denied { read } for pid=4133 comm="roidJUnitRunner" name="test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { open } for pid=4133 comm="roidJUnitRunner" name="test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { getattr } for pid=4133 comm="roidJUnitRunner" path="/mnt/obb/f73da56689d166b5389d49ad31ecbadb/test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { search } for name="/" dev="loop0" ino=1 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=dir permissive=0

(cherrypick of commit 62083414a4)

Bug: 17633509
Change-Id: I49b722b24c1c7d9ab084ebee7c1e349d8d660ffa
2014-09-24 19:08:35 -07:00
Nick Kralevich
2918187685 am 62083414: allow apps to read the contents of mounted OBBs
* commit '62083414a4cc2b9fd7eb22c3bc4ffa4d9285d4be':
  allow apps to read the contents of mounted OBBs
2014-09-25 00:59:44 +00:00
Nick Kralevich
62083414a4 allow apps to read the contents of mounted OBBs
Apps should be able to read the contents of mounted OBBs.

Steps to reproduce:

  1) Install com.namcobandaigames.soulcaliburgp (SoulCalibur)
  2) Attempt to run the app.

Expected:
  App runs successfully.

Actual:
  App crashes. See denials below.

This can also be reproduced by running the newly introduced CTS
test in I2018b63b0236ce6b5aee4094e40473315b1948c3

Addresses the following denials:

  avc: denied { read } for pid=4133 comm="roidJUnitRunner" name="test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { open } for pid=4133 comm="roidJUnitRunner" name="test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { getattr } for pid=4133 comm="roidJUnitRunner" path="/mnt/obb/f73da56689d166b5389d49ad31ecbadb/test1.txt" dev="loop0" ino=23 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=file
  avc: denied { search } for name="/" dev="loop0" ino=1 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:vfat:s0 tclass=dir permissive=0

Bug: 17633509
Change-Id: I49b722b24c1c7d9ab084ebee7c1e349d8d660ffa
2014-09-24 15:18:08 -07:00
Nick Kralevich
3b3a5549df am 4635b26f: Merge "Enable per-user isolation for normal apps."
* commit '4635b26fbc82668f525d59fd0c95b8ac38e1cf66':
  Enable per-user isolation for normal apps.
2014-09-23 13:13:02 +00:00
Nick Kralevich
a9bc5c0cd0 am b54f92bb: make su an mlstrustedsubject
* commit 'b54f92bbf49c94ae9246b0e6b5b900100aada869':
  make su an mlstrustedsubject
2014-09-23 13:13:02 +00:00
Nick Kralevich
4635b26fbc Merge "Enable per-user isolation for normal apps." 2014-09-23 12:56:31 +00:00
Nick Kralevich
e141839a64 am a8b651bf: relax appdomain efs_file neverallow rules [DO NOT MERGE]
* commit 'a8b651bfba433ab91b565fea5276ceb7743ad15a':
  relax appdomain efs_file neverallow rules [DO NOT MERGE]
2014-09-23 03:07:07 +00:00
Nick Kralevich
a8b651bfba relax appdomain efs_file neverallow rules [DO NOT MERGE]
During factory provisioning, some manufacturers may need to pull files
from /factory (label efs_file and bluetooth_efs_file) to collect
device specific identifiers such as the mac address, using commands
similar to the following:

  adb shell cat /factory/ssn
  adb shell cat /factory/bt/bd_addr.conf
  adb shell cat /factory/wifi/mac.txt
  adb shell cat /factory/60isn

read-only access to these files is currently disallowed by a
neverallow rule. Relax the rules to allow read-only access to the
shell user if desired.

No new SELinux rules are added or deleted by this change. This is
only a relaxation in what's allowed for vendor specific policy.

Bug: 17600278

(cherry picked from commit 200a9f0e20)

Change-Id: I2e277b1068a35cc06e0973df994ec3a49f2c26e7
2014-09-23 02:14:30 +00:00
Nick Kralevich
b54f92bbf4 make su an mlstrustedsubject
Otherwise the following denial occurs when I3972f846ff5e7363799ba521f1258d662b18d64e
is present and "adb root" is run.

  <6>[   64.507223] type=1400 audit(1411432079.100:471): avc: denied { connectto } for pid=717 comm="JDWP" path=006A6477702D636F6E74726F6C scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:su:s0 tclass=unix_stream_socket permissive=1
  <6>[   64.507617] type=1400 audit(1411432079.100:472): avc: denied { connectto } for pid=1659 comm="JDWP" path=006A6477702D636F6E74726F6C scontext=u:r:platform_app:s0:c512,c768 tcontext=u:r:su:s0 tclass=unix_stream_socket permissive=1

Change-Id: I1772912b2ca1446b822303ad6ea3154427f8331f
2014-09-22 17:44:00 -07:00
Nick Kralevich
ffc5671f5c am 200a9f0e: relax appdomain efs_file neverallow rules
* commit '200a9f0e20337b48824cf621a017e2852245e5ca':
  relax appdomain efs_file neverallow rules
2014-09-23 00:41:16 +00:00
Stephen Smalley
a833763ba0 Enable per-user isolation for normal apps.
Add levelFrom=user to the entries for apps other than those
that run in the predefined platform UIDs (e.g. system, nfc, radio, ...).
This causes libselinux to assign a per-user category set computed from
the user ID portion of the Linux UID to each app process and its
/data/data/<pkgdir> or /data/user/N/<pkgdir> directory.  These
per-user category sets can be seen in the last field of ps -Z output for
apps and ls -Z /data/data or /data/user/N output for the package
directories.

With this applied, apps running on behalf of one user cannot read
or write files created by apps running on behalf of another user,
even if the file is world-readable or -writable.  Similar isolation is
enforced over process interactions (including /proc/pid file access),
local socket communications, and System V IPC, as expressed in the
set of constraints defined in the mls configuration.  At present,
Binder IPC is not restricted by the mls configuration; if desired,
there is a constraint in the configuration that can be uncommented
to also apply isolation on direct binder IPC, although communication
will still be possible indirectly via the system_server.

Bug: 13507660
Change-Id: I3972f846ff5e7363799ba521f1258d662b18d64e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-23 00:07:59 +00:00
Nick Kralevich
200a9f0e20 relax appdomain efs_file neverallow rules
During factory provisioning, some manufacturers may need to pull files
from /factory (label efs_file and bluetooth_efs_file) to collect
device specific identifiers such as the mac address, using commands
similar to the following:

  adb shell cat /factory/ssn
  adb shell cat /factory/bt/bd_addr.conf
  adb shell cat /factory/wifi/mac.txt
  adb shell cat /factory/60isn

read-only access to these files is currently disallowed by a
neverallow rule. Relax the rules to allow read-only access to the
shell user if desired.

No new SELinux rules are added or deleted by this change. This is
only a relaxation in what's allowed for vendor specific policy.

Bug: 17600278
Change-Id: I13f33f996c077918dce70a5cff31a87eac436678
2014-09-22 22:49:00 +00:00
Vineeta Srivastava
d118163543 resolved conflicts for merge of b4fcaeea to lmp-dev-plus-aosp
Change-Id: I5946d6dc2256ba843a17c735d85df4d9ad5b07b2
2014-09-22 14:53:03 -07:00
Vineeta Srivastava
b4fcaeea34 sepolicy for oem cutomization
Added read permissions for bootanimation

Bug: 16635599
Change-Id: Ib5d0ba5a6d1144ff831f4f0eda092879f853c376
2014-09-22 21:17:39 +00:00
Nick Kralevich
864cee48db am 36fb1f1b: relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
* commit '36fb1f1bf3fa29a639e4c9d793b36cbbceae2ec7':
  relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
2014-09-22 18:10:01 +00:00
Nick Kralevich
36fb1f1bf3 relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
Netlink uevent sockets are used by the kernel to inform userspace
when certain events occur, for example, when new hardware is added
or removed. This allows userspace to take some action based on those
messages.

Relax the neverallow rule for NETLINK_KOBJECT_UEVENT sockets.
Certain device specific app domains, such as system_app, may have a
need to receive messages from this socket type.

Continue to neverallow NETLINK_KOBJECT_UEVENT sockets for untrusted_app.
These sockets have been the source of rooting attacks in Android
in the past, and it doesn't make sense to expose this to untrusted_apps.

No new SELinux rules are introduced by this change. This is an
adjustment of compile time assertions only.

Bug: 17525863

(cherry picked from commit 642b80427e)

Change-Id: I35f3dc8b1ead9f427645a13fb202e760d1e68e64
2014-09-22 09:25:48 -07:00
Nick Kralevich
3fa5d73b7a am 642b8042: relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
* commit '642b80427ec2e95eb13cf03a74d814f240813e71':
  relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
2014-09-22 16:00:51 +00:00
Nick Kralevich
642b80427e relax neverallow rules on NETLINK_KOBJECT_UEVENT sockets
Netlink uevent sockets are used by the kernel to inform userspace
when certain events occur, for example, when new hardware is added
or removed. This allows userspace to take some action based on those
messages.

Relax the neverallow rule for NETLINK_KOBJECT_UEVENT sockets.
Certain device specific app domains, such as system_app, may have a
need to receive messages from this socket type.

Continue to neverallow NETLINK_KOBJECT_UEVENT sockets for untrusted_app.
These sockets have been the source of rooting attacks in Android
in the past, and it doesn't make sense to expose this to untrusted_apps.

No new SELinux rules are introduced by this change. This is an
adjustment of compile time assertions only.

Bug: 17525863
Change-Id: I3e538dc8096dc23b9678bcd20e3c1e742c21c967
2014-09-21 23:49:37 -07:00
dcashman
241c1c419b am 1619b73d: Generate selinux_policy.xml as part of CTS build.
* commit '1619b73d049f4facd89168ec5b404453edd71cde':
  Generate selinux_policy.xml as part of CTS build.
2014-09-20 22:23:38 +00:00
dcashman
1619b73d04 Generate selinux_policy.xml as part of CTS build.
Bug: 16563899
Bug: 14251916

(cherry picked from commit 704741a5c2)

Change-Id: I4ba64e2d28f789498852ecfd34aa767d5861d86e
2014-09-20 14:20:56 -07:00
Stephen Smalley
8d8c3cd17f am dd053a9b: Define types for userdata and cache block devices.
* commit 'dd053a9b891195439b1c0848cb0e8a6e17b4b9bc':
  Define types for userdata and cache block devices.
2014-09-20 20:06:23 +00:00
dcashman
fc1c51d756 am f37ce3f3: Add support for factory reset protection.
* commit 'f37ce3f3e2ad68da61f709567cd166a83316e3f3':
  Add support for factory reset protection.
2014-09-20 20:06:22 +00:00
Nick Kralevich
1918e3a634 am d298354e: Merge "Add isOwner= input selector for seapp_contexts."
* commit 'd298354e979faf3974b181f2152bd9e3e017574a':
  Add isOwner= input selector for seapp_contexts.
2014-09-20 20:06:20 +00:00
Nick Kralevich
a0a0b87a16 am b4c10e98: Merge "More MLS trusted subject/object annotations."
* commit 'b4c10e98b2e67c32fb929828e864b40638616be7':
  More MLS trusted subject/object annotations.
2014-09-20 20:06:20 +00:00
Stephen Smalley
dd053a9b89 Define types for userdata and cache block devices.
Introduce separate types for the userdata and cache block
devices so that we can assign them and allow access to them
in device-specific policy without allowing access to any other
block device (e.g. system).  These types will only be used if
assigned to device node paths in the device-specific file_contexts
configuration.  Otherwise, this change will have no impact - the
userdata and cache block devices will continue to default to block_device
type.

To avoid breakage when these new types are assigned to the userdata
block device, allow access by vold and uncrypt, but auditallow
these accesses to confirm that these are required.

Change-Id: I99d24f06506f51ebf1d186d9c393b3cad60e98d7
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-19 19:01:32 -07:00
dcashman
f37ce3f3e2 Add support for factory reset protection.
Address the following denials:
<12>[  417.732129] type=1400 audit(365340.189:47): avc: denied { read } for pid=1737 comm="Binder_2" name="mmcblk0p18" dev="tmpfs" ino=12406 scontext=u:r:system_server:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0
<12>[  417.882126] type=1400 audit(365340.339:48): avc: denied { read } for pid=1737 comm="Binder_2" name="mmcblk0p18" dev="tmpfs" ino=12406 scontext=u:r:system_server:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0

(cherrypick of commit 47bd7300a5)

Bug: 16710840
Change-Id: I8cb5b4b17dffe14f0bf05d63eb8f6ab8d5c09f53
2014-09-19 18:58:02 -07:00
Nick Kralevich
d298354e97 Merge "Add isOwner= input selector for seapp_contexts." 2014-09-20 01:37:42 +00:00
Nick Kralevich
b4c10e98b2 Merge "More MLS trusted subject/object annotations." 2014-09-20 01:35:50 +00:00
Nick Kralevich
0ba0992f17 am a10bfd88: Remove /dev/log/* access
* commit 'a10bfd881ebeaf96060a57258cd7a2020780fc89':
  Remove /dev/log/* access
2014-09-19 17:57:33 +00:00
Nick Kralevich
a10bfd881e Remove /dev/log/* access
The kernel driver has been deprecated by the new userspace
driver. Don't continue to allow access to the old driver.

Maintain the labeling on /dev/log/* for now, just in case.

Bug: 13505761
Change-Id: Ibf8ef3af6274ede4262aada9222eaf63f63307b4
2014-09-18 11:01:14 -07:00
Vineeta Srivastava
e0357cf142 resolved conflicts for merge of 0a20b57f to lmp-dev-plus-aosp
Change-Id: I6a0d56c23888535964e1559cb8ad63fedd27db47
2014-09-16 13:04:06 -07:00
Vineeta Srivastava
0a20b57f88 Added sepolicy for oem customization.
Bug: 16635599

Change-Id: I69f9089dde1fe68762a38f4d97ddee2c20aaaa9d
2014-09-16 12:11:42 -07:00
Stephen Smalley
ff4db9194e Add isOwner= input selector for seapp_contexts.
Enable labeling apps differently depending on whether they
are running for the primary user / owner or for a secondary user.

Change-Id: I37aa5b183a7a617cce68ccf14510c31dfee4e04d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-15 15:55:04 -04:00
Stephen Smalley
cbc5279a43 More MLS trusted subject/object annotations.
dumpstate and lmkd need to act on apps running at any level.

Various file types need to be writable by apps running at any
level.

Change-Id: Idf574d96ba961cc110a48d0a00d30807df6777ba
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-09-15 19:22:23 +00:00
Christopher Ferris
7d36f46686 am e7d13673: Allow dumpstate to read /system/bin executables.
* commit 'e7d136738fcd90346839b373bf3404d70c5334eb':
  Allow dumpstate to read /system/bin executables.
2014-09-14 00:41:44 +00:00
Christopher Ferris
e7d136738f Allow dumpstate to read /system/bin executables.
On 64 bit systems, it's necessary to read the /system/bin executables
elf header to determine if it's a 32 bit or 64 bit executable to
contact the correct debuggerd service.

Bug: 17487122

(cherry picked from commit 04f3d79077)

Change-Id: Ib7835ffac1811a5aef54a250689287c1666720ef
2014-09-13 16:24:01 -07:00
Christopher Ferris
88d1cfebe5 resolved conflicts for merge of 313e4056 to lmp-dev-plus-aosp
Change-Id: I2f41cef9b3203117e24f8dba7000d8f4c564dcb8
2014-09-13 16:11:33 -07:00
Christopher Ferris
313e40564a Merge "Allow dumpstate to read /system/bin executables." into lmp-dev 2014-09-13 22:31:44 +00:00
Tyler Gunn
486d66a0d2 am 69cdca91: Renaming Telecomm to Telecom.
* commit '69cdca91e7ff36ad425b9f15b602d44ce374c738':
  Renaming Telecomm to Telecom.
2014-09-13 18:03:10 +00:00
Christopher Ferris
04f3d79077 Allow dumpstate to read /system/bin executables.
On 64 bit systems, it's necessary to read the /system/bin executables
elf header to determine if it's a 32 bit or 64 bit executable to
contact the correct debuggerd service.

Bug: 17487122
Change-Id: Ica78aa54e5abbb051924166c6808b79b516274fe
2014-09-12 22:39:39 -07:00
dcashman
3bf7caed23 am 089d5fb7: Allow appdomain read perms on apk_data_files.
* commit '089d5fb7e9087a7ac28ba65f883ad91613adaec3':
  Allow appdomain read perms on apk_data_files.
2014-09-12 05:59:23 +00:00