diff options
| author | 2023-01-23 20:48:16 +0000 | |
|---|---|---|
| committer | 2023-01-23 20:48:16 +0000 | |
| commit | 52a0d7cbb6c2e818fb7931398fd4bf959d0edba8 (patch) | |
| tree | 02b98978a9d2c69cae655c51925b7587cc2851f4 /libs/gui | |
| parent | 9750ee219cb607646a612f7a9337b4bb42c558d1 (diff) | |
| parent | 5d1b23522b6a164c43375bd11e3369b4c1f49ac5 (diff) | |
Merge "Mitigate the security vulnerability by sanitizing the transaction flags." into tm-dev
Diffstat (limited to 'libs/gui')
| -rw-r--r-- | libs/gui/LayerState.cpp | 21 | ||||
| -rw-r--r-- | libs/gui/include/gui/LayerState.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 502031c8d8..74e6ae6a9b 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -353,6 +353,27 @@ void DisplayState::merge(const DisplayState& other) { } } +void DisplayState::sanitize(int32_t permissions) { + if (what & DisplayState::eLayerStackChanged) { + if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { + what &= ~DisplayState::eLayerStackChanged; + ALOGE("Stripped attempt to set eLayerStackChanged in sanitize"); + } + } + if (what & DisplayState::eDisplayProjectionChanged) { + if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { + what &= ~DisplayState::eDisplayProjectionChanged; + ALOGE("Stripped attempt to set eDisplayProjectionChanged in sanitize"); + } + } + if (what & DisplayState::eSurfaceChanged) { + if (!(permissions & layer_state_t::Permission::ACCESS_SURFACE_FLINGER)) { + what &= ~DisplayState::eSurfaceChanged; + ALOGE("Stripped attempt to set eSurfaceChanged in sanitize"); + } + } +} + void layer_state_t::sanitize(int32_t permissions) { // TODO: b/109894387 // diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index 0a9b75a7f1..0071d48227 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -320,6 +320,7 @@ struct DisplayState { DisplayState(); void merge(const DisplayState& other); + void sanitize(int32_t permissions); uint32_t what = 0; uint32_t flags = 0; |