Commit graph

1891 commits

Author SHA1 Message Date
Stephen Smalley
6ce36094a3 am 41e14c7f: Allow installd rename to app_data_file for movefiles command.
* commit '41e14c7f9da5bdf07e2ac7a323c0fddab8a090a0':
  Allow installd rename to app_data_file for movefiles command.
2014-05-12 13:43:00 +00:00
Stephen Smalley
41e14c7f9d Allow installd rename to app_data_file for movefiles command.
Change-Id: I29202292a78f0d2ae3b5da235c1783298f14bed8
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-12 08:42:01 -04:00
Stephen Smalley
c5cd04e107 am ae505511: Make the mediaserver domain enforcing.
* commit 'ae50551142fb6ef9a69ec60d4bd9b5af73a9ba50':
  Make the mediaserver domain enforcing.
2014-05-10 15:08:18 +00:00
Stephen Smalley
ae50551142 Make the mediaserver domain enforcing.
Change-Id: Ib4b4ebda74a9ebf08f38d73521d67bf98cd0ee67
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-10 08:04:05 -07:00
Stephen Smalley
8612e35eb6 am 8429c9b3: Make platform_app enforcing.
* commit '8429c9b365dfc09e900e58f33346a073b92a25d9':
  Make platform_app enforcing.
2014-05-10 14:19:00 +00:00
Stephen Smalley
8429c9b365 Make platform_app enforcing.
Change-Id: Ib4cbaee280628845d026e827d7e16f347594fc26
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-10 07:13:53 -07:00
Stephen Smalley
649cef4044 am 4ebbbcbf: Restrict installd to only the data file types needed.
* commit '4ebbbcbf3926f3aa54e7e7e28aad6625d4ee7340':
  Restrict installd to only the data file types needed.
2014-05-10 14:08:13 +00:00
Stephen Smalley
4ebbbcbf39 Restrict installd to only the data file types needed.
Drop rules on data_file_type attribute and replace with
rules on specific types, coalescing with existing rules
where appropriate.  Reorganize the rules and try to
annotate the reason for the different rules.

Change-Id: I2d07e7c276a9c29677f67db0ebecfc537c084965
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-09 16:44:56 -04:00
Stephen Smalley
29854d6d3f am 02dac03a: Drop relabelto_domain() macro and its associated definitions.
* commit '02dac03a8c7cc79306cf5807f86af3e01f5dc4af':
  Drop relabelto_domain() macro and its associated definitions.
2014-05-09 18:58:18 +00:00
Nick Kralevich
e06851179c am 004bd4e0: Allow installd to create the lib symlink for system_app_data_file
* commit '004bd4e0b675a87beb9d687cfdcfe15a06e84b3d':
  Allow installd to create the lib symlink for system_app_data_file
2014-05-09 18:32:50 +00:00
Stephen Smalley
02dac03a8c Drop relabelto_domain() macro and its associated definitions.
This was originally to limit the ability to relabel files to
particular types given the ability of all domains to relabelfrom
unlabeled files.  Since the latter was removed by
Ied84f8b4b1a0896c1b9f7d783b7463ce09d4807b, this no longer serves
any purpose.

Change-Id: Ic41e94437188183f15ed8b3732c6cd5918da3397
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-09 18:30:22 +00:00
Nick Kralevich
004bd4e0b6 Allow installd to create the lib symlink for system_app_data_file
91a4f8d4fd created system_app_data_file,
and assigned all system_apps to use this file type. For testing purposes,
our automated testing infrastructure sideloads shared system UID apks.
Installd does not have permission to create the lib symlink, so the
installation fails.

