Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Issue 2571543002: Fix use after free for cached_displays_. (Closed)

Created:
4 years ago by kylechar
Modified:
4 years ago
Reviewers:
rjkroege, dnicoara, oshima
CC:
chromium-reviews, kalyank, oshima+watch_chromium.org, ozone-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix use after free for cached_displays_. There is a gap between when DisplaySnapshots get freed and when DisplayConfigurator gets an updated list of DisplaySnapshots. DisplayChangeObserver would try to use the pointers to freed memory if the touch input-devices changed which might crash chrome. Erase all entries in DisplayConfigurator::cached_displays_ before the memory is freed. It looks like DisplayConfigurator::cached_displays_ is only used as part of either display configuration or for associating touchscreens. There shouldn't be any other display configuration happening between when cached_displays_ is freed and when new display snapshots are added in DisplayConfigurator::OnConfigured(). Add a check in DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() if there are no display snapshots then don't do anything to avoid passing an empty list of ManagedDisplayInfos to DisplayManager. BUG=669226 Committed: https://crrev.com/3f0ff6fe910fd0a4bbf487a9e411148fee83521d Cr-Commit-Position: refs/heads/master@{#438518}

Patch Set 1 #

Patch Set 2 : Add invalidate to tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -6 lines) Patch
M ui/display/manager/chromeos/display_change_observer.cc View 1 chunk +10 lines, -1 line 0 comments Download
M ui/display/manager/chromeos/display_configurator.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/display/manager/chromeos/display_configurator.cc View 1 2 chunks +8 lines, -3 lines 0 comments Download
M ui/display/manager/chromeos/test/test_native_display_delegate.h View 1 3 chunks +4 lines, -0 lines 0 comments Download
M ui/display/manager/chromeos/test/test_native_display_delegate.cc View 1 3 chunks +11 lines, -2 lines 0 comments Download
M ui/display/types/native_display_observer.h View 1 chunk +4 lines, -0 lines 0 comments Download
M ui/ozone/demo/ozone_demo.cc View 2 chunks +3 lines, -0 lines 0 comments Download
M ui/ozone/platform/drm/host/drm_display_host_manager.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M ui/ozone/platform/drm/host/drm_native_display_delegate.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/ozone/platform/drm/host/drm_native_display_delegate.cc View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (11 generated)
kylechar
4 years ago (2016-12-12 18:17:53 UTC) #2
rjkroege
Seems like a good solution given the constraints. lgtm
4 years ago (2016-12-12 18:43:59 UTC) #3
oshima
change lg. would you mind adding a test? Can you also double check if the ...
4 years ago (2016-12-13 17:43:28 UTC) #4
kylechar
On 2016/12/13 17:43:28, oshima wrote: > change lg. > > would you mind adding a ...
4 years ago (2016-12-13 21:51:49 UTC) #5
oshima
lgtm On 2016/12/13 21:51:49, kylechar wrote: > On 2016/12/13 17:43:28, oshima wrote: > > change ...
4 years ago (2016-12-13 22:42:42 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2571543002/40001
4 years ago (2016-12-14 15:12:27 UTC) #14
commit-bot: I haz the power
Committed patchset #2 (id:40001)
4 years ago (2016-12-14 15:16:55 UTC) #17
commit-bot: I haz the power
4 years ago (2016-12-14 15:18:32 UTC) #19
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/3f0ff6fe910fd0a4bbf487a9e411148fee83521d
Cr-Commit-Position: refs/heads/master@{#438518}

Powered by Google App Engine
This is Rietveld 408576698