753 Commits

Author SHA1 Message Date
Svetoslav Ganov
1181f448c1 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Ibf56827209a9b791aa83ae679219baf829ffc2ac
2016-12-09 00:08:33 +00:00
Bill Napier
43966dafb3 Revert "Fix vulnerability in MemoryIntArray am: a97171ec49"
This reverts commit fb12dd509f8e106d034f67c2e404845128128994.

Change-Id: I9e1b22b8df0e754095541a758096cba279a81ab1
2016-12-08 22:22:38 +00:00
Svetoslav Ganov
fb12dd509f Fix vulnerability in MemoryIntArray
am: a97171ec49

Change-Id: Ifa2221a9b8ca705ef0239d61772938ac11761ce2
2016-12-08 21:37:33 +00:00
Svetoslav Ganov
a97171ec49 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

 Further, we now check the memory mapped size against
 the size of the underlying ashmem region after we do
 the memory mapping (to fix the ahsmem size) and if
 an attacker changed the size under us we throw.

 Tests: Updated the tests and they pass.

 bug:33039926
 bug:33042690

Change-Id: I1004579181ff7a223ef659e85c46100c47ab2409
2016-12-08 11:51:26 -08:00
Svetoslav Ganov
64b5725900 Revert "Fix vulnerability in MemoryIntArray"
am: 1f06508bc6

Change-Id: Id387817495b1857f304203c8487da3db49bdd0e4
2016-12-08 02:29:00 +00:00
Svetoslav Ganov
1f06508bc6 Revert "Fix vulnerability in MemoryIntArray"
This reverts commit 4694cad51122c20880d00389ef95833d7a14b358.

Change-Id: I235ea3c4bd86d90bf97bc1a2d023f4780251e570
2016-12-08 02:17:40 +00:00
Svetoslav Ganov
ec40a70ffb Fix vulnerability in MemoryIntArray
am: 4694cad511

Change-Id: I64257a851c06e4a333056ee132ff8a2ea29aef5c
2016-12-08 01:49:21 +00:00
Aart Bik
86699f980f Revert "Fix vulnerability in MemoryIntArray"
am: 29139a8ae5

Change-Id: I3975cfc51bd03a65855c113dfdb827d24471e0ba
2016-12-08 01:36:50 +00:00
Svetoslav Ganov
4694cad511 Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Id7f0e8a4c861b0b9fa796767e0c22d96633b14d1
2016-12-08 01:35:08 +00:00
Aart Bik
29139a8ae5 Revert "Fix vulnerability in MemoryIntArray"
This reverts commit 86dfa094de773670743d41c3e3156eace8e403a3.


BROKE BUILD (as shown in some treehugger builds)

frameworks/base/core/java/android/util/MemoryIntArray.java:84: error: cannot find symbol
        mCloseGuard.open("close");
        ^
        
       
bug:33039926
bug:33042690

Change-Id: Ief875e543ec849fe55c747fb1ed5253f0cd9a122
2016-12-08 01:12:48 +00:00
Svetoslav Ganov
367023218e Fix vulnerability in MemoryIntArray
am: 86dfa094de

Change-Id: I664782bea6e2b941ba94e51c65afd7e9b0f95f8d
2016-12-08 00:42:18 +00:00
Svetoslav Ganov
86dfa094de Fix vulnerability in MemoryIntArray
MemoryIntArray was using the size of the undelying
ashmem region to mmap the data but the ashmem size
can be changed until the former is memory mapped.
Since we use the ashmem region size for boundary
checking and memory unmapping if it does not match
the size used while mapping an attacker can force
the system to unmap memory or to access undefined
memory and crash.

Also we were passing the memory address where the
ashmem region is mapped in the owner process to
support cases where the client can pass back the
MemoryIntArray instance. This allows an attacker
to put invalid address and cause arbitrary memory
to be freed.

Now we no longer support passing back the instance
to the owner process (the passed back instance is
read only), so no need to pass the memory adress
of the owner's mapping, thus not allowing freeing
arbitrary memory.

Further, we now check the memory mapped size against
the size of the underlying ashmem region after we do
the memory mapping (to fix the ahsmem size) and if
an attacker changed the size under us we throw.

Tests: Updated the tests and they pass.

bug:33039926
bug:33042690