Allow installd to create this symlink.

  repro:
  adb install AppLaunch.apk
  276 KB/s (8414 bytes in 0.029s)
         pkg: /data/local/tmp/AppLaunch.apk
  Failure [INSTALL_FAILED_INTERNAL_ERROR]

  logcat:
  05-08 23:16:36.336   605   637 I PackageManager: Copying native libraries to /data/app-lib/vmdl609237490
  05-08 23:16:36.338   605   637 W asset   : Installing empty resources in to table 0x5e89a368
  05-08 23:16:36.359   193   193 W installd: type=1400 audit(0.0:29): avc:  denied  { create } for  name="lib" scontext=u:r:installd:s0 tcontext=u:object_r:system_app_data_file:s0 tclass=lnk_file
  05-08 23:16:36.363   193   193 E installd: couldn't symlink directory '/data/data/com.android.tests.applaunch/lib' -> '/data/app-lib/com.android.tests.applaunch-1': Permission denied
  05-08 23:16:36.364   605   637 W PackageManager: Failed linking native library dir (user=0)
  05-08 23:16:36.364   605   637 W PackageManager: Package couldn't be installed in /data/app/com.android.tests.applaunch-1.apk

Bug: 14659632
Change-Id: Iac4890302cd070aa3f71553af217f343ed7b8bc3
2014-05-09 11:19:20 -07:00
Nick Kralevich
e94ee1da69 am cd905ec0: Protect keystore\'s files.
* commit 'cd905ec04e6db7f9116afe05c95c0d5e387e5b15':
  Protect keystore's files.
2014-05-09 17:38:02 +00:00
Nick Kralevich
cd905ec04e Protect keystore's files.
Only keystore itself should be reading / writing it's files.
Remove keystore file access from other SELinux domains, including
unconfined. Add neverallow rules to protect against regressions.
Allow init limited access to recurse into keystore's directory.

Change-Id: I0bb5de7804f4314997c16fac18507933014bcadf
2014-05-09 10:14:56 -07:00
Nick Kralevich
48073591e2 am 1e9bb8be: Merge "Drop appdomain unlabeled file execute."
* commit '1e9bb8be0f492d106940b3ac96aadcf196bc1420':
  Drop appdomain unlabeled file execute.
2014-05-08 19:46:08 +00:00
Nick Kralevich
1e9bb8be0f Merge "Drop appdomain unlabeled file execute." 2014-05-08 19:41:43 +00:00
Nick Kralevich
c06d0fef12 am 9c9e8569: Merge "Drop rw access to unlabeled files."
* commit '9c9e8569a6e6e8b1057c6794ba0ca9a70daca4b5':
  Drop rw access to unlabeled files.
2014-05-08 18:09:21 +00:00
Nick Kralevich
9c9e8569a6 Merge "Drop rw access to unlabeled files." 2014-05-08 18:04:22 +00:00
Stephen Smalley
abd629cc2e am 9add1f03: Add sysfs_type attribute to sysfs, coalesce ueventd rules.
* commit '9add1f039bfd29649330e716246c01b3239bd362':
  Add sysfs_type attribute to sysfs, coalesce ueventd rules.
2014-05-08 17:27:50 +00:00
Stephen Smalley
9add1f039b Add sysfs_type attribute to sysfs, coalesce ueventd rules.
As per the discussion in:
https://android-review.googlesource.com/#/c/92903/

Add sysfs_type attribute to sysfs type so that it is included
in rules on sysfs_type, allow setattr to all sysfs_type for ueventd
for chown/chmod, and get rid of redundant rules.

Change-Id: I1228385d5703168c3852ec75605ed8da7c99b83d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-08 13:18:52 -04:00
Stephen Smalley
e69a32a1a8 Drop rw access to unlabeled files.
Should no longer be required due to restorecon_recursive of /data
by init.rc (covers everything outside of /data/data) and due to
restorecon_recursive of /data/data by installd (covers /data/data
directories).

Move the neverallow rule on relabelto to the neverallow section.
We could potentially drop this altogether, along with the relabelto_domain
macro and its callers, since its motivation was to provide some
safeguard in spite of allowing relabelfrom to unlabeled files for
all domains and this change removes relabelfrom.

unconfined still retains rw access to unlabeled, as do specific domains
that are explicitly allowed it.

Change-Id: Ied84f8b4b1a0896c1b9f7d783b7463ce09d4807b
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-08 08:41:54 -04:00
Stephen Smalley
681a687a60 Drop appdomain unlabeled file execute.
Should no longer be required due to restorecon_recursive of /data
by init.rc (covers /data/dalvik-cache and /data/app-lib) and due to
restorecon_recursive of /data/data by installd (covers /data/data
directories).

