Commit Graph

497 Commits

Author SHA1 Message Date
Chris Forbes a3a09ef6b4 ui: Fix bad size check in Fence::unflatten
Differs slightly from mnc+ patch: GetFlattenedSize was fixed in mnc.

Test: Boot device, run poc from bug, observe no longer crashes
Bug: 37285689
AOSP-Change-Id: Id8b851733b088cce0d07493fbf76e7e24f9299ad
(cherry picked from commit 9809602ac32dcb7bceaa5bc34df5b7fb68aacd38)

CVE-2017-0666

Change-Id: I778c82b363ca0409d534f255cc5d17b39e751986
2017-07-06 21:37:51 +02:00
Jessica Wagantall 1c6eb19ad5 Android 6.0.1 release 66
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlfO7kcACgkQ6K0/gZqxDniKDACfe+IKxeKXazFQSWgFI0CW9HUK
 nuQAoIomQRV9NOdD2SVHJR1zyTKXx82E
 =FStj
 -----END PGP SIGNATURE-----

Merge tag 'android-6.0.1_r66' into HEAD

Android 6.0.1 release 66

# gpg: Signature made Tue 06 Sep 2016 09:26:47 AM PDT using DSA key ID 9AB10E78
# gpg: Can't check signature: public key not found
2016-09-07 12:40:28 -07:00
Pablo Ceballos 1ecb999624 Region: Detect malicious overflow in unflatten
Bug 29983260

Change-Id: Ib6e1cb8ae279010c5e9960aaa03513f55b7d873b
2016-07-21 17:34:57 -07:00
Caio Schnepper 8c39282e31 libgui: Don't assign handle to NULL after free is common
Reportedly Mali and PowerVR GPUs are crashing when setting handle to NULL
So we will set a flag for the devices that might need this aswell

Set BOARD_EGL_NEEDS_HANDLE_VALUE=true in BoardConfig.mk to use

Change-Id: I6c967f62dc6adced7583d7b2045d11cf5b25fc80
2015-11-25 17:51:30 -02:00
Caio Schnepper eed845539a libgui: Don't assign handle to NULL after free
This reverts c784dfc39f for exynos4 devices
with Mali 400 GPUs, which causes a fatal signal (SIGSEGV) and death of
the graphics subsystem

Change-Id: I6dbf8f8664fca01baf63fece7c64016609fe3e1c
2015-11-23 18:39:58 -02:00
Praveen Chavan c784dfc39f libgui: assign handle to NULL after free
to avoid use-after-free situations

Change-Id: If9c09f509bc55795856302e5ca34470df019c622
2015-10-31 03:19:42 -07:00
Ricardo Cerqueira e3fc10fbb7 exynos4: getphys implementation on buffermanager for samsung omx
Change-Id: I73d9633e1a7b3316ede28dd1369f8f069609cbb0
2015-10-15 11:35:09 -07:00
Dan Stoza 812ed0644f libgui: Add generation numbers to BufferQueue
This change allows producers to set a generation number on a
BufferQueue. This number will be embedded in any new GraphicBuffers
created in that BufferQueue, and attempts to attach buffers which have
a different generation number will fail.

It also plumbs the setGenerationNumber method through Surface, with the
additional effect that any buffers attached to the Surface after
setting a new generation number will automatically be updated with the
new number (as opposed to failing, as would happen on through IGBP).

Bug: 20923096
Change-Id: I32bf726b035f99c3e5834beaf76afb9f01adcbc2
2015-06-03 11:09:33 -07:00
Dan Stoza b8efdc4003 libui: Apply GRALLOC_USAGE_ALLOC_MASK during alloc
Applies GRALLOC_USAGE_ALLOC_MASK to the incoming usage bits before
calling alloc on the gralloc module. This filters out the new flag
GRALLOC_USAGE_FOREIGN_BUFFERS, which is used to send a hint to the
producer, but which does not affect the allocation of buffers.

Bug: 19801661
Change-Id: Ia37a3eddba2e97598e50ac3e10877430adfa9247
2015-05-29 19:52:43 +00:00
Taiju Tsuiki 4d0cd3f524 Close Fence FDs in error cases of Surface and GraphicBufferMapper
Surface::{cancel,queue}Buffer and GraphicBufferMapper::lockAsyncYCbCr take the
ownership of |fenceFd|s. Though they don't close it on error cases.

