[LE.UM.2.3.2.r1.4] [SECURITY] perf: core: Avoid race condition when releasing perf-events#2000
Merged
jerpelea merged 1 commit intosonyxperiadev:aosp/LE.UM.2.3.2.r1.4from Jun 13, 2019
Conversation
The function, perf_event_release_kernel(), that's used to free the perf events is dependent on the CPU associated to this event be online. The function checks at the beginning: if the CPU is offline, put it in a zombie list and return immediately. Else, proceed and make a cross-cpu call (from perf_remove_from_context()) to complete the functionality. However, there's a potential chance of a race if the CPU went offline between the initial check and the cross-cpu call. The cross-cpu call deletes the event from the context's list, but if the CPU is offline, this deletion doesn't happen. Later the event is freed irrespective of this failure and the event still exists in the list. Now, when the list is traversed, it would try to access the memory which is freed, resulting in a memory abort. As a result, before calling perf_event_release_kernel(), capture the perf's pmus_mutex lock to prevent the CPU from going offline during the operation. Change-Id: I20241639ea9a8dc87e5a88cf81e940b3d6cb773c Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org> Signed-off-by: Swetha Chikkaboraiah <schikk@codeaurora.org>
Author
|
Compiles for kagura |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the only part of the 2019-06-05 kernel security patches that we need to apply.
https://source.android.com/security/bulletin/2019-06-01.html#kernel-components