Change-Id: Ie267646eb88014034fbd048d7a9bc273420c7eff
2016-12-07 15:19:13 -08:00
Svetoslav Ganov
a340bfd7a1 Add historical logging to settings provider
This change adds historical operations to the dump state
of the settings provider. The historica operations are
currently appended only on user-debug and eng builds.

These change is needed to help diagnose the referred
bug and improve the settings provider's maintenance.

bug:30561721

Change-Id: I58a1ba0d598c4d28adcb5e654ebb78cf947e94db
2016-08-03 15:48:44 -07:00
Benjamin Franz
36eb7a1370 Block user from setting safe boot setting via adb
am: 0ff13fce6f

Change-Id: I50db586478eb52d0a2f43e9150cc663c96e5779b
2016-07-22 08:47:32 +00:00
Daniel Sandler
c3bdde9790 Merge "Decrease default longpress timeout to 400ms." into nyc-mr1-dev 2016-07-22 04:41:30 +00:00
Dan Sandler
71f85e9194 Decrease default longpress timeout to 400ms.
If the device being upgraded happens to have a timeout of
500ms it will be reset to 400. If the value is something
else it will be left alone upon upgrade.

Bug: 30159825
Change-Id: Ifec70e458ce0199b61d36f7504aea02b4a974990
2016-07-21 19:23:12 -04:00
Bill Yi
8eff1c381b Import translations. DO NOT MERGE
Change-Id: I7261aecb1f28f1b46c1555c52a0010bcc6c52408
Auto-generated-cl: translation import
2016-07-20 19:44:42 -07:00
Benjamin Franz
0ff13fce6f Block user from setting safe boot setting via adb
Bug: 29900345
Change-Id: Id3b4472b59ded2c7c29762ddf008ee8486009dbb
2016-07-15 10:43:15 +01:00
Justin Klaassen
22eb19939d Refactor display color transforms
- Removed Secure.ACCESSIBILITY_DISPLAY_COLOR_MATRIX, it's not desirable
  to persist the actual color transformation matrix.
- Refactored all SurfaceFlinger transforms to DisplayTransformManager,
  which allows color transforms to be set independently from the a11y
  manager service.

Bug: 30042357
Change-Id: Iefa477dedb66aac90e1218e327802a3fab6899ed
2016-07-14 11:28:07 -07:00
Victor Chang
e293b0cd00 Disallow shell to mutate always-on vpn when DISALLOW_CONFIG_VPN user restriction is set
Fix: 29899712

Change-Id: I38cc9d0e584c3f2674c9ff1d91f77a11479d8943
(cherry picked from commit 9c7b706cf4332b4aeea39c166abca04b56685280)
2016-07-14 10:47:35 +00:00
Julia Reynolds
5bd9ea82d2 Merge "Whitelist default apps for DND access." into nyc-mr1-dev 2016-07-13 18:40:21 +00:00
Victor Chang
e05b35db0d Merge "Disallow shell to mutate always-on vpn when DISALLOW_CONFIG_VPN user restriction is set" into nyc-mr1-dev 2016-07-13 18:36:37 +00:00
Julia Reynolds
1f721e113b Whitelist default apps for DND access.
Bug: 29606962
Change-Id: I0a94004cf08a51ab17813f99aabddbceb95ac8f0
2016-07-13 12:45:05 -04:00
Victor Chang
9c7b706cf4 Disallow shell to mutate always-on vpn when DISALLOW_CONFIG_VPN user restriction is set
Fix: 29899712

Change-Id: I38cc9d0e584c3f2674c9ff1d91f77a11479d8943
2016-07-13 16:01:35 +01:00
Mahaver Chopra
3d9805d502 Added UM.DISALLOW_OEM_UNLOCK, Removed Global.OEM_UNLOCK_DISALLOWED.
Currently we used global setting to restrict user from enabling oem
unlock. As global settings can be chagned using adb, using user
restrictions instead.

Bug: 29893399
Change-Id: Ic83112a4838b8279bf50408a29ae205e0b8639ee
2016-07-12 19:29:14 +01:00
Svetoslav Ganov
8011f5ed1c Merge \"Fix a race in local settings caches\" into nyc-dev
am: f4ddb7ce30

Change-Id: If28342d6deab7d0b7e89029229bad060ce7c8a8d
2016-06-18 02:22:52 +00:00
Svetoslav Ganov
8c35dcc7ae Fix a race in local settings caches
We send a handle to the generation tracker along with the first accessed
setting but don't send the generation id of when the setting was
actually looked up. So by the time the client gets the setting with the
generation tracker from which to get and cache the last generation the
setting may have changed. We need to pass the generation id along with
the value and the generation tracker.

