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

Unified Diff: sandbox/mac/launchd_interception_server.cc

Issue 284153005: Bootstrap Sandbox: Ensure swap_integer messages are read-only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling Created 6 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
« no previous file with comments | « no previous file | sandbox/mac/os_compatibility.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/mac/launchd_interception_server.cc
diff --git a/sandbox/mac/launchd_interception_server.cc b/sandbox/mac/launchd_interception_server.cc
index 73e0d6720b862cdfffb0cd8028dc410e81fd5977..6c20181124eb9aa99aef06b243a3e696fb348d4e 100644
--- a/sandbox/mac/launchd_interception_server.cc
+++ b/sandbox/mac/launchd_interception_server.cc
@@ -231,10 +231,16 @@ void LaunchdInterceptionServer::HandleLookUp(mach_msg_header_t* request,
void LaunchdInterceptionServer::HandleSwapInteger(mach_msg_header_t* request,
mach_msg_header_t* reply,
pid_t sender_pid) {
- // TODO(rsesek): Crack the message and ensure that the swap is only being
- // used to get the value of a VPROC key, and do not allow setting it.
- VLOG(2) << "Forwarding vproc swap message #" << request->msgh_id;
- ForwardMessage(request, reply);
+ // Only allow getting information out of launchd. Do not allow setting
+ // values. Two commonly observed values that are retrieved are
+ // VPROC_GSK_MGR_PID and VPROC_GSK_TRANSACTIONS_ENABLED.
+ if (compat_shim_.swap_integer_is_get_only(request)) {
+ VLOG(2) << "Forwarding vproc swap_integer message.";
+ ForwardMessage(request, reply);
+ } else {
+ VLOG(2) << "Rejecting non-read-only swap_integer message.";
+ RejectMessage(request, reply, BOOTSTRAP_NOT_PRIVILEGED);
+ }
}
void LaunchdInterceptionServer::SendReply(mach_msg_header_t* reply) {
« no previous file with comments | « no previous file | sandbox/mac/os_compatibility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698