Change-Id: Icb217c0735852db7cca8583e381264ef8cd8839c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-08 08:38:54 -04:00
Greg Hackmann
4b683d248f am 7004789d: Add policies for Atomic Display Framework
* commit '7004789de39c1e712169ac6d4c98bdbe43dcce6e':
  Add policies for Atomic Display Framework
2014-05-07 22:30:42 +00:00
Greg Hackmann
7004789de3 Add policies for Atomic Display Framework
ADF is a modern replacement for fbdev.

ADF's device nodes (/dev/adf[X]), interface nodes
(/dev/adf-interface[X].[Y]), and overlay engine nodes
(/dev/adf-overlay-engine[X].[Y]) are collectively used in similar
contexts as fbdev nodes.  Vendor HW composers (via SurfaceFlinger) and
healthd will need to send R/W ioctls to these nodes to prepare and
update the display.

Ordinary apps should not talk to ADF directly.

Change-Id: Ic0a76b1e82c0cc1e8f240f219928af1783e79343
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-05-07 14:04:21 -07:00
Stephen Smalley
81d569cd03 am 77852065: Remove platform_app shell_data_file:lnk_file read access.
* commit '778520650a6b3e9a1ce587da996bf50e6265d8be':
  Remove platform_app shell_data_file:lnk_file read access.
2014-05-07 19:23:02 +00:00
Stephen Smalley
8c836899f8 am 53cde700: Report graphics_device accesses by system_server or mediaserver.
* commit '53cde700cda6caad25ba06092fa850ff51dd2431':
  Report graphics_device accesses by system_server or mediaserver.
2014-05-07 19:13:46 +00:00
Stephen Smalley
d7e5ef7e38 am 91a4f8d4: Label app data directories for system UID apps with a different type.
* commit '91a4f8d4fdab7df8474c2ffaa996c879166d8a4c':
  Label app data directories for system UID apps with a different type.
2014-05-07 19:10:09 +00:00
Stephen Smalley
778520650a Remove platform_app shell_data_file:lnk_file read access.
Not sure what denial originally motivated adding this
access, but drop it and see if it resurfaces.  platform_app
is still permissive_or_unconfined() so this should not break
anything.

Change-Id: Ia4418080e3477346fa48d23b4bb5d53396ed5593
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-07 15:08:12 -04:00
Stephen Smalley
53cde700cd Report graphics_device accesses by system_server or mediaserver.
See if we can remove these allow rules by auditing any granting
of these permissions.  These rules may be a legacy of older Android
or some board where the gpu device lived under /dev/graphics too.

Change-Id: I5c5d99ca97402de5196d9b6dfd249294f4d95baa
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-07 15:01:51 -04:00
Stephen Smalley
91a4f8d4fd Label app data directories for system UID apps with a different type.
We were using system_data_file for the /data/data directories of
system UID apps to match the DAC ownership of system UID shared with
other system files.  However, we are seeing cases where files created
in these directories must be writable by other apps, and we would like
to avoid allowing write to system data files outside of these directories.
So introduce a separate system_app_data_file type and assign it.
This should also help protect against arbitrary writes by system UID
apps to other system data directories.

This resolves the following denial when cropping or taking a user photo
for secondary users:
avc:  denied  { write } for  path="/data/data/com.android.settings/cache/TakeEditUserPhoto2.jpg" dev="mmcblk0p28" ino=82120 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file

avc:  denied  { write } for path="/data/data/com.android.settings/cache/CropEditUserPhoto.jpg" dev="mmcblk0p30" ino=602905 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file

Bug: 14604553
Change-Id: Ifa10e3283b07f6bd6ecc16eceeb663edfd756cea
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-07 18:04:51 +00:00
Nick Kralevich
46de9898a8 am 2aed6d89: Merge "Make su a net domain."
* commit '2aed6d8991b06ec310cc16269c350bdf28a13845':
  Make su a net domain.
2014-05-05 19:51:51 +00:00
Nick Kralevich
2aed6d8991 Merge "Make su a net domain." 2014-05-05 19:49:04 +00:00
Nick Kralevich
e8d685b36b am 557fe2ab: Merge "Escape dot (.) when it is intended to be literal."
* commit '557fe2abd6987585bb2b14a2b9d966e714eee8aa':
  Escape dot (.) when it is intended to be literal.
