Commit Graph

49 Commits

Author SHA1 Message Date
followmsi b7a57aa2c4 Android 8.1.0 Release 45 (OPM4.171019.021.Z1)
-----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCW4BXbgAKCRDorT+BmrEO
 eEY4AKCBM0DLJhFwSRwaQ/ajJmBee3jf/ACfS0OtZ9RSrqZ4Mqd0W51AQg+zoo4=
 =+spW
 -----END PGP SIGNATURE-----

Merge tag 'android-8.1.0_r45' into flo-aosp-o

Android 8.1.0 Release 45 (OPM4.171019.021.Z1)
2018-09-07 10:32:42 +02:00
Santhosh Behara 3f70e6c487 mm-video-v4l2: Protect buffer access and increase input buffer size
Protect buffer access for below scenarios:

*Increase the scope of buf_lock in free_buffer to avoid access
 of freed buffer for both input and output buffers. Also, add check
 before output buffer access.

*Disallow allocate buffer mode after client has called use buffer.

Allocate additional 512 bytes of memory for input buffers on top of
allocation size as per hardware requirement.

Bug: 64340487
Test: ran POC on bullhead/nyc-dev
Change-Id: Iabbb2d7e00ff97bfc47b04386feec66976fca99a
(cherry picked from commit 83aeab22d1)
2018-08-03 19:08:46 +00:00
Rashed Abdel-Tawab aef52899f0 media: vdec: Include nativebase headers
Change-Id: I7e6c52617f351b98d9107e54f12d360506c815c6
2017-12-08 00:37:37 +01:00
Deepak Verma 4b7b726b20 mm-video: venc: Correct a typo in variable name
A kernel variable was to be defined as unsigned long but
it is mistakenly defined as unsigned only, the space is
missing after long. This bug is silent because unsigned
is also a valid data type by itself.
Corresponding to kernel fix, similar correction is done
in userspace code.

Change-Id: Ie58f275149dc9c85553f75e02594113b1a03ddcf
CRs-fixed: 556771
2017-12-07 21:04:54 +01:00
Lajos Molnar 544fdbb7db mm-video-v4l2: venc: Advertise constrained profiles for AVC encoder
Enumerate and advertise constrained profiles for AVC encoder.
Inorder to have backward compatability advertise exisisting as well
as newly added constants.

Keep legacy constants for getters as Android media framework does not
use them.

Bug: 65043406

Change-Id: I6fe88a505005731c4891aa1a7c1f627c65f01861
2017-09-06 18:27:01 -07:00
Santhosh Behara df25be530c libc2dcolorconvert: Fix address in unmap call
Unmap was being called with a modified address resulting in unmap
failure. Call unmap with the exact address which we get from map
call.

CRs-Fixed: 2056867
Bug: 62385648

Author: abdullahanam@codeaurora.org

Change-Id: I2b7eaec8c8224188f910501b5cb86402a722dfaf
2017-08-16 12:44:15 -07:00
Santhosh Behara 03091c8af1 mm-video-v4l2: venc: Protect buffer from being freed while accessing am: 0008e21211 am: c0f642a22f am: 979b0e6864
am: 81323f63e3

Change-Id: I93a2d095b546151434a0c2ae8a5c919e2c6cd727
2017-07-27 00:16:05 +00:00
Santhosh Behara 81323f63e3 mm-video-v4l2: venc: Protect buffer from being freed while accessing am: 0008e21211 am: c0f642a22f
am: 979b0e6864

Change-Id: I2faf25ea66357a2444cf2f26b195e811c1d28c03
2017-07-26 23:48:19 +00:00
Santhosh Behara 0008e21211 mm-video-v4l2: venc: Protect buffer from being freed while accessing
Output buffer(in use-buffer mode) has an internal backup ion buffer.
The contents of this buffer are deep-copied in client's buffer in
the context of VideoEncCallBackThread; while this buffer can be
freed in the client thread's context.
Check the allocation bitmask before attempting to copy and
synchronize these operations by holding a lock

Fixes bug 36130225
 Security Vulnerability - Heap use after free in libOmxVenc

CRs-Fixed: 2053101