Change-Id: I49a7ce8837d5c510c4ac4ad4649f310d18610e80
(cherry picked from commit c7263fb432)
2015-04-30 14:50:17 -07:00
Taiju Tsuiki 84f1d9c288 Avoid closing invalid FD in Surface and GraphicBufferMapper
GraphicBufferMapper::lockAsync{,YCbCr} close the fence FD even when the FD
is invalid.

Change-Id: Ia2b4dae3b2c06426e34f623f19ba92435f486ab7
(cherry picked from commit dcfe91e1f3)
2015-04-30 09:58:31 -07:00
Dan Stoza 958f501189 Merge "libgui: Allow an IGBProducer to disable allocation" 2015-04-24 15:50:10 +00:00
Dan Stoza 9de7293b0a libgui: Allow an IGBProducer to disable allocation
Adds a new method IGBP::allowAllocation, which controls whether
dequeueBuffer is permitted to allocate a new buffer. If allocation is
disallowed, dequeueBuffer will block or return an error as it
normally would (as controlled by *ControlledByApp).

If there are free buffers, but they are not of the correct dimensions,
format, or usage, they may be freed if a more suitable buffer is not
found first.

Bug: 19801715
Change-Id: I0d604958b78b2fd775c2547690301423f9a52165
2015-04-23 15:28:12 -07:00
Dan Stoza eea6d682b8 libui/libgui: Fix errors in parceling
BufferItem and GraphicBuffer were not parceling correctly, which had
not been noticed because the libgui tests (specifically, one that
tests placing a BufferQueue in a separate process from the IGBP/C)
had not been run recently. This change fixes the errors found in
those classes.

Change-Id: Ie224361a534a79115a3481d83ff97f21d154d4f5
2015-04-20 13:17:22 -07:00
Dan Stoza 5065a55291 libgui: Pass surface damage through BufferQueue
This change adds support for passing surface damage all of the way
down from the EGL interface through the consumer side of the
BufferQueue. Depends on system/core change
Ie645e6a52b37b5c1b3be19481e8348570d1aa62c

Bug: 11239309
Change-Id: I4457ea826e9ade4ec187f973851d855b7b93a31b
2015-04-15 13:19:38 -07:00
Dan Stoza 4d769d8bdc Merge "libui: Clean up Fence and Region flattening" 2015-04-15 20:13:53 +00:00
Dan Stoza 6fbefbbd8e libui: Clean up Fence and Region flattening
Fence was flattening incorrectly, causing issues with any fields
flattened after it, and Region was relying on being the last object
flattened. This change addresses both.

Change-Id: If49de061de6e2f11f4d846b4d8c18627dfb7e109
2015-04-15 13:04:15 -07:00
ywen aef0445c6f Fix a memory corruption issue when vector resize
There is memory corruption in below code

const Rect* prev = &dst[prevIndex];
dst.add(Rect(prev->right, top, right, bottom));

prev points to a memory of vector dst, when dst resize in add()
call, the memory that prev points to will be copy to the new
allocated vector memory and the old memory will become undefined

Avoid pointer in this case, use a local copy instead

Change-Id: I4d95ceedd00c8fb615ac153082ade1b1ce0d0fa8
2015-04-10 11:59:52 +05:30
Eino-Ville Talvala 82c6bcc970 DO NOT MERGE Add dataSpace to buffer queues; remove old format enums.
- Wire up new dataSpace parameter through buffer queue stack
- Update tests to include the parameter
- Switch eglApi to using dataSpace to indicate sRGB gamma/linear
  difference
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums
- Add default dataspace to buffer queue core
- Add query for default dataspace

Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df

Change-Id: I461952389c18051176c6b75e664f20ad369f5760
2015-03-19 13:56:00 -07:00
Michael Lentine c168b8a5a9 Update maxNumber to be smaller.
There shouldn't be more than 4096 fds (probably signficantly smaller) and
there shouldn't be more than 4096 ints.

Cherry pick of I3a3e50ee3078a4710e9737114e65afc923ed0573

Bug: 18076253
Change-Id: I82a883572b401f115d252dcd3d00aa7252b49b0e
2015-03-18 16:00:05 -07:00
Lajos Molnar 180c2ba763 resolved conflicts for merge of 1f9f71e1 to lmp-mr1-dev-plus-aosp
Change-Id: I627e58fe738e9a3b9831508853f26f9adc350f90
2015-01-28 21:27:46 -08:00
Lajos Molnar 1f9f71e183 GraphicBufferMapper: handle devices that do not implement lock_ycbcr
Bug: 19179927
Change-Id: I09ffca954fed3cd2d3466c8396627dc7dbc0052d
2015-01-28 16:26:36 -08:00
Bernhard Rosenkraenzer fe4966d59b Restore Region::set(uint32_t, uint32_t)
The Region::set(uint32_t,uint32_t) ABI is used by the Nexus 10 graphics
driver blobs.
After commit dd883c0b08, Nexus 10 blobs
need a rebuild unless the old ABI is added back