2014-05-05 18:37:49 +00:00
Nick Kralevich
47a0e1b37e am 1545b606: allow untrusted_app to write to MMS files
* commit '1545b6061518bac473cf93af576cbea12a992298':
  allow untrusted_app to write to MMS files
2014-05-05 18:34:20 +00:00
Nick Kralevich
557fe2abd6 Merge "Escape dot (.) when it is intended to be literal." 2014-05-05 18:33:55 +00:00
Stephen Smalley
812f7d90d2 Escape dot (.) when it is intended to be literal.
Otherwise it is treated as a regex and matches any character.

Change-Id: I9e23f01b0e104d3ef57993fd1a3d9a5b13201910
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-05 14:16:06 -04:00
Nick Kralevich
1545b60615 allow untrusted_app to write to MMS files
Commit 3fbc536dfd allowed untrusted
app to read radio data files passed via binder, but didn't allow
write access. Write access is needed when sending MMS messages.

Steps to reproduce:
1) have some photos on the device
2) Launch messaging app
3) Attach a MMS (Picture, capture video, capture picture, audio recording etc..)
4) Send

EXPECTED RESULTS:
No crash

OBSERVED RESULTS:
- Messaging crashes on sending MMS
- messages are stuck in sending state

Additional details:
  05-05 10:14:01.196  2457  2457 W Binder_3: type=1400 audit(0.0:20): avc:  denied  { write } for  path="/data/data/com.android.providers.telephony/app_parts/PART_1399310041183_temp.jpg" dev="mmcblk0p23" ino=604417 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
  05-05 10:14:01.202 27809 28219 E JavaBinder: !!! FAILED BINDER TRANSACTION !!!
  05-05 10:14:01.203 27809 28219 E PduPersister: Failed to open Input/Output stream.
  05-05 10:14:01.203 27809 28219 E PduPersister: java.io.FileNotFoundException: Failed opening content provider: content://mms/part/4
  05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:966)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openOutputStream(ContentResolver.java:674)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openOutputStream(ContentResolver.java:650)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persistData(PduPersister.java:837)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persistPart(PduPersister.java:761)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persist(PduPersister.java:1398)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.createDraftMmsMessage(WorkingMessage.java:1577)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.sendMmsWorker(WorkingMessage.java:1431)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.access$700(WorkingMessage.java:82)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage$2.run(WorkingMessage.java:1228)
  05-05 10:14:01.203 27809 28219 E PduPersister:        at java.lang.Thread.run(Thread.java:818)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime: FATAL EXCEPTION: WorkingMessage.send MMS
  05-05 10:14:01.221 27809 28219 E AndroidRuntime: Process: com.android.mms, PID: 27809
  05-05 10:14:01.221 27809 28219 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getLastPathSegment()' on a null object reference
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at android.content.ContentUris.parseId(ContentUris.java:85)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.model.SlideshowModel.finalResize(SlideshowModel.java:691)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage.sendMmsWorker(WorkingMessage.java:1448)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage.access$700(WorkingMessage.java:82)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage$2.run(WorkingMessage.java:1228)
  05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at java.lang.Thread.run(Thread.java:818)
  05-05 10:14:01.222   659  5253 W ActivityManager:   Force finishing activity com.android.mms/.ui.ComposeMessageActivity

Bug: 14562421
Change-Id: Iba6914eeec4bf0c8c04ee83584327a4824c0a9a9
2014-05-05 11:14:15 -07:00
dcashman
5387e25a4d am f6e3586c: Merge "Remove specifycapabilities permission."
* commit 'f6e3586c53dbafc8286e71a181a311097b285c70':
  Remove specifycapabilities permission.
2014-05-05 16:34:34 +00:00
dcashman
f6e3586c53 Merge "Remove specifycapabilities permission." 2014-05-05 16:31:48 +00:00
dcashman
c4db82cf85 Remove specifycapabilities permission.
specifycapabilities is no longer specified by the zygote userspace manager.
It was removed in commit: 42a4bb5730266f80585e67262c73505d0bfffbf8.  Remove
this permission from policy.