Bug: 36130225
Change-Id: If5e89703b2dec0aee8acb7e897e9df94227af3f3
Author: Praveen Chavan<pchavan@codeaurora.org>
2017-07-25 15:06:04 -07:00
Mathias Agopian 240fc6e79b fix circular dependency libnativewindow <-> libui
Bug: 37647680, 37648355
Test: compile, manual
Change-Id: I7214dcc1e57f2a0466fc28173dd5de5d54c9a721
2017-05-03 19:03:10 -07:00
Vijay Venkatraman f1b7ba9e3d Merge "Revert "Replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK"" am: a19e87fe30 am: 6d355e61ff am: 1673ee7a26
am: 07e30ae927

Change-Id: I94ac13b79554f607d10c5e35171b7cb8839f8677
2017-02-07 18:54:14 +00:00
Vijay Venkatraman 1673ee7a26 Merge "Revert "Replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK"" am: a19e87fe30
am: 6d355e61ff

Change-Id: Ieff87139db8c4bef748b7caee406b94278e47d07
2017-02-07 18:49:13 +00:00
Vijay Venkatraman 4fac31938c Revert "Replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK"
This reverts commit 7bbd6afa54.

Change-Id: I5b2aad573ea6e8048e6e1f25bc0026d23ede9f2a
2017-02-07 18:40:54 +00:00
TreeHugger Robot a92b822f3c Merge "mm-video-v4l2: vidc: Handle native_handle meta mode" 2017-02-07 09:53:26 +00:00
Vijay Venkatraman 1940e0bbe8 Merge "Replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK" am: 1079b0b1d3
am: 05d18dc7ca

Change-Id: I8ad930da96f5faf307192335721cd47654c0f5c3
2017-02-03 23:46:08 +00:00
Emilian Peev 82b39a890d mm-video-v4l2: vidc: Handle native_handle meta mode
- Meta mode for sending native handles from camera
   should be supported along with rest of the modes.

BUG: 34516149
Test: Camera CTS API1 and API2 using legacy Hal1 module
Change-Id: Ia9dc5936b0b5a2792b1286b979030f0f5b6104a1
2017-01-31 15:52:16 +00:00
Vijay Venkatraman 7bbd6afa54 Replacing LOCAL_COPY_HEADERS with LOCAL_EXPORT_C_INCLUDE_DIRS, for VNDK
Moved msm8974/mm-core header files from inc/ to inc/mm-core/omxcore for exporting.
Moved msm8974/mm-video-v4l2/DivxDrmDecrypt headers to subfolder for exporting.
Moved msm8974/libstagefrighthw headers to include/ folder for exporting

In msm8974/mm-core, inc/ has newer OMX_* headers than inc/mm-core/omxcore and
frameworks/native/include/media/openmax. Updating these headers will be
handled in a separate CL.

Test: Add lib to LOCAL_EXPORT_SHARED_LIBRARIES
Change-Id: I4cdfe3085a459abdbd3de491eed10cdceadc4a85
2017-01-18 19:39:36 -08:00
Praveen Chavan 7c03ed4f9e mm-video-v4l2: vdec: Disallow input usebuffer for secure case
am: 7b99376ecf

Change-Id: I8104f710d235307138c01dda4c19ad006aa5788b
2016-10-18 23:07:55 +00:00
Marco Nelissen f2a3cbea4b Merge "mm-video-v4l2: vdec: Disallow input usebuffer for secure case" into nyc-mr1-dev 2016-10-18 22:57:54 +00:00
Praveen Chavan 7b99376ecf mm-video-v4l2: vdec: Disallow input usebuffer for secure case
In secure mode, input buffer _must_ be allocated by the component to
allocate a secure buffer.
Client-supplied memory via usebuffer does not qualify as secure-memory
and must be rejected. This also avoids accidental heap-overflow while
copying bitstream from user-memory to a smaller-sized secure-payload
(usually the buffer-header itself)

