Commit graph

859 commits

Author SHA1 Message Date
Nick Kralevich
10f3c37097 Merge "Make sure exec_type is assigned to all entrypoint types." 2013-09-27 22:12:27 +00:00
Geremy Condra
fe45b9277b am 5c947234: Merge "Expand the set of neverallow rules applied to app domains."
* commit '5c9472342b06719fa5b7269aa60d9c1d3ee2ff98':
  Expand the set of neverallow rules applied to app domains.
2013-09-27 13:40:37 -07:00
Geremy Condra
5c9472342b Merge "Expand the set of neverallow rules applied to app domains." 2013-09-27 20:37:27 +00:00
Stephen Smalley
2a273ad2c5 Expand the set of neverallow rules applied to app domains.
This change synchronizes the AOSP set of neverallow rules for
app domains with our own.  However, as we exclude unconfineddomain
from each neverallow rule, it causes no breakage in the AOSP policy.
As app domains are confined, you will need to either adjust the
app domain or the neverallow rule according to your preference.
But our policy builds with all of these applied with all app domains
confined.

Change-Id: I00163d46a6ca3a87e3d742d90866300f889a0b11
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-27 16:36:27 -04:00
Stephen Smalley
45ba665cfc Label and allow access to /data/system/ndebugsocket.
Otherwise it defaults to the label of /data/system and
cannot be distinguished from any other socket in that directory.
Also adds allow rule required for pre-existing wpa_socket transition
to function without unconfined_domain.

Change-Id: I57179aa18786bd56d247f397347e546cca978e41
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-27 16:09:27 -04:00
Geremy Condra
9d42f07ed7 am 42c7357e: Merge "Isolate untrusted app ptys from other domains."
* commit '42c7357e9c6a1a59c283fa1b99488ea537617f09':
  Isolate untrusted app ptys from other domains.
2013-09-27 11:12:09 -07:00
Geremy Condra
42c7357e9c Merge "Isolate untrusted app ptys from other domains." 2013-09-27 18:09:03 +00:00
Stephen Smalley
460455c681 am b0712c1e: Remove /data/local/tmp/selinux entry.
* commit 'b0712c1e65b3007675952a9f8a9a123734051245':
  Remove /data/local/tmp/selinux entry.
2013-09-27 11:08:40 -07:00
Stephen Smalley
0130154985 Make sure exec_type is assigned to all entrypoint types.
Some file types used as domain entrypoints were missing the
exec_type attribute.  Add it and add a neverallow rule to
keep it that way.

Change-Id: I7563f3e03940a27ae40ed4d6bb74181c26148849
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-27 10:38:14 -04:00
Stephen Smalley
b0712c1e65 Remove /data/local/tmp/selinux entry.
Change-Id I027f76cff6df90e9909711cb81fbd17db95233c1 added a
/data/local/tmp/selinux entry at the same time domains were made
permissive.  I do not know why, and do not see how this is used.
So remove it.

Change-Id: I3218cc18de9781bc65ae403f2cf4c234847ef5f5
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-27 10:17:37 -04:00
Stephen Smalley
2dc4acf33b Isolate untrusted app ptys from other domains.
Add a create_pty() macro that allows a domain to
create and use its own ptys, isolated from the ptys
of any other domain, and use that macro for untrusted_app.
This permits the use of a pty by apps without opening up access
to ptys created by any other domain on the system.

Change-Id: I5d96ce4d1b26073d828e13eb71c48d1e14ce7d6b
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-27 10:11:33 -04:00
Stephen Smalley
10b9bbc255 am 189558f6: Remove legacy entries from crespo (Nexus S).
* commit '189558f64affb73b554b568db90d62eb7d2a9ada':
  Remove legacy entries from crespo (Nexus S).
2013-09-26 13:51:36 -07:00
Stephen Smalley
189558f64a Remove legacy entries from crespo (Nexus S).
These device nodes were specific to crespo / Nexus S and
if ever needed again, should be re-introduced in the per-device
sepolicy, not here.

Change-Id: I8366de83967974122c33937f470d586d49c34652
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-26 16:34:57 -04:00
Nick Kralevich
d1083bf210 am e9c4181b: zygote.te: fix comment.
* commit 'e9c4181b1c8ba06df415f8d5d6abf30e7d27b731':
  zygote.te: fix comment.
