Commit graph

272 commits

Author SHA1 Message Date
Mark Salyzyn
000c03b481 Add recovery_persist & recovery_refresh
am: 16fe52c

* commit '16fe52c90caae18c0d91918d6bfc471f2e637207':
  Add recovery_persist & recovery_refresh
2016-03-24 19:37:02 +00:00
Mark Salyzyn
16fe52c90c Add recovery_persist & recovery_refresh
One time executables. recovery_refresh can be used at any time to
ensure recovery logs in pmsg are re-placed at the end of the FIFO.
recovery_persist takes the recovery logs in pmsg and drops them
into /data/misc/recovery/ directory.

Bug: 27176738
Change-Id: Ife3cf323930fb7a6a5d1704667961f9d42bfc5ac
2016-03-24 11:30:29 -07:00
dcashman
f100b2c4e6 Create sysfs_hwrandom type.
HwRngTest needs access to the hwrandom sysfs files, but untrused_app
does not have access to sysfs.  Give these files their own label and
allow the needed read access.

(cherry-pick from internal commit: 85c0f8affa)

Bug: 27263241
Change-Id: If572ad0931a534d76e148b688b76687460e99af9
2016-03-14 10:27:33 -07:00
dcashman
7fa51de7f1 Merge "Create sysfs_hwrandom type." into nyc-dev
am: 9404522aeb

* commit '9404522aebd395d4a58bd3dfd0ac7d5a394af816':
  Create sysfs_hwrandom type.
2016-03-14 17:21:31 +00:00
Daniel Cashman
9404522aeb Merge "Create sysfs_hwrandom type." into nyc-dev 2016-03-14 17:14:26 +00:00
Janis Danisevskis
e249da09fe Leftovers of SELinux policy reload mechanism
am: 1c983327cf

* commit '1c983327cf7e841183da15934c7ba2e99d0979c0':
  Leftovers of SELinux policy reload mechanism
2016-03-13 14:52:43 +00:00
dcashman
85c0f8affa Create sysfs_hwrandom type.
HwRngTest needs access to the hwrandom sysfs files, but untrused_app
does not have access to sysfs.  Give these files their own label and
allow the needed read access.

Bug: 27263241
Change-Id: I718ba485e9e6627bac6e579f746658d85134b24b
2016-03-11 15:44:44 -08:00
Janis Danisevskis
1c983327cf Leftovers of SELinux policy reload mechanism
Remove references to /data/security and the corresponding
type securitly_file.

Bug: 26544104
Change-Id: Iac00c293daa6b781a24c2bd4c12168dfb1cceac6
2016-03-11 17:48:19 +00:00
Oleksandr Peletskyi
33fe4784c3 Modified security policy to allow user to get their own icon.
BUG: 27583869
Change-Id: I0a25bd03f3998d48dba355b91140611e38ce7b0d
2016-03-10 14:11:36 +01:00
Makoto Onuki
085c16914c Allow "shortcut manager" icons to be returned to apps
... and client apps to read them.

A full path looks like this:
/data/system_ce/[user-id]/shortcut_service/bitmaps/[creator-app-package]/[timestamp].png

System server will:
- Create/delete the directories.
- Write/remove PNG files in them.
- Open the PNG files and return file descriptors to client apps

Client apps will:
- Receive file descriptors and read from them.

Bug 27548047

Change-Id: I3d9ac6ab0c92b2953b84c3c5aabe1f653e6bea6b
2016-03-08 17:09:27 -08:00
Alex Deymo
a52b561859 New postinstall domain and rules to run post-install program.
When using the A/B updater, a device specific hook is sometimes needed
to run after the new partitions are updated but before rebooting into
the new image. This hook is referred to throughout the code as the
"postinstall" step.

This patch creates a new execution domain "postinstall" which
update_engine will use to run said hook. Since the hook needs to run
from the new image (namelly, slot "B"), update_engine needs to
temporarly mount this B partition into /postinstall and then run a
program from there.

Since the new program in B runs from the old execution context in A, we
can't rely on the labels set in the xattr in the new filesystem to
enforce the policies baked into the old running image. Instead, when
temporarily mounting the new filesystem in update_engine, we override
all the new file attributes with the new postinstall_file type by
passing "context=u:object_r:postinstall_file:s0" to the mount syscall.
This allows us to set new rules specific to the postinstall environment
that are consistent with the rules in the old system.

Bug: 27177071
TEST=Deployed a payload with a trivial postinstall script to edison-eng.

(cherry picked from commit 6cb2c893b1)