Change-Id: I138dcc1cc281b8d3cde0021282bf874054ec4eaf
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
2014-12-22 21:15:08 +01:00
Andreas Gampe ff78750c64 Libui: Remove unused variables
For build-system CFLAGS clean-up, remove unused variables.

Bug: 18632512
Change-Id: Ib78912ae442ddc6410960ab1efb4fb2faa1a9208
2014-12-05 20:52:16 -08:00
Dan Stoza 133caacf87 Fix -Werror on 64-bit builds
Add another static_cast to avoid an error on 64-bit builds

Change-Id: I62fb2c67766c4aab70d9d1834f255d06ff82dd8d
(cherry picked from commit 116c7a113c)
2014-12-04 18:06:48 -08:00
Dan Stoza 42af278173 Disable struct padding warning/error
Adds -Wno-padded, which was triggering on 64-bit devices

Change-Id: If27bac27881f2081a222b32213901f5087554b07
(cherry picked from commit 4e84bd310c)
2014-12-04 18:06:48 -08:00
Dan Stoza d318240042 libui: Enable -Weverything and -Werror
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.

Change-Id: I470a267e9b1c373f2d5c960f005c3b0e02b2db63
(cherry picked from commit 303b9a5123)
2014-12-04 17:56:27 -08:00
Dan Stoza 01049c8321 Enable clang for libui/libgui/surfaceflinger
Enables clang and C++11 for libui/libgui/surfaceflinger, and
eliminates all compile-time warnings.

Change-Id: Ie237fdb5ae44f2bfcddaa884f9c65ec3f08ae50f
(cherry picked from commit f10c46ef85)
2014-12-04 17:56:17 -08:00
Michael Lentine 3880326857 Fix for corruption when numFds or numInts is too large.
Bug: 18076253
Change-Id: I4c5935440013fc755e1d123049290383f4659fb6
(cherry picked from commit dfd06b89a4)
2014-12-04 17:49:31 -08:00
Michael Lentine dfd06b89a4 Fix for corruption when numFds or numInts is too large.
Bug: 18076253
Change-Id: I4c5935440013fc755e1d123049290383f4659fb6
2014-11-03 14:08:54 -08:00
Dan Albert 55833709ab am c52e54c4: Merge "Some more test cleanup."
* commit 'c52e54c47184704613d446eb15d051ceb43d82b3':
  Some more test cleanup.
2014-10-17 17:53:05 +00:00
Dan Albert ed7d193ae9 Some more test cleanup.
Needed to build successfully when libc++ is the default STL.

Also fix a missing include. Not sure how this was getting by before.
Probably some transitive include.

Change-Id: Ie96b79e96b4e154d786fbf2d5ae5cf5892608837
2014-10-16 20:46:05 -07:00
Colin Cross 18fae75350 crash if getNativeBuffer() called on NULL GraphicBuffer
If getNativeBuffer() is called on a NULL GraphicBuffer the
static_cast of this from GraphicBuffer* to ANativeWindowBuffer*
will return a small pointer like (ANativeWindowBuffer*)0x10.
This value can propagate past NULL checks until it causes a crash
far away from the original NULL pointer.  Crash immediately
instead.

Change-Id: Id614b9eb1484108b3c3c733545309844c4b87532
2014-07-22 17:47:03 -07:00
Greg Hackmann f974bffb36 am 38c9e132: am c1ffd351: am bd20e551: Merge "Use asynchronous lock/unlock API"
* commit '38c9e1327a5b24267c3dab5293bc9d7ada6e9fc9':
  Use asynchronous lock/unlock API
2014-05-12 18:18:47 +00:00
Francis Hart 8f3960179c Use asynchronous lock/unlock API
The gralloc API now provides a way for using lock/unlock with the Android
explicit synchronisation concept. This changes updates the GraphicBuffer class
to also expose this functionality, and updates the Surface class to make use of
in line with the dequeueBuffer/queueBuffer mechanism.

This new behaviour is dependent on GRALLOC_MODULE_API_VERSION_0_3. If the local
gralloc module does not support this then the existing synchronous lock/unlock
mechanism will be used.