2013-09-23 11:38:13 -07:00
Nick Kralevich
882d09db04 am 199fc73f: Revert "Give Zygote the ability to write app data files."
* commit '199fc73f79d429881fa6c8dc39051cfeb4b337ea':
  Revert "Give Zygote the ability to write app data files."
2013-09-23 11:34:51 -07:00
Nick Kralevich
e9c4181b1c zygote.te: fix comment.
per the discussion in https://android-review.googlesource.com/#/c/65063/1/zygote.te
adjust the comment in this file.

Change-Id: I8db31e22ec34493442bc8e86bcd0bc0136b7bae4
2013-09-23 11:29:41 -07:00
Nick Kralevich
199fc73f79 Revert "Give Zygote the ability to write app data files."
This was a mistaken attempt to fix bug 10498304, but it didn't
actually have any impact. Revert.

This reverts commit fc2bd01b60.

Bug: 10498304
2013-09-23 11:29:40 -07:00
Stephen Smalley
f724333b9b am 7aba0bc4: Allow file types to be associated with the rootfs.
* commit '7aba0bc425a993cf16f87988adeaaa77f805db5e':
  Allow file types to be associated with the rootfs.
2013-09-20 10:47:46 -07:00
Stephen Smalley
7aba0bc425 Allow file types to be associated with the rootfs.
This is now possible due to the kernel change to support
setting security contexts on rootfs inodes.

Change-Id: I2a9aac1508eceabb92c3ae8eb5c63a16b28dda6f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-20 10:42:31 -07:00
Stephen Smalley
8bc57c8d6d am 567ee411: Label /dev/socket/gps with its own type.
* commit '567ee4116e0a7f842862bfc35d97f2fb9fe082a0':
  Label /dev/socket/gps with its own type.
2013-09-20 09:40:37 -07:00
Stephen Smalley
567ee4116e Label /dev/socket/gps with its own type.
The type was already defined and used in type transitions for cases
where the gps socket is created at runtime by gpsd, but on some devices
it is created by init based on an init.<board>.rc socket entry and therefore
needs a file_contexts entry.

Before:
$ ls -Z /dev/socket/gps
srw-rw---- gps      system            u:object_r:device:s0 gps

After:
$ ls -Z /dev/socket/gps
srw-rw---- gps      system            u:object_r:gps_socket:s0 gps

Change-Id: I8eef08d80e965fc4f3e9dd09d4fa446aaed82624
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-20 12:32:45 -04:00
Stephen Smalley
c41dd963fb am 4caf8c99: Label /dev/socket/mdns with its own type.
* commit '4caf8c997a30d214c8c2236cbe8a93e43e37699f':
  Label /dev/socket/mdns with its own type.
2013-09-19 12:17:41 -07:00
Stephen Smalley
4caf8c997a Label /dev/socket/mdns with its own type.
Otherwise it gets left in the general device type, and we get denials such
as:
type=1400 msg=audit(1379617262.940:102): avc:  denied  { write } for  pid=579 comm="mDnsConnector" name="mdns" dev="tmpfs" ino=3213 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=sock_file

This of course only shows up if using a confined system_server.

Change-Id: I2456dd7aa4d72e6fd15b55c251245186eb54a80a
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-19 15:09:38 -04:00
Nick Kralevich
0fb1cdf27e am 755cb39b: Merge changes Ia473e29d,Ic500af7b
* commit '755cb39b33a74d5b802da22e5856587b881ee9a3':
  write_klog also requires write permission to the directory.
  Allow access to /data/security/current symbolic link.
2013-09-18 13:06:03 -07:00
Nick Kralevich
755cb39b33 Merge changes Ia473e29d,Ic500af7b
* changes:
  write_klog also requires write permission to the directory.
  Allow access to /data/security/current symbolic link.
2013-09-18 20:04:06 +00:00
Nick Kralevich
3fb8dd6e77 am 54d92dc5: Merge "Extend to check indirect allow rules and conditional rules."
* commit '54d92dc5dca795000edf52958d8a26b96b9f5c08':
  Extend to check indirect allow rules and conditional rules.