Change-Id: I49a529eecf1ef0524819470876ef7c8c2659c7ef
2016-03-04 15:49:15 -08:00
Tao Bao
acf4e09999 Merge "Add /dev/socket/uncrypt." into nyc-dev 2016-03-03 19:52:46 +00:00
Alex Deymo
6cb2c893b1 New postinstall domain and rules to run post-install program.
When using the A/B updater, a device specific hook is sometimes needed
to run after the new partitions are updated but before rebooting into
the new image. This hook is referred to throughout the code as the
"postinstall" step.

This patch creates a new execution domain "postinstall" which
update_engine will use to run said hook. Since the hook needs to run
from the new image (namelly, slot "B"), update_engine needs to
temporarly mount this B partition into /postinstall and then run a
program from there.

Since the new program in B runs from the old execution context in A, we
can't rely on the labels set in the xattr in the new filesystem to
enforce the policies baked into the old running image. Instead, when
temporarily mounting the new filesystem in update_engine, we override
all the new file attributes with the new postinstall_file type by
passing "context=u:object_r:postinstall_file:s0" to the mount syscall.
This allows us to set new rules specific to the postinstall environment
that are consistent with the rules in the old system.

Bug: 27177071
TEST=Deployed a payload with a trivial postinstall script to edison-eng.

Change-Id: Ib06fab92afb45edaec3c9c9872304dc9386151b4
2016-03-02 15:33:12 -08:00
Tao Bao
c285cad1a6 Add /dev/socket/uncrypt.
system_server used to communicate with uncrypt via files (e.g.
/cache/recovery/command and /cache/recovery/uncrypt_status). Since A/B
devices may not have /cache partitions anymore, we switch to communicate
via /dev/socket/uncrypt to allow things like factory reset to keep
working.

Bug: 27176738
Change-Id: I73b6d6f1ecdf16fd4f3600b5e524da06f35b5bca
2016-03-02 10:51:13 -08:00
Calin Juravle
837bc42f5f Add SElinux policies to allow foreign dex usage tracking.
This is a special profile folder where apps will leave profile markers
for the dex files they load and don't own. System server will read the
markers and decide which apk should be fully compiled instead of
profile guide compiled.

Apps need only to be able to create (touch) files in this directory.
System server needs only to be able to check wheter or not a file with a
given name exists.

Bug: 27334750
Bug: 26080105

Change-Id: I2256e4aba1ec0e5117de6497123223b9a74f404e
2016-03-01 15:50:08 +00:00
Glenn Kasten
a33fbb3cf8 Merge "Restore audio tee sink" into nyc-dev 2016-02-24 16:50:23 +00:00
Glenn Kasten
962e3a6a05 Restore audio tee sink
Bug: 27323882
Change-Id: Idf3977d74817c4f90f9e993d2e1e5302cc56f41d
2016-02-23 16:16:16 -08:00
Jeff Sharkey
62bb52c4d4 Offer to cache ringtones in system DE storage.
Ringtones often live on shared media, which is now encrypted with CE
keys and not available until after the user is unlocked.  To improve
the user experience while locked, cache the default ringtone,
notification sound, and alarm sound in a DE storage area.

Also fix bug where wallpaper_file wasn't getting data_file_type.

Bug: 26730753
Change-Id: Ib1f08d03eb734c3dce91daab41601d3ed14f4f0d
2016-02-23 13:45:29 -07:00
Calin Juravle
89625c9a64 Update permissions for the dedicated profile folders
Bug: 26719109
Bug: 26563023

Change-Id: Ie0ca764467c874c061752cbbc73e1bacead9b995
2016-02-19 13:40:33 +00:00
Christopher Tate
2e1556dc76 Track wallpaper API changes
Bug 25454162

Change-Id: I3cd299ce28bf6235605265c47762969851845b78
2016-02-18 22:56:42 +00:00
Jeff Tinker
0d5bac13e1 Add mediadrm service
Part of media security hardening

This is an intermediate step toward moving
mediadrm to a new service separate from mediaserver.
This first step allows mediadrmservice to run based
on the system property media.mediadrmservice.enable
so it can be selectively enabled on devices that
support using native_handles for secure buffers.

bug: 22990512
Change-Id: I2208c1e87a6bd8d5bfaed06b1fdcb0509c11cff2
2016-02-12 19:38:22 -08:00
Marco Nelissen
c3ba2e5130 selinux rules for codec process
Bug: 22775369

Change-Id: Ic6abe3d0e18ba6f7554d027e0ec05fd19011709b
2016-02-09 14:13:13 -08:00
Andreas Gampe
47ebae1a7a Selinux: introduce policy for OTA preopt
Add permissions to dex2oat, introduce otapreopt binary and otadexopt
service.