bug:29458487

Change-Id: I0ac4955ba5b10b547f8fe653a7c28e048a4691eb
2016-06-17 15:30:45 -07:00
Bill Yi
4535c0f80c Import translations. DO NOT MERGE
Change-Id: Id381d85225a2de4b0e0c1f2d3fba40143ed738a2
Auto-generated-cl: translation import
2016-06-03 09:43:50 -07:00
Bill Yi
686d0d7cf6 Import translations. DO NOT MERGE
Change-Id: Ie630e761cacbec55840a3de9439aa36835a34b38
Auto-generated-cl: translation import
2016-06-03 09:33:00 -07:00
Baligh Uddin
cd669b648a Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 28857042
Change-Id: I3e66f964402487321dd1923656d488b514bc68ba
2016-05-21 12:46:09 -07:00
Paul Stewart
7ca542fa99 Merge "Don\'t remove existing EAP configurations" into nyc-dev
am: c7ad1ac712

* commit 'c7ad1ac712f09c5bc116c66a54a860000b53fa38':
  Don't remove existing EAP configurations

Change-Id: I743d4b0291b7d0c864d30cb04acd7811428419d0
2016-05-20 17:45:20 +00:00
Paul Stewart
45e6fec2cf Don't remove existing EAP configurations
When merging backed-up configurations with the current supplicant
configuration, we read both configurations into a instance of
WifiNetworkSettings.  No EAP configurations should be restored as
per b/25725016, however existing EAP configurations that already
reside in wpa_supplicant.conf (presumably configured in SUW)
should not be removed in the process.

This CL adds a parameter to the "readNetworks" method to allow it
to select whether or not EAP configurations should be read in.  It
is used to allow the "restoreWifiSupplicant" method to copy in EAP
configurations from the existing wpa_supplicant.conf, but not out
of the backup data.

BUG: 28873992
Change-Id: I8b3e0c1a6629b3f1ca5055b1b2190e6b3ca4c033
2016-05-20 08:22:53 -07:00
Svetoslav Ganov
23d729deb8 Merge "Use the correct handler when persisting the settings state." into nyc-dev
am: 967fcfa593

* commit '967fcfa5939403017a6edc6d365b2996b915685d':
  Use the correct handler when persisting the settings state.

Change-Id: I53fea39e5097512f080f62f3510cc6c7acf87e3c
2016-05-16 19:49:55 +00:00
Svetoslav Ganov
9205749cfe Use the correct handler when persisting the settings state.
bug:28784358

Change-Id: Iba9d569bae67c7ba0c3ab0a486ae14efa84a7acf
2016-05-16 12:36:48 -07:00
Svetoslav Ganov
1ba77621c6 Merge "Make settings cahches generation mechanism robust." into nyc-dev
am: b35301e421

* commit 'b35301e421bb08c28425c49ad46a277c96ccb411':
  Make settings cahches generation mechanism robust.

Change-Id: Ided07e935f83e96edfec9217bfad9ae2da1fc6fb
2016-05-13 22:26:27 +00:00
Svetoslav Ganov
b35301e421 Merge "Make settings cahches generation mechanism robust." into nyc-dev 2016-05-13 22:22:32 +00:00
Svetoslav Ganov
04df738bcb Make settings cahches generation mechanism robust.
Settings is using a MemoryIntArray to communicate the settings table
version enabling apps to have up-to-date local caches. However, ashmem
allows an arbitrary process with a handle to the fd (even in read only
mode) to unpin the memory which can then be garbage collected. Here we
make this mechanism fault tolerant against bad apps unpinning the ashmem
region. First, we no longer unpin the ashmem on the client side and if
the ashmem region is purged and cannot be pinned we recreate it and
hook up again with the local app caches. The change also adds a test
that clients can only read while owner can read/write.

bug:28764789

Change-Id: I1ef79b4b21e976124b268c9126a55d614157059b
2016-05-13 15:14:14 -07:00
Steven Ng
e333b2eb81 Merge "Add a Global setting for disabling OEM unlocking setting" into nyc-mr1-dev 2016-05-13 11:27:59 +00:00
Svet Ganov
f4e2832742 Merge "Persist settings on a dedicated background thread" into nyc-dev
am: 00749aeb15