2013-09-18 12:54:27 -07:00
Nick Kralevich
54d92dc5dc Merge "Extend to check indirect allow rules and conditional rules." 2013-09-18 19:52:37 +00:00
Alex Klyubin
ea29ae914e am 4103b3f2: 2/2: Rename domain "system" to "system_server".
* commit '4103b3f27ac0c6fdf16dac918ae791b709b24c6f':
  2/2: Rename domain "system" to "system_server".
2013-09-18 12:10:10 -07:00
Alex Klyubin
4103b3f27a 2/2: Rename domain "system" to "system_server".
This CL completes the renaming of domain system to system_server by
removing the "system" typealias that was temporarily added to avoid
breaking the build while the rename CLs are landing.

Change-Id: I05d11571f0e3d639026fcb9341c3476d44c54fca
2013-09-17 10:37:13 -07:00
Alex Klyubin
3d94272a75 am 1fdee11d: 1/2: Rename domain "system" to "system_server".
* commit '1fdee11df2552e29da0c48e3432f26f7a93e3bff':
  1/2: Rename domain "system" to "system_server".
2013-09-17 08:52:24 -07:00
Alex Klyubin
1fdee11df2 1/2: Rename domain "system" to "system_server".
This is a follow-up CL to the extraction of "system_app" domain
from the "system" domain which left the "system" domain encompassing
just the system_server.

Since this change cannot be made atomically across different
repositories, it temporarily adds a typealias "server" pointing to
"system_server". Once all other repositories have been switched to
"system_server", this alias will be removed.

Change-Id: I90a6850603dcf60049963462c5572d36de62bc00
2013-09-17 08:40:12 -07:00
Stephen Smalley
bbc0c39ba6 am a770f55b: Remove dbusd policy; dbusd is no more.
* commit 'a770f55b18da45a2b40436060e64096a5a0ba883':
  Remove dbusd policy; dbusd is no more.
2013-09-13 16:20:45 -07:00
Stephen Smalley
f8d86b8228 am 1d435de6: Remove bluetoothd policy; bluetoothd is no more.
* commit '1d435de685e0842e8d9902480db8b408f43911f6':
  Remove bluetoothd policy; bluetoothd is no more.
2013-09-13 16:17:25 -07:00
Stephen Smalley
a770f55b18 Remove dbusd policy; dbusd is no more.
Change-Id: I9652284bd34d07bd47e2e7df66fcbe5db185ab3f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 16:16:25 -07:00
Stephen Smalley
1d435de685 Remove bluetoothd policy; bluetoothd is no more.
Change-Id: I153b0aa8a747d6c79839d06fc04b3923eacfa213
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 16:15:25 -07:00
Stephen Smalley
1b487cb6da am 8840fa7f: Split system_app from system.
* commit '8840fa7f85e60fc4abd3cedf7cbfc2cd98a4d473':
  Split system_app from system.
2013-09-13 15:12:40 -07:00
Stephen Smalley
8840fa7f85 Split system_app from system.
system_app is for apps that run in the system UID, e.g. Settings.
system is for the system_server.
Split them into separate files and note their purpose in the comment
header of each file.

Change-Id: I19369abc728ba2159fd50ae6b230828857e19f10
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 15:09:11 -07:00
Stephen Smalley
8d72332e9a am a62d5c66: Drop obsolete comments about SEAndroidManager.
* commit 'a62d5c667984435fd9ba3bf1eb11d4fdaa3849c1':
  Drop obsolete comments about SEAndroidManager.
2013-09-13 13:28:58 -07:00
Stephen Smalley
a62d5c6679 Drop obsolete comments about SEAndroidManager.
Change-Id: I6b27418507ebd0113a97bea81f37e4dc1de6da14
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 13:26:14 -07:00
Stephen Smalley
cac0b7d601 am c0845036: Remove sys_nice capability from domains.
* commit 'c0845036cc8c494adf0adf24c9d93a23f59566f7':
  Remove sys_nice capability from domains.
2013-09-13 13:09:10 -07:00
Stephen Smalley
c0845036cc Remove sys_nice capability from domains.
Remove sys_nice capability from domains; this does not appear to be necessary
and should not be possible in particular for app domains.  If we encounter
specific instances where it should be granted, we can add it back on a
per-domain basis.  Allow it explicitly for the system_server.  Unconfined
domains get it via unconfined_domain() and the rules in unconfined.te.