Bug: 25612095
Change-Id: I80fcba2785e80b2931d7d82bb07474f6cd0099f7
2016-02-04 16:58:43 -08:00
Christopher Tate
b8104a47dd Move staged backup content to a specific cache subdir
Also narrowly specify the domain for the local transport's bookkeeping.

Bug 26834865

Change-Id: I2eea8a10f29356ffecabd8e102f7afa90123c535
2016-01-29 14:05:35 -08:00
Chris Tate
02bffbb8dc Merge "Add rules for original + processed wallpaper files" 2016-01-29 00:38:36 +00:00
Christopher Tate
fdeeb59bdb Add rules for original + processed wallpaper files
Bug 25454501

Change-Id: I31357e658ecdbcc69df47fbc2d22e4849dd1539b
2016-01-28 13:52:09 -08:00
Marco Nelissen
b1bf83fd79 Revert "selinux rules for codec process"
This reverts commit 2afb217b68.

Change-Id: Ie2ba8d86f9c7078f970afbb06230f9573c28e0ed
2016-01-28 13:51:28 -08:00
Chien-Yu Chen
e0378303b5 selinux: Update policies for cameraserver
Update policies for cameraserver so it has the same permissions
as mediaserver.

Bug: 24511454
Change-Id: I1191e2ac36c00b942282f8dc3db9903551945adb
2016-01-27 11:29:11 -08:00
Marco Nelissen
87a79cf9dd Merge "selinux rules for codec process" 2016-01-27 17:46:47 +00:00
James Hawkins
327da659be Merge "bootstat: Fix the SELinux policy after removing domain_deprecated." am: ae29dea8b7
am: c119fab939

* commit 'c119fab9392cc8a7d95d88417ff8a1c2a521566f':
  bootstat: Fix the SELinux policy after removing domain_deprecated.
2016-01-26 21:54:59 +00:00
James Hawkins
2e8d71c3be bootstat: Fix the SELinux policy after removing domain_deprecated.
* Allow reading /proc.

type=1400 audit(1453834004.239:7): avc: denied { read } for pid=1305
comm="bootstat" name="uptime" dev="proc" ino=4026536600
scontext=u:r:bootstat:s0 tcontext=u:object_r:proc:s0 tclass=file
permissive=0

* Define domain for the /system/bin/bootstat file.

init: Service exec 4 (/system/bin/bootstat) does not have a SELinux
domain defined.

Bug: 21724738
Change-Id: I4baa2fa7466ac35a1ced79776943c07635ec9804
2016-01-26 18:52:58 +00:00
Marco Nelissen
2afb217b68 selinux rules for codec process
Bug: 22775369
Change-Id: I9733457b85dbaeb872b8f4aff31d0b8808fa7d44
2016-01-22 14:43:14 -08:00
James Hawkins
7060411a28 Merge "bootstat: Implement the SELinux policy to allow reading/writing to /data/misc/bootstat." am: 447041a940
am: 701b7d3cae

* commit '701b7d3cae0cc2546e85fcfdc706c230713a517a':
  bootstat: Implement the SELinux policy to allow reading/writing to /data/misc/bootstat.
2016-01-22 18:32:26 +00:00
James Hawkins
39c198ac6f bootstat: Implement the SELinux policy to allow reading/writing to
/data/misc/bootstat.

BUG: 21724738
Change-Id: I2789f57cc8182af1a7c33672ef82297f32f54e2e
2016-01-22 08:08:37 -08:00
Jeffrey Vander Stoep
4c26574012 Merge "camera_device: remove type and add typealias" am: c15e1036d4
am: 1ac3573614

* commit '1ac3573614354b50dabf4e09ade764c930286c2e':
  camera_device: remove type and add typealias
2016-01-15 19:41:34 +00:00
William Roberts
b7aace2db0 camera_device: remove type and add typealias
camera_device didn't really offer much in terms of control considering
that most domains that need camera_device, also need video_device and
vice versa.

Thus, drop camera_device from the policy and add a temporary typealias.

Change-Id: I144c0bb49a9a68ab1bdf636c64abe656f3e677b4
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-01-12 13:54:34 -08:00
Felipe Leme
e97bd887ca Creates a new permission for /cache/recovery am: 549ccf77e3
am: b16fc899d7

* commit 'b16fc899d718f91935932fb9b15de0a0b82835c8':
  Creates a new permission for /cache/recovery
2016-01-04 23:55:14 +00:00
dcashman
05e68e1269 resolve merge conflicts of 8350a7f152 to master.
Change-Id: I80109bb0167f06a8d39d8b036b3c487ec2f06124
2016-01-04 15:47:19 -08:00
Felipe Leme
549ccf77e3 Creates a new permission for /cache/recovery
This permission was created mostly for dumpstate (so it can include
recovery files on bugreports when an OTA fails), but it was applied to
uncrypt and recovery as well (since it had a wider access before).

