Bug: b/123559319, b/112824791, b/120287622 (partially)
Test: Android unit/integration tests, Linux unit tests,
GTS tests on Taimen, GTS tests on Crosshatch
Merge of http://go/wvgerrit/72483
This is a revert of http://go/ag/6216663. This addresses the
failures that led to the seg faults in the 64 bit Level 3 library. Cache
flushing must be done to the entire mmap'd page regardless of whether or
not we use the entire page. Since we now have to cache flush the entire
page, this gives us a performance hit due to us using the max page size.
To get around this, we reuse mmap'd pages only for the 95th percentile
page size or lower.
Change-Id: I14bc0d7e21faae6b6816ea589ba25f9661dcec93
(This is a merge of http://go/wvgerrit/72764)
Netflix has identified a calling pattern that causes this mutex to be
taken recursively. This is not guaranteed to be safe for Widevine's
old custom Lock implementation nor std::mutex. However, it is guaranteed
to be safe for std::recursive_mutex. This patch updates the mutex in use
accordingly.
In the long-term, this lock needs to be reconsidered, as already noted
by comments in the code. It would be great if the reconsidered locking
did not require a recursive-safe lock. The TODO for this has been spun
off into its own bug and the comment has been updated to point to this.
Bug: 120471929
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I34df64456de4b469b75caf25a33f0bc53a5da330
[ Merge of http://go/wvgerrit/73044 ]
The tests currently get copied to /data/bin. Changes in location
of system libraries causes test failures when tests are unable to
find dependent dynamic libraries.
Bug: 123879070
Test: WV unit/integration tests
Change-Id: I86edbe33b4753238fcf8b84243ac6e6c058ea145
[ Merge of http://go/wvgerrit/72703 ]
SRM is an optional feature and whether it is implemented is upto the
discretion of OEMs. If it is not, avoid logging this information.
Bug: 124391178
Test: WV unit/integration tests
Change-Id: If8d2b1e0b59fb11825f832a5d4259b03c482fd6b
Merge from Widevine repo of http://go/wvgerrit/73024
This updates the build_and_run_all_unit_tests.sh to only build a
predefined list of tests. This prevents the accidental inclusion of
android.hardware.drm@1.2-service-lazy.widevine.rc.
Bug: b/123885511
Test: Unit tests build and extra library does not.
Change-Id: I4368817103720976de2b21de2591a0712944c8d0
(This is a merge of http://go/wvgerrit/72723)
ValueMetric, unlike the other metrics, was not safe to call from
multiple threads. This patch adds internal locking to ValueMetric to
ensure its safety.
Bug: 124459322
Bug: 70889998
Bug: 118584039
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I55855ba8a5cdb2bbe1e15be7742304293245b5aa
(This is a merge of http://go/wvgerrit/71325)
Widevine CE CDM and the buildbot now have parallel operations unit
tests. These tests are not relevant on Android since it is not possible
to call into the Android CDM from multiple threads. However, there is
one change in CdmEngine that needs to be copied over to Android for
consistency's sake.
Bug: 70889998
Bug: 118584039
Test: Android Build
Change-Id: Iea5df62be256383e832b4fcfbd5ff5090e3f3b03
(This is a merge of http://go/wvgerrit/71324)
This patch increases the granularity of the locking in CryptoSession
without substantially changing its locking semantics. Where before
there was a single |crypto_lock_| performing multiple duties, now
there are three locks:
1) |static_field_lock_|, which is used when needing to access the
non-atomic static member fields of CryptoSession.
2) |oem_crypto_lock_|, which is used when needing to call into
OEMCrypto.
3) |factory_lock_|, used only by the functions that interact with the
CryptoSession factory.
All the code in CryptoSession has been updated to use these locks. It
has also been updated to only hold them for the minimal amount of time
necessary, as opposed to holding them for a whole function. This should
help some with the ability of CryptoSession calls to happen
concurrently. To assist in taking locks in a consistent manner, two
helper functions, |WithStaticFieldLock()| and |WithOecLock()| have been
added. Also, for the very common case of reading |initialized_|, the
accessor |IsInitialized()| will read the value safely.
While changing all the code to lock differently, I found that some
places in CryptoSession were *not* locking before accessing static state
or calling into OEMCrypto. I have made these callsites consistent with
the rest of CryptoSession.
As a result of taking locks for only the minimum time necessary, it is
no longer necessary for functions to make assumptions about whether the
lock will already be held before they are called. Locks should not be
held while calling helper functions, and code should always take a lock
for the brief time it is necessary to do so.
In tests, including the concurrent unit tests coming in the following
patch, this code did not perform substantially better or worse than the
code that preceded it, but the hope is that it will experience less
contention on devices that are more resource-constrained than my
desktop, such as older game consoles.
This patch appears to address some real threading issues. Hopefully, it
will also make it easier to maintain soundness in the future and to
reason about when code in CryptoSession needs to take a lock.
This is the first step to implementing the "Finer-Grained Locking in
CryptoSession" specification. A future patch will make some of these
locks reader-writer locks, to allow even greater parallelism.
Bug: 70889998
Bug: 118584039
Bug: 123319961
Test: CE CDM Unit Tests
Test: Android Unit Tests
Test: GTS
Test: Play Movies
Test: Netflix
Change-Id: I346c04a5d9875723db54af33ee91772bf49ca12f
Merge from Widevine repo of http://go/wvgerrit/72392
This adds the ability of the reference code to set the maximum output
buffer size error discussed in the Recoverable Errors section of
http://go/wvdelta15
Bug: http://b/120572363 Add Recoverable Errors (mod mock)
Change-Id: I688caca22929e29b3548c3f7d1df5de5bd37bfa1
Merge from Widevine repo of http://go/wvgerrit/72388
The unreleased oemcrypto test code has been modifed to keep a
singleton for the life of the process. In order to do that, several
functions in the reference code have been made virtual, and some
initialization and termination has been moved from the constructor and
destructor to Initialize and Terminate.
Bug: http://b/120572363 Add Recoverable Errors (mod mock)
Test: unit tests
Change-Id: I300559195567a537c0700167514be0ea42363695
Merge from Widevine repo of http://go/wvgerrit/72386
This CL changes reference and testbed OEMCyrpto only.
Updates the logging of the key control block for testing by adding new
bits to log and cleaning up the format.
Also, update access to entitlement keys so that they can also have
their key control block logged in tests.
Test: reference and test code only.
Bug: http://b/113594182 Full Decrypt Path Testing - Top Level
Bug: http://b/68648263 Log Key Control Block
Change-Id: I259d6f29eceb9f097640aa50f43443e308797f69
[ Merge from http://go/wvgerrit/71923 ]
Plumb through the device files error detail and add the detail to
metrics.
Bug: http://b/115382201
Test: Unit tests, manual GPlay.
Change-Id: I18139f6712b6670be5fed863a97f9f03440745c7
[ Merge from http://go/wvgerrit/71726 ]
Adds an error detail metric attribute to RestoreUsageSession and
RestoreOfflineSession. These metrics will now report an additional
attribute providing additional error detail for debugging.
BUG: http://b/115517916
Test: CDM Unit Tests. Manually tried GPlay.
Change-Id: Ib48361ef29d33a16150473d8967e4850bc0c623d
Bug: b/78359032
Merge of http://go/wvgerrit/70544
Test: Android unit + integration tests/manual checking of system time to
make sure it's restored correctly
Integration tests are added to make sure that clock rollback of the
device system time does not affect key duration for both streaming and
offline licenses. These tests require root access as they modify system
time and restore them.
Change-Id: I3e1802205e2fc2056093c1e39b0ff6e0a8816abc
[ Merge from http://go/wvgerrit/71443 ]
The assumption that the metrics will always outlive the CdmSession
instance appears not to always hold (at least in a non-android
multi-threaded solution). The shared_ptr ensures that the metrics
are available even in these rare race conditions.
BUG: http://b/123321465
Test: CDM unit tests. Also http://go/wvgerrit/71264 parallel tests.
Change-Id: Iaa6a8f6c0fdc46a911789759d6e1228d849aa237
[ Merge of http://go/wvgerrit/71907 ]
The client token needed to be enabled in the license request.
Bug: 123369846
Bug: 123370099
Test: WV unit/integration tests
Change-Id: I4d3e944b1d79010977c119291594878c406b00c5
[ Merge from http://go/wvgerrit/69105 ]
This adds a metric collecting decorator class around cdm engine. This
implementation uses a templated decorator. The decorator enables:
1) Wrapping the CDM Engine methods to capture timing and error
information.
2) Allows use of a mock CDM Engine for testing.
Test: Unit tests. GPlay manual testing and GTS tests.
BUG: http://b/64724336
Change-Id: I5e4a0f552974fab1939bc7ab02719a1f5849cf3f
[ Merge of http://go/wvgerrit/71326 ]
Nonce flood, frame size, session and system invalidation errors
will now bubble up to the app. OEMCrypto v15 returns
OEMCrypto_ERROR_BUFFER_TOO_LARGE, OEMCrypto_ERROR_SESSION_LOST_STATE,
OEMCrypto_ERROR_SYSTEM_INVALIDATED and a variety of nonce errors.
These will be reported to HIDL as OUTPUT_TOO_LARGE_ERROR,
ERROR_DRM_SESSION_LOST_STATE, ERROR_DRM_INVALID_STATE and
ERROR_DRM_RESOURCE_CONTENTION.
Bug: 120572706
Test: Unit/Integration tests
Change-Id: Ida177300046327ce81592a273028ef6c3a0d9fd9
This reverts commit ee45468c22.
Reason for revert: Segfaults occurring with 64-bit devices (B1 and C1) with the latest changes. The error condition points to SEGV_MAPERR, which combined with the build diff, leads me to believe this change caused the issue. b/123559319
Change-Id: I5255e14f74e2be229ffd8cd0765ca61a2a074139
This reverts commit 408509efdc.
Reason for revert: just kidding. We want to run the tests on
old devices, too.
Change-Id: I920fa825380638122f638e057bcfbe98b5f7b301
Support overloaded isCryptoSchemeSupported method that
accepts a security level parameter
bug:110701831
test: cts media test cases, widevine integration tests, gts media tests
Change-Id: Ia84e40ff8d4f13fc06478e338e3238061e283dac
(This is a merge of http://go/wvgerrit/70666)
We need a reader-writer lock implementation in order to make use of the
new threading guarantees in OEMCrypto v15. However, we do not have
access to an STL reader-writer lock due to only being on C++11. This
patch adds a home-grown reader-writer lock, as well as tests to verify
that its behavior is sound.
Bug: 70889998
Bug: 118584039
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Iaddcefb50e72452fbd27d04879eacf775484e675
Merged from http://go/wvgerrit/69723.
The new APIs are getOfflineLicenseIds, getOfflineLicenseState and
removeOfflineLicense. These methods are currently stubbed out in
Widevine hidl service. This CL completes the implementation.
Test: unit tests - libwvdrmdrmplugin_hidl_test
Test: GTS
--test com.google.android.media.gts.MediaDrmTest#testWidevineApi29
bug: 117570686
Change-Id: I96ffb75f453e36e931effefd3664b5faa8d69d30