Change-Id: I9669db80a04a90a22241b2fbc5236a28dcde8c6e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 13:06:36 -07:00
Nick Kralevich
28029a8d2e am d1f448d4: Merge changes Icd71c967,I3fd90ad9
* commit 'd1f448d4a53f87ae416aeb84ecf21bb703cc4c80':
  Do not permit appdomain to create/write to download_file.
  Remove duplicated rules between appdomain and isolated_app.
2013-09-13 13:01:04 -07:00
Stephen Smalley
e9761cb8cb am 29326eda: Drop domain write access to sysfs for the emulator.
* commit '29326eda65b121fe0edbbae43bc463af17aaed9b':
  Drop domain write access to sysfs for the emulator.
2013-09-13 13:01:03 -07:00
Stephen Smalley
a902c0cad0 am 0f7641d8: Label all files under /sys/qemu_trace with sysfs_writable.
* commit '0f7641d83d7044431db44d4dd2377e6f8ef93e85':
  Label all files under /sys/qemu_trace with sysfs_writable.
2013-09-13 13:01:03 -07:00
Nick Kralevich
d1f448d4a5 Merge changes Icd71c967,I3fd90ad9
* changes:
  Do not permit appdomain to create/write to download_file.
  Remove duplicated rules between appdomain and isolated_app.
2013-09-13 19:59:47 +00:00
Stephen Smalley
29326eda65 Drop domain write access to sysfs for the emulator.
3.4 goldfish kernel supports sysfs labeling so we no longer need this.

Change-Id: I77514a8f3102ac8be957c57d95e7de7d5901f69d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 18:29:03 +00:00
Stephen Smalley
0f7641d83d Label all files under /sys/qemu_trace with sysfs_writable.
Otherwise we have different security contexts but the same DAC
permissions:
-rw-rw-rw- root     root              u:object_r:sysfs_writable:s0 process_name
-rw-rw-rw- root     root              u:object_r:sysfs:s0 state
-rw-rw-rw- root     root              u:object_r:sysfs:s0 symbol

This change fixes denials such as:
type=1400 msg=audit(1379096020.770:144): avc:  denied  { write } for  pid=85 comm="SurfaceFlinger" name="symbol" dev="sysfs" ino=47 scontext=u:r:surfaceflinger:s0 tcontext=u:object_r:sysfs:s0 tclass=file

Change-Id: I261c7751da3778ee9241ec6b5476e8d9f96ba5ed
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 14:24:24 -04:00
Stephen Smalley
17454cf805 Do not permit appdomain to create/write to download_file.
The comment says that apps can read downloaded files, but the
file_type_auto_trans() macro expands to permit create/write access.
Also we don't need a type transition when staying in the same type
as the parent directory so we only truly need allow rules here.
Hence, we remove file_type_auto_trans() altogether, and add an allow
rule for search access to the directory.  If create/write access is
truly required, then we can just change the allow rules to use
rw_dir_perms and create_file_perms.

Change-Id: Icd71c9678419442cfd8088317317efd4332f9b4a
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 16:50:04 +00:00
Stephen Smalley
5b00f22349 Remove duplicated rules between appdomain and isolated_app.
r_dir_file(appdomain, isolated_app) was in both app.te and isolated_app.te;
delete it from isolated_app.te.
binder_call(appdomain, isolated_app) is a subset of binder_call(appdomain, appdomain); delete it.

Change-Id: I3fd90ad9c8862a0e4dad957425cbfbc9fa97c63f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-13 12:48:10 -04:00
Stephen Smalley
640991bb3c Extend to check indirect allow rules and conditional rules.
$ sepolicy-check -s untrusted_app -t mediaserver -c binder -p call -P out/target/product/manta/root/sepolicy
Match found!

Also removed loading of initial SIDs as that is not required for
this functionality and it leaks memory as it is never freed.
valgrind now reports no leaks.

Change-Id: Ic7a26fd01c57914e4e96db504d669f5367542a35
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-09-12 16:26:06 -04:00