* commit '00749aeb15d52151fcc9f9051b525840c49e14ce':
  Persist settings on a dedicated background thread

Change-Id: I62d1cf9a8955ea949c420c1eb62645bff325da2a
2016-05-12 19:57:42 +00:00
Svetoslav Ganov
00749aeb15 Merge "Persist settings on a dedicated background thread" into nyc-dev 2016-05-12 19:51:58 +00:00
Phil Weaver
d56cd1fcab Merge "Fix a race in settings update." into nyc-dev
am: df15e03ed0

* commit 'df15e03ed062493b506f7599ff1e6aff26828485':
  Fix a race in settings update.

Change-Id: I970606b21b1a5cd2d19e0f21077636e68f107c6b
2016-05-12 16:53:49 +00:00
Phil Weaver
83fec00697 Fix a race in settings update.
Need to invalidate caching before notifying of changes.

Bug: 28621277
Change-Id: I2820b15d2364ecaad7666a820c0c7280ac6b7b4c
2016-05-11 10:55:29 -07:00
Svet Ganov
a8f9026d22 Persist settings on a dedicated background thread
Settings were persisted on the system background thread but during
first boot the device is under heavy load and persisting settings
competes with other system components using the shared background
thread. As a result persisting settings can be delayed much longer
than the expected 200ms. This can cause issues with setup wizard
being skipped/went over and its component disaabled being persisted
but the setting whether the device is provisioned not being
persisted - now if the device boots it will have no SUW but also
the home button would be missing. Generally, we need a tansactional
abstraction in the system process to peform all delayed operations
atomically.

bug:25472484

Change-Id: I8e0cf7ffa32e86e36e777964eb0c3cc7de02d3c3
2016-05-10 08:48:00 -07:00
Guang Zhu
e3dec83852 Merge "Revert "Persist settings on a dedicated background thread"" into nyc-dev
am: 875e99443f

* commit '875e99443f6c56d71090b8bedddd71f2b9601787':
  Revert "Persist settings on a dedicated background thread"

Change-Id: Ice3e7f7ebe50f85eb0a9f3e04662df5f68963c07
2016-05-10 07:18:29 +00:00
Guang Zhu
5537ce1f94 Revert "Persist settings on a dedicated background thread"
Bug: 25472484

This reverts commit 82b8c92b97d3c7006d7a9f67a9cdb83263d6bf2c.

Change-Id: I1a8c2e186ad74d78f1c82fe508c6f71c438177dc
2016-05-10 07:02:42 +00:00
Svet Ganov
b3f1e67921 Persist settings on a dedicated background thread
am: 82b8c92b97

* commit '82b8c92b97d3c7006d7a9f67a9cdb83263d6bf2c':
  Persist settings on a dedicated background thread

Change-Id: I1432822542bf914d106440b3f4bfa0e56b911eb2
2016-05-10 03:50:44 +00:00
Svet Ganov
82b8c92b97 Persist settings on a dedicated background thread
Settings were persisted on the system background thread but during
first boot the device is under heavy load and persisting settings
competes with other system components using the shared background
thread. As a result persisting settings can be delayed much longer
than the expected 200ms. This can cause issues with setup wizard
being skipped/went over and its component disaabled being persisted
but the setting whether the device is provisioned not being
persisted - now if the device boots it will have no SUW but also
the home button would be missing. Generally, we need a tansactional
abstraction in the system process to peform all delayed operations
atomically.

bug:25472484

Change-Id: Icf38e72403b190a8fa9d0554b8dd83ce78da3bc8
2016-05-10 03:39:55 +00:00
Steven Ng
dc20ba69bf Add a Global setting for disabling OEM unlocking setting
+ By default, OEM unlocking setting is enabled.
+ Add a check to prevent oem unlock being flipped if the setting isn't
  enabled.

Bug: 28163088
Change-Id: I087d8d5a1d99a611a8f66ff71a92ec9ea1da4e9f
2016-05-04 19:52:02 +00:00
Baligh Uddin
8a44c3c8d0 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 28463229
Change-Id: Ie10dd0e18292f94995761a098df8c42ee69a0e25
2016-05-03 16:36:29 -07:00
Svetoslav Ganov
83a1f7fe91 Add a missing null object check
We now have a null object instead of null values and
there was a place where we returned null instead of
the correct null object.

bug:28423485

Change-Id: I2626768acdf8d19fc94aa5e978eb057818450fa5
2016-04-27 14:18:05 -07:00