Grant access to cache_recovery_file where we previously granted access
to cache_file. Add auditallow rules to determine if this is really
needed.

BUG: 25351711
Change-Id: I07745181dbb4f0bde75694ea31b3ab79a4682f18
2016-01-04 23:11:28 +00:00
dcashman
36f255ff52 Create sysfs_zram label.
Address following denials:
avc: denied { getattr } for path="/sys/devices/virtual/block/zram0/disksize" dev="sysfs" ino=14958 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { search } for name="zram0" dev="sysfs" ino=14903 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
avc: denied { read } for name="mem_used_total" dev="sysfs" ino=14970 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { write } for name="uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { open } for path="/sys/devices/virtual/block/zram0/uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
avc: denied { read } for pid=348 comm="vold" name="zram0" dev="sysfs" ino=15223 scontext=u:r:vold:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
avc: denied { search } for pid=3494 comm="ContactsProvide" name="zram0"dev="sysfs" ino=15223 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0

Bug: 22032619
Change-Id: I40cf918b7cafdba6cb3d42b04b1616a84e4ce158
2016-01-04 14:24:09 -08:00
Nick Kralevich
91b2a9cc49 label /sys/kernel/debug/tracing and remove debugfs write am: fe12b61642
am: ba79ddefd5

* commit 'ba79ddefd50a3a2a5234caf72562ccae05a60837':
  label /sys/kernel/debug/tracing and remove debugfs write
2015-12-15 01:06:31 +00:00
Nick Kralevich
fe12b61642 label /sys/kernel/debug/tracing and remove debugfs write
Start labeling the directory /sys/kernel/debug/tracing. The files
in this directory need to be writable to the shell user.

Remove global debugfs:file write access. This was added in the days
before we could label individual debugfs files.

Change-Id: I79c1fcb63b4b9b903dcabd99b6b25e201fe540a3
2015-12-14 13:57:26 -08:00
Andy Hung
e02e6c03a5 Merge "Add rules for running audio services in audioserver" 2015-12-11 20:10:34 +00:00
Tao Bao
8bb76fd118 Allow update_verifier to access bootctrl_block_device. am: 14b6f44933
am: 85af2526ac

* commit '85af2526ac0f9fc76ee6b57198c156100fe0e9cb':
  Allow update_verifier to access bootctrl_block_device.
2015-12-08 18:03:10 +00:00
Tao Bao
85af2526ac Allow update_verifier to access bootctrl_block_device.
am: 14b6f44933

* commit '14b6f44933a9bdbe7ad48faf461901e2c016585d':
  Allow update_verifier to access bootctrl_block_device.
2015-12-08 09:59:49 -08:00
Tao Bao
14b6f44933 Allow update_verifier to access bootctrl_block_device.
Bug: 26039641
Change-Id: Ifd96b105f054b67f881529db3fe94718cab4a0f4
(cherry picked from commit 8eaf25856e)
2015-12-08 09:55:16 -08:00
Tao Bao
8eaf25856e Allow update_verifier to access bootctrl_block_device.
Bug: 26039641
Change-Id: Ifd96b105f054b67f881529db3fe94718cab4a0f4
2015-12-07 22:31:15 -08:00
Nick Kralevich
107e26032b Add initial debugfs labeling support and label /sys/kernel/debug/tracing/trace_marker am: 44826cb5e4 am: 7fe25900b4
am: 713ad50b75

* commit '713ad50b7554b8c12effafa5bd874e3c7e56a23e':
  Add initial debugfs labeling support and label /sys/kernel/debug/tracing/trace_marker
2015-12-08 04:54:10 +00:00
Marco Nelissen
b03831fe58 Add rules for running audio services in audioserver
audioserver has the same rules as mediaserver so there is
no loss of rights or permissions.

media.log moves to audioserver.

TBD: Pare down permissions.

Bug: 24511453
Change-Id: I0fff24c14b712bb3d498f75e8fd66c2eb795171d
2015-12-07 17:33:20 -08:00
Nick Kralevich
44826cb5e4 Add initial debugfs labeling support and label /sys/kernel/debug/tracing/trace_marker
Add initial support for labeling files on /sys/kernel/debug.
The kernel support was added in https://android-review.googlesource.com/122130
but the userspace portion of the change was never completed until now.

Start labeling the file /sys/kernel/debug/tracing/trace_marker . This
is the trace_marker file, which is written to by almost all processes
in Android. Allow global write access to this file.

This change should be submitted at the same time as the system/core
commit with the same Change-Id as this patch.

Change-Id: Id1d6a9ad6d0759d6de839458890e8cb24685db6d
2015-12-07 17:04:49 -08:00