Change-Id: I8c3fd9592e0c5400ac9be84450f55a77cc0bbdc5
2014-05-12 09:13:03 -07:00
Greg Hackmann 2f3dca149a am 9493d492: am 9eb142e3: am a9d49f99: Merge "Revert "Use asynchronous lock/unlock API""
* commit '9493d4924a59f14b698389386337a9c07a7ea3c4':
  Revert "Use asynchronous lock/unlock API"
2014-05-09 22:00:04 +00:00
Greg Hackmann 02528cf6aa am 4b46776f: am 8a6cd189: am f60564a1: Merge "Use asynchronous lock/unlock API"
* commit '4b46776ff88c5a365700b88e8b2b04e1b2c77e6e':
  Use asynchronous lock/unlock API
2014-05-09 21:54:48 +00:00
Greg Hackmann a9d49f99e6 Merge "Revert "Use asynchronous lock/unlock API"" 2014-05-09 21:39:07 +00:00
Greg Hackmann 53ec72523a Revert "Use asynchronous lock/unlock API"
This reverts commit 378ef07760.

Change-Id: I1de5ab973b5383633e75924fe90ac3ca8216c36a
2014-05-09 21:36:48 +00:00
Greg Hackmann f60564a13e Merge "Use asynchronous lock/unlock API" 2014-05-09 21:02:21 +00:00
Francis Hart 378ef07760 Use asynchronous lock/unlock API
The gralloc API now provides a way for using lock/unlock with the Android
explicit synchronisation concept. This changes updates the GraphicBuffer class
to also expose this functionality, and updates the Surface class to make use of
in line with the dequeueBuffer/queueBuffer mechanism.

This new behaviour is dependent on GRALLOC_MODULE_API_VERSION_0_3. If the local
gralloc module does not support this then the existing synchronous lock/unlock
mechanism will be used.

Change-Id: I77daa1beb197b63b1c2f281b8414ac4ae4b5b03c
2014-05-02 13:28:14 -07:00
Jun Jiang e2d1157381 fix GraphicBuffer::flatten crash issue when handle is null
Change-Id: I0d3727e4366cac355791e52cb7790bf8f3c51527
Signed-off-by: Jun Jiang <jun.a.jiang@intel.com>
2014-04-29 14:15:36 +08:00
Colin Cross c3911c6fa6 am b8ceeb8f: am 85085cd6: Merge "libui: fix passing Fence object over binder"
* commit 'b8ceeb8f6cc3eea53d4b471747c401b9ae54d931':
  libui: fix passing Fence object over binder
2014-04-15 20:52:27 +00:00
Colin Cross 288f2ef629 libui: fix passing Fence object over binder
The Fence object was writing a size_t into the binder buffer
in flatten, which changes size if the producer and consumer
are running in a 32-bit and a 64-bit process.  Use a uint32_t
instead.

Change-Id: Ifed526513800ce27f9d605101cddd922292cca37
2014-04-14 19:06:47 -07:00
Dan Stoza 21f18e6935 Merge "Add unique ID to GraphicBuffer" 2014-04-11 18:56:04 +00:00
Svetoslav d85084b2b6 Adding render stats APIs to UiAutomation (framework native).
bug:12927198

Change-Id: Ibb1c07f7d89e11281e5c1f27f412a29ac6f9c4ab
2014-04-10 12:32:19 -07:00
Dan Stoza b1363d37fc Add unique ID to GraphicBuffer
Adds a globally-unique ID (PID + sequence number) to every
GraphicBuffer, which will remain the same while crossing Binder,
even if the underlying handles change.

Change-Id: Ib11330a4c5e99621b82204e0adb31b9a88658426
2014-03-31 14:10:07 -07:00
Andy McFadden bc96e4714f Added null check
Don't dereference "handle" if it's NULL.

Bug 13348578

Change-Id: Ifa6758616c41cf84467af6db29c779d26901a01c
2014-03-17 16:48:23 -07:00
Mark Salyzyn 993146092f am d4dabf87: am cdbf28b3: Merge "native frameworks: 64-bit compile issues"
* commit 'd4dabf872ac0a12e12aebae9032f7d62762c2aeb':
  native frameworks: 64-bit compile issues
2014-03-13 23:12:09 +00:00
Mark Salyzyn 92dc3fc52c native frameworks: 64-bit compile issues
- Fix format (print/scanf)
- Suppress unused argument warning messages (bonus)

Change-Id: I05c7724d2aba6da1e82a86000e11f3a8fef4e728
2014-03-12 13:12:44 -07:00