diff options
author | 2024-10-31 17:44:48 +0000 | |
---|---|---|
committer | 2025-01-28 00:46:55 -0800 | |
commit | b3ca9f3c87bc935ae56e7647c91e2158971fb47d (patch) | |
tree | 6675a899ee6dbfe899c3c360867245ac2c996b6f /runtime/hidden_api.h | |
parent | 162e2634caca054659a829df1040ee052b900c34 (diff) |
Log info about the caller and callee in hiddenapi denial messages.
If enforcement is enabled then log as error instead of warning.
Also add "hiddenapi:" prefix to all log messages to make it easier to
search for them.
Test: Boot and check errors in logcat
Test: 674-hiddenapi 690-hiddenapi-same-name-methods 691-hiddenapi-proxy
817-hiddenapi 822-hiddenapi-future 999-redefine-hiddenapi
2038-hiddenapi-jvmti-ext 2270-mh-internal-hiddenapi-use
on host and target
Bug: 377676642
Change-Id: Ib4f790d7ab4850d398639c64f55be0d14c5c0408
Diffstat (limited to 'runtime/hidden_api.h')
-rw-r--r-- | runtime/hidden_api.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/runtime/hidden_api.h b/runtime/hidden_api.h index 33ede321fa..f503767ed5 100644 --- a/runtime/hidden_api.h +++ b/runtime/hidden_api.h @@ -204,7 +204,13 @@ class MemberSignature { bool DoesPrefixMatchAny(const std::vector<std::string>& exemptions); - void WarnAboutAccess(AccessMethod access_method, ApiList list, bool access_denied); + void WarnAboutAccess(AccessMethod access_method, + ApiList list, + bool access_denied, + uint32_t runtime_flags, + const AccessContext& caller_context, + const AccessContext& callee_context, + EnforcementPolicy policy) REQUIRES_SHARED(Locks::mutator_lock_); void LogAccessToEventLog(uint32_t sampled_value, AccessMethod access_method, bool access_denied); @@ -222,16 +228,21 @@ uint32_t GetDexFlags(T* member) REQUIRES_SHARED(Locks::mutator_lock_); // Handler of detected core platform API violations. Returns true if access to // `member` should be denied. -template<typename T> +template <typename T> bool HandleCorePlatformApiViolation(T* member, + uint32_t runtime_flags, const AccessContext& caller_context, + const AccessContext& callee_context, AccessMethod access_method, - EnforcementPolicy policy) - REQUIRES_SHARED(Locks::mutator_lock_); - -template<typename T> -bool ShouldDenyAccessToMemberImpl(T* member, ApiList api_list, AccessMethod access_method) - REQUIRES_SHARED(Locks::mutator_lock_); + EnforcementPolicy policy) REQUIRES_SHARED(Locks::mutator_lock_); + +template <typename T> +bool ShouldDenyAccessToMemberImpl(T* member, + ApiList api_list, + uint32_t runtime_flags, + const AccessContext& caller_context, + const AccessContext& callee_context, + AccessMethod access_method) REQUIRES_SHARED(Locks::mutator_lock_); inline ArtField* GetInterfaceMemberIfProxy(ArtField* field) { return field; } |