Bug : 30148882
Fixes : Heap Overflow/LPE in MediaServer (libOmxVdec problem #11)

CRs-Fixed: 1071731
Change-Id: Ibbde2d6a9c1f30e8482a533cadb13e44d8dcb2c0
2016-10-18 13:56:59 -07:00
Praveen Chavan 9ff997e158 mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port am: b7b6466da4
am: 3a1263e033

Change-Id: I4c45d329bf3c803f59fae3fc2578188b018db1ca
2016-10-14 16:40:39 +00:00
Praveen Chavan 526394de98 mm-video-v4l2: vdec: Disallow changing buffer modes/counts on allocated ports am: ee06e61ff4
am: 8784ace2ba

Change-Id: I3a83d20fd685178d0105c30edf16e243d66affec
2016-10-14 16:40:22 +00:00
Praveen Chavan f0496bf92c mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port am: b7b6466da4
am: faed315fc0

Change-Id: I658e13ca2ceba5ec23528b9e3b98ce125ec4c479
2016-10-14 16:40:10 +00:00
Praveen Chavan 87b47f05ef mm-video-v4l2: vdec: Disallow changing buffer modes/counts on allocated ports am: ee06e61ff4
am: 64dca37cc4

Change-Id: I3417b9f125c1434d2c7226dde8d07b60688fec49
2016-10-14 16:39:52 +00:00
Praveen Chavan 3a1263e033 mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port
am: b7b6466da4

Change-Id: Idd7669adc3d4ac1b137d89c88aad893436bef19e
2016-10-14 16:36:37 +00:00
Praveen Chavan faed315fc0 mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port
am: b7b6466da4

Change-Id: I26644f9ed6e9adece930b4ed7554b9ea7cc306c6
2016-10-14 16:36:36 +00:00
Praveen Chavan 8784ace2ba mm-video-v4l2: vdec: Disallow changing buffer modes/counts on allocated ports
am: ee06e61ff4

Change-Id: I226d535a430d2790338224598beba99a3936f4a2
2016-10-14 16:36:22 +00:00
Praveen Chavan b7b6466da4 mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port
Count and size negotiation of port-buffers should only be allowed when
the port hasn't been allocated yet.
Letting the client change count/size on a pre-allocated port will
cause inconsistencies in the count/size of memory allocated for
headers and internal lists.
Fix resetting of buffer-base (m_inp_mem_ptr) when all buffers are
freed, for all the buffer-modes.

Bug: 29421682
Fixes: Local Privilege Escalation in MediaServer (libOmxVenc problem #10)

Change-Id: I9abead969bc3c908e6db9beb6316fd572dac25f7
2016-10-12 20:50:53 +00:00
Praveen Chavan ee06e61ff4 mm-video-v4l2: vdec: Disallow changing buffer modes/counts on allocated ports
Changing Count, size, usage-mode (metadata/bytebuffer/native-handle) or
allocation-mode (allocateBuffer/UseBuffer) of buffers should only be
allowed when the port hasn't been allocated yet.
Since buffer-modes determine the payload-size in case of meta-buffer-mode,
and also determine the memory-base to derive buffer indices from buffer-
headers, letting the client change count/size/mode on a pre-allocated port
will cause inconsistencies in the size of memory allocated for headers and
lead to index overflows.

Fix the range checks for the derived buffer-indices to avoid out-of-bounds
writes.

Also, ensure buffer-mode settings (metadata-mode, native-handle-mode)
are intended for the right ports.

Bug: 29617572 : Heap Overflow/LPE in MediaServer (libOmxVdec problem #8)
Bug: 29982686 :  Memory Write/LPE in MediaServer (libOmxVdec problem #10)

Change-Id: I619636a48779580c247bffb3752c3e4025b46542
2016-09-23 16:10:44 -07:00
Praveen Chavan 03783f8200 mm-video-v4l2: venc: add support for encoding with temporal layers
Implement OMX_IndexParamAndroidVideoTemporalLayers to expose
configuration of temporal-layered encoding to client.
Layer-wise bitrate support and changing layer-count dynamically
is not supported.

Bug: 27596987
Change-Id: Ib32e7aea22e2cbaf78a903561b67de7d14ed57e5
2016-08-25 11:01:00 -07:00
Praveen Chavan 0442f2ca1a mm-video-v4l2: venc: Configure intra preriod for HEVC
HEVC's main config param now supports key-frame-interval.
Use this information to configure the intra-period. i.e
configure number of P-Frames (assuming no B-frames)

Bug: 29494247

CRs-Fixed: 1023504
Change-Id: I3d2f0df3a5ab3b7d659ae58ae6f4df5898006934
2016-07-13 16:53:11 -07:00
TreeHugger Robot f89f2c65e1 Merge "mm-video-v4l2: venc: add checks before accessing heap pointers" into nyc-dev 2016-06-22 18:33:10 +00:00
Praveen Chavan d99a08f996 mm-video-v4l2: venc: add checks before accessing heap pointers
Heap pointers do not point to user virtual addresses in case
of secure session.
Set them to NULL and add checks to avoid accesing them

Bug: 28815329
Bug: 28920116

Change-Id: I94fd5808e753b58654d65e175d3857ef46ffba26
2016-06-22 08:06:07 +09:00
Wonsik Kim 3957953f02 Fix wrong nAllocLen
Set nAllocLen to the size of the opaque handle itself.

Bug: 28816964
Bug: 28816827
Change-Id: Id410e324bee291d4a0018dddb97eda9bbcded099
2016-06-02 19:00:09 +09:00
Praveen Chavan 14a9920aa2 mm-video-v4l2: venc: Avoid processing ETBs/FTBs in invalid states
(per the spec) ETB/FTB should not be handled in states other than
Executing, Paused and Idle. This avoids accessing invalid buffers.
Also add a lock to protect the private-buffers from being deleted
while accessing from another thread.

Bug: 27903498
Security Vulnerability - Heap Use-After-Free and Possible LPE in
MediaServer (libOmxVenc problem #3)

Change-Id: I898b42034c0add621d4f9d8e02ca0ed4403d4fd3
2016-05-05 08:28:46 -07:00
Praveen Chavan 97e3ddfad6 mm-video-v4l2: vdec: Avoid processing ETBs/FTBs in invalid states
(per the spec) ETB/FTB should not be handled in states other than
Executing, Paused and Idle. This avoids accessing invalid buffers.
Also add a lock to protect the private-buffers from being deleted
while accessing from another thread.

Bug: 27890802
Security Vulnerability - Heap Use-After-Free and Possible LPE in
MediaServer (libOmxVdec problem #6)

Change-Id: Iaac2e383cd53cf9cf8042c9ed93ddc76dba3907e
2016-05-05 08:28:13 -07:00
TreeHugger Robot 0db330f0ed Merge "mm-video-v4l2: vidc: fix matching of extension strings" into nyc-dev 2016-04-30 02:45:24 +00:00
Hangyu Kuang 1c3edf4ea2 Merge "mm-video-v4l2: vidc: Add support for OMX_IndexConfigAndroidIntraRefresh" into nyc-dev 2016-04-08 20:12:08 +00:00
Arun Menon f1b15e15b6 mm-video-v4l2: vidc: Add support for OMX_IndexConfigAndroidIntraRefresh
OMX Component will support OMX_IndexConfigAndroidIntraRefresh only
in loaded state.

Bug: 27108817
Change-Id: I213fed57842b94c333843871d6c555e1fb8784e5
2016-04-08 10:24:57 -07:00
Praveen Chavan c9770704a9 mm-video-v4l2: vidc: fix matching of extension strings
Using strncmp with the strlen of source string can result in
false positives when it is a substring of the passed string.
Eg: strncmp("OMX.extn.x", "OMX.extn.xyz", strlen(OMX.extn.x))
    will result in a match.
Use strcmp instead.

Bug: 27344524

Change-Id: I68839f2bea8b97a31f43885538e9dce51aa8c1b4
2016-04-07 20:30:26 -07:00
Ajay Dudani f45517f0fc Merge "media: Enable support for msm8952 target" into nyc-dev 2016-04-07 05:52:48 +00:00
Ajay Dudani 7c1a4b1738 media: Enable support for msm8952 target
Change-Id: I8aae920d59fdd36e39ca2163a8bb11aa0f8c6947
2016-04-06 15:31:30 -07:00
Praveen Chavan ff8f9f29b4 mm-video-v4l2: vdec: deprecate unused config OMX_IndexVendorVideoExtraData
This config (used to set header offline) is no longer used.
Remove handling this config since it uses non-process-safe ways to
pass memory pointers.

Fixes: Security Vulnerability - Segfault in MediaServer (libOmxVdec problem #2)
Bug: 27475409

Change-Id: I7a535a3da485cbe83cf4605a05f9faf70dcca42f
2016-04-05 09:55:34 -07:00
Praveen Chavan fd65fa8911 mm-video-v4l2: vdec: add safety checks for freeing buffers
Allow only up to 64 buffers on input/output port (since the
allocation bitmap is only 64-wide).
Do not allow changing the actual buffer count while still
holding allocation (Client can technically negotiate buffer
count on a free/disabled port)
Add safety checks to free only as many buffers were allocated.

Fixes: Security Vulnerability - Heap Overflow and Possible
Local Privilege Escalation in MediaServer (libOmxVdec problem #3)
Bug: 27532282 27661749

Change-Id: I06dd680d43feaef3efdc87311e8a6703e234b523
2016-04-05 09:10:44 -07:00
Praveen Chavan 417bd6d3d2 mm-video-v4l2: venc: add safety checks for freeing buffers
Allow only up to 64 buffers on input/output port (since the
allocation bitmap is only 64-wide).
Add safety checks to free only as many buffers were allocated.

Fixes: Heap Overflow and Possible Local Privilege Escalation in
MediaServer (libOmxVenc problem)
Bug: 27532497

Change-Id: I31e576ef9dc542df73aa6b0ea113d72724b50fc6
2016-04-05 08:25:28 -07:00
Steve Pfetsch af0b35a2e7 Merge "mm-video-v4l2: vdec: Add range check before native_buffer usage" into nyc-dev 2016-04-05 00:13:47 +00:00
Praveen Chavan 00c00c349f mm-video-v4l2: vdec: Add range check before native_buffer usage
Restore missing buffer-index calculation, without which,
native-handles were not being saved properly and NULL handles
got sent out to gralloc::setMetadata

A bad buffer index can cause the OMX component to make an out of
bound read/write access on the native_buffer array and cause a
crash. Add range check to fix the issue.

Bug: 25976027

Change-Id: I684a501a1a71898b5c1c80566125459a5972c959
2016-04-05 00:12:45 +00:00
Praveen Chavan 16ee85d1d4 mm-video-v4l2: vidc: validate omx param/config data
Check the sanity of config/param strcuture objects
passed to get/set _ config()/parameter() methods.

Bug: 27533317
Security Vulnerability in MediaServer
omx_vdec::get_config() Can lead to arbitrary write

Change-Id: I6c3243afe12055ab94f1a1ecf758c10e88231809
2016-04-01 13:25:07 -07:00
Patrick Tjin e4010605f2 Initial import of msm8996 media HAL
1) Move existing HAL to msm8974/
2) Import msm8996 HAL from LA.HB.1.1.2_rb1.12
3) Modify Makefiles to remove kernel dependencies and
   fix for new directory structure
4) Modify top level makefile for new directory structure

Top commits from LA.HB.1.1.2_rb1.12 included in this commit:
  db7937a mm-video: vidc: memset struct v4l2_format prior to S_FMT
  d77ab10 Merge "mm-video-v4l2: vidc: Do not queue output buffer if flush is in progress"
  8895985 mm-video-v4l2: vidc: vdec: Add property to disable UBWC for OPB
  675af75 Merge "mm-video: vidc: Communicate the right colorformat to the driver"
  dd79df2 Merge "mm-video: vidc: Reliably stop the message thread"
  c3e8618 Merge "mm-video-v4l2: vidc: venc: Fix B-Frame handling"
  755ec08 mm-video-v4l2: vidc: Do not queue output buffer if flush is in progress
  3ac8410 mm-video: vidc: Reliably stop the message thread
  b73dcba Merge "mm-video-v4l2: vidc: venc: Bug fixes for VZIP"
  8358109 Merge "mm-video-v4l2: vdec: fix picture type decode mode return status"

BUG=27420204

Signed-off-by: Patrick Tjin <pattjin@google.com>

Change-Id: I71aa0190e48b332268334677894b0ad7c606296b
2016-03-07 09:14:01 -08:00