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

Issue 418033005: Mojo: Change how we handle invalid pointer arguments (at the system layer). (Closed)

Created:
6 years, 5 months ago by viettrungluu
Modified:
6 years, 5 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org
Project:
chromium
Visibility:
Public.

Description

Mojo: Change how we handle invalid pointer arguments (at the system layer). This changes the semantics of the public system API: instead of (attempting) to returning "invalid argument" (e.g., when you pass a null pointer for a required argument), we'll crash/trap/kill you. The reason for this is that it's not really sensible to check pointers up front in the face of threads doing different things (e.g., memory that is valid to read to/write from at the beginning of a call may not be valid later). As such, we wrap "user" pointers in a (new) |UserPointer<>| class, and provide ways of accessing the memory that they refer to. We should never pass around user pointers as plain pointers. (This careful treatment will probably already be needed to properly support NaCl, for example.) Still to do (but this change is already too big): * Update comments (in mojo/public/c/system). * Properly convert the remaining user pointers being passed around as plain pointers. This includes: * Getting rid of |GetPointerUnsafe()| and also the existing |VerifyUserPointer...()| functions. * Changing how we handle the various options structs. * Changing some of the |Dispatcher| interface. * Write tests for |UserPointer<>|, etc. R=darin@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285350

Patch Set 1 #

Total comments: 6

Patch Set 2 : review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+790 lines, -320 lines) Patch
M mojo/system/core.h View 2 chunks +33 lines, -29 lines 0 comments Download
M mojo/system/core.cc View 13 chunks +113 lines, -110 lines 0 comments Download
M mojo/system/core_test_base.cc View 2 chunks +10 lines, -2 lines 0 comments Download
M mojo/system/core_unittest.cc View 37 chunks +272 lines, -151 lines 0 comments Download
M mojo/system/entrypoints.cc View 6 chunks +54 lines, -23 lines 0 comments Download
M mojo/system/mapping_table.h View 1 chunk +1 line, -1 line 0 comments Download
M mojo/system/mapping_table.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M mojo/system/memory.h View 1 4 chunks +270 lines, -0 lines 0 comments Download
M mojo/system/memory.cc View 4 chunks +35 lines, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
viettrungluu
6 years, 5 months ago (2014-07-24 16:45:39 UTC) #1
darin (slow to review)
LGTM https://codereview.chromium.org/418033005/diff/1/mojo/system/memory.h File mojo/system/memory.h (right): https://codereview.chromium.org/418033005/diff/1/mojo/system/memory.h#newcode22 mojo/system/memory.h:22: // Removes |const| from |T| (available as |remove_const<T>::type|): ...
6 years, 5 months ago (2014-07-24 16:55:38 UTC) #2
viettrungluu
Thanks. https://codereview.chromium.org/418033005/diff/1/mojo/system/memory.h File mojo/system/memory.h (right): https://codereview.chromium.org/418033005/diff/1/mojo/system/memory.h#newcode22 mojo/system/memory.h:22: // Removes |const| from |T| (available as |remove_const<T>::type|): ...
6 years, 5 months ago (2014-07-24 17:09:05 UTC) #3
viettrungluu
6 years, 5 months ago (2014-07-24 19:51:51 UTC) #4
Message was sent while issue was closed.
Committed patchset #2 manually as r285350 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698