Change-Id: I866a25b590a375a68de6eec9af1b3ef779889985
2014-05-02 19:58:23 -07:00
Sreeram Ramachandran
bc320187b9 Make su a net domain.
Change-Id: Ied6e6eba4895524cf8b442694cc48ef2d6f9a811
2014-05-02 14:50:26 -07:00
Ruchi Kandoi
d0ac72bed8 am 0a333759: ueventd: Adds permission to ueventd to access sysfs file
* commit '0a3337595dcc9f432139790baef97dc5b0863094':
  ueventd: Adds permission to ueventd to access sysfs file
2014-05-01 17:33:21 +00:00
Ruchi Kandoi
0a3337595d ueventd: Adds permission to ueventd to access sysfs file
Need this for changing max_cpufreq for the low power mode.

Denials:
type=1400 audit(1398818907.151:48): avc:  denied  { relabelfrom } for
pid=129 comm="ueventd" name="scaling_max_freq" dev="sysfs" ino=19866
scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs:s0 tclass=file

type=1400 audit(118521.050:11): avc:  denied  { setattr } for  pid=130
comm="ueventd" name="scaling_min_freq" dev="sysfs" ino=9178
scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0
tclass=file

Change required for Change-Id: Ibe0b4aaf3db555ed48e89a7fcd0c5fd3a18cf233

Change-Id: I93feee65b1535ac048acf3bc7fba9f5d1bdb2bd2
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2014-05-01 17:30:03 +00:00
Stephen Smalley
7e41fcb2c4 am 3a4eb96b: Make the untrusted_app domain enforcing.
* commit '3a4eb96b2a462dd68636c749cec47723fd8dc51f':
  Make the untrusted_app domain enforcing.
2014-05-01 17:10:42 +00:00
Stephen Smalley
3a4eb96b2a Make the untrusted_app domain enforcing.
Change-Id: I4811da972f7e23ef86e04d05400169422fbaca35
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-01 10:04:58 -07:00
Narayan Kamath
f4fc0c1783 am 99499dc0: Merge "Change zygote sepolicy whitelist."
* commit '99499dc0396df0e03eda4b6085cbde38658a8c2f':
  Change zygote sepolicy whitelist.
2014-05-01 10:23:07 +00:00
Narayan Kamath
99499dc039 Merge "Change zygote sepolicy whitelist." 2014-05-01 10:20:44 +00:00
Narayan Kamath
3a06a72c16 Change zygote sepolicy whitelist.
Allow the zygote to create instruction set specific
directories under /data/dalvik-cache and to change their owner
to the system UID.

These subdirectories are required in order to support
instruction set specific dex caches on devices that support
multiple instruction sets. We can't ask init to create these
directories for us, because init doesn't have any knowledge
about the list of runtime instruction sets the device supports.

The owner needs to be system because the package manager (running
in the system_server) is allowed to manipulate files under this
directory.

(cherry picked from commit 032e5b0ae1)

Change-Id: I3a85e8a6b4eed003a93490e7b93a4fd68c41a361
2014-05-01 11:19:00 +01:00
Nick Kralevich
c199570034 am 0e06c137: Allow shell debugfs read access
* commit '0e06c13784e50183401ca95fed2be49b0ead26fd':
  Allow shell debugfs read access
2014-04-30 21:40:12 +00:00
Nick Kralevich
0e06c13784 Allow shell debugfs read access
Developers should be able to use systrace with user builds.
This requires read access to /sys/kernel/debug/tracing/trace,
otherwise the following error occurs:

  $ atrace
  capturing trace... done
  TRACE:
  error opening /sys/kernel/debug/tracing/trace: Permission denied (13)

with the following SELinux denial:

  <4>[   79.830542] type=1400 audit(11940551.039:8): avc:  denied  { read } for  pid=1156 comm="atrace" name="trace" dev="debugfs" ino=3024 scontext=u:r:shell:s0 tcontext=u:object_r:debugfs:s0 tclass=file

At least on the kernel I've tested this on, debugfs doesn't support
setting SELinux file labels. Grant read access to all of debugfs to
work around this limitation.

Bug: 13904660
Change-Id: Ib58e98972c5012e9b34fec9e0a6094641638cd9a
2014-04-30 19:28:01 +00:00