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

Unified Diff: mojo/edk/system/handle_table.cc

Issue 2012613002: Enforce/require MOJO_HANDLE_RIGHT_TRANSFER in sending handles via MojoWriteMessage(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/handle_table.cc
diff --git a/mojo/edk/system/handle_table.cc b/mojo/edk/system/handle_table.cc
index e123ae9bb83a7adf3154799f5bf2d284f22097cd..985e4edf53b5b070d362419a7d5333fc3b63667b 100644
--- a/mojo/edk/system/handle_table.cc
+++ b/mojo/edk/system/handle_table.cc
@@ -143,6 +143,11 @@ MojoResult HandleTable::MarkBusyAndStartTransport(
error_result = MOJO_RESULT_BUSY;
break;
}
+ // Note: "Busy" is "preferred" over "permission denied".
+ if (!entries[i]->handle.has_all_rights(MOJO_HANDLE_RIGHT_TRANSFER)) {
+ error_result = MOJO_RESULT_PERMISSION_DENIED;
+ break;
+ }
// Note: By marking the handle as busy here, we're also preventing the
// same handle from being sent multiple times in the same message.
entries[i]->busy = true;

Powered by Google App Engine
This is Rietveld 408576698