summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 18:20:52 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 18:20:52 +0000
commite503a12601fee9e142e37a630f3db9b758499c82 (patch)
tree7aa599b0890395b715ff2ab292dde9a2f0b10db6
parent5e3ebf12585ed50e2955d21a6276669f5e3a0e4e (diff)
downloadchromium_src-e503a12601fee9e142e37a630f3db9b758499c82.zip
chromium_src-e503a12601fee9e142e37a630f3db9b758499c82.tar.gz
chromium_src-e503a12601fee9e142e37a630f3db9b758499c82.tar.bz2
Creates the ipclist utility that chrome security team has wanted to dump
the known IPC messages. Going forward, this should help identify new messages between versions of chrome so that they may be given extra scrutiny for potential badness. under the common_message_generator.h umbrella. Review URL: http://codereview.chromium.org/6646005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78564 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/chrome.gyp22
-rw-r--r--chrome/common/render_messages.h8
-rw-r--r--chrome/common/utility_messages.h8
-rw-r--r--chrome/tools/ipclist/DEPS4
-rw-r--r--chrome/tools/ipclist/all_messages.h38
-rw-r--r--chrome/tools/ipclist/ipclist.cc120
-rw-r--r--content/common/resource_messages.h6
-rw-r--r--content/common/socket_stream_messages.h4
-rw-r--r--content/common/worker_messages.h6
-rw-r--r--ipc/ipc_message_macros.h7
-rw-r--r--ipc/ipc_message_utils.h1
-rw-r--r--ppapi/proxy/ppapi_messages.h10
12 files changed, 215 insertions, 19 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index be7def49..33e0eed 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -974,6 +974,28 @@
}],
],
},
+ {
+ 'target_name': 'ipclist',
+ 'type': 'executable',
+ 'dependencies': [
+ 'chrome',
+ 'chrome_resources',
+ 'chrome_strings',
+ 'test_support_common',
+ 'test_support_ui',
+ '../skia/skia.gyp:skia',
+ '../testing/gtest.gyp:gtest',
+ '../third_party/libxslt/libxslt.gyp:libxslt',
+ '../third_party/npapi/npapi.gyp:npapi',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'tools/ipclist/all_messages.h',
+ 'tools/ipclist/ipclist.cc',
+ ],
+ },
],
'conditions': [
['OS=="mac"',
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 1cfb404..343b29b 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -938,15 +938,15 @@ IPC_MESSAGE_CONTROL2(ViewMsg_Extension_UpdatePageActions,
std::vector<std::string> /* page_action_ids */)
// Notifies the renderer that an extension was loaded in the browser.
-IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionLoaded, ViewMsg_ExtensionLoaded_Params);
+IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionLoaded, ViewMsg_ExtensionLoaded_Params)
// Notifies the renderer that an extension was unloaded in the browser.
-IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionUnloaded, std::string);
+IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionUnloaded, std::string)
// Updates the scripting whitelist for extensions in the render process. This is
// only used for testing.
IPC_MESSAGE_CONTROL1(ViewMsg_Extension_SetScriptingWhitelist,
- Extension::ScriptingWhitelist /* extenison ids */);
+ Extension::ScriptingWhitelist /* extenison ids */)
// Changes the text direction of the currently selected input field (if any).
IPC_MESSAGE_ROUTED1(ViewMsg_SetTextDirection,
@@ -1318,7 +1318,7 @@ IPC_MESSAGE_ROUTED0(ViewHostMsg_DidDisplayInsecureContent)
// Sent when the renderer runs insecure content in a secure origin.
IPC_MESSAGE_ROUTED2(ViewHostMsg_DidRunInsecureContent,
std::string /* security_origin */,
- GURL /* target URL */);
+ GURL /* target URL */)
// Sent when the renderer starts a provisional load for a frame.
IPC_MESSAGE_ROUTED3(ViewHostMsg_DidStartProvisionalLoadForFrame,
diff --git a/chrome/common/utility_messages.h b/chrome/common/utility_messages.h
index 2f4ed95..27bd44e 100644
--- a/chrome/common/utility_messages.h
+++ b/chrome/common/utility_messages.h
@@ -26,11 +26,17 @@
#define IPC_MESSAGE_START UtilityMsgStart
+// Singly-included secton, not yet converted
+#ifndef CHROME_COMMON_UTILITY_MESSAGES_H_
+#define CHROME_COMMON_UTILITY_MESSAGES_H_
+
class FilePath;
class IndexedDBKey;
class SerializedScriptValue;
class SkBitmap;
+#endif // CHROME_COMMON_UTILITY_MESSAGES_H_
+
// Traits for UpdateManifest::Result.
IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result)
IPC_STRUCT_TRAITS_MEMBER(extension_id)
@@ -85,7 +91,7 @@ IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath,
IPC_MESSAGE_CONTROL3(UtilityMsg_InjectIDBKey,
IndexedDBKey /* key */,
SerializedScriptValue /* value */,
- string16 /* key path*/);
+ string16 /* key path*/)
// Tells the utility process that it's running in batch mode.
IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started)
diff --git a/chrome/tools/ipclist/DEPS b/chrome/tools/ipclist/DEPS
new file mode 100644
index 0000000..2d75991
--- /dev/null
+++ b/chrome/tools/ipclist/DEPS
@@ -0,0 +1,4 @@
+# Wherever a message file is found, we follow.
+include_rules = [
+ "+ppapi/proxy",
+] \ No newline at end of file
diff --git a/chrome/tools/ipclist/all_messages.h b/chrome/tools/ipclist/all_messages.h
new file mode 100644
index 0000000..79b6b98
--- /dev/null
+++ b/chrome/tools/ipclist/all_messages.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, hence no include guard.
+// Inclusion of all message files present in the system. Keep this file
+// up-to-date when adding a new value to enum IPCMessageStart in
+// ipc/ipc_message_utils.h to include the corresponding message file.
+#include "chrome/browser/importer/importer_messages.h"
+#include "chrome/common/autofill_messages.h"
+#include "chrome/common/automation_messages.h"
+#include "chrome/common/devtools_messages.h"
+#include "chrome/common/nacl_messages.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/common/safebrowsing_messages.h"
+#include "chrome/common/service_messages.h"
+#include "chrome/common/utility_messages.h"
+#include "content/common/appcache_messages.h"
+#include "content/common/child_process_messages.h"
+#include "content/common/clipboard_messages.h"
+#include "content/common/database_messages.h"
+#include "content/common/dom_storage_messages.h"
+#include "content/common/file_system_messages.h"
+#include "content/common/file_utilities_messages.h"
+#include "content/common/gpu_messages.h"
+#include "content/common/indexed_db_messages.h"
+#include "content/common/mime_registry_messages.h"
+#include "content/common/p2p_messages.h"
+#include "content/common/pepper_file_messages.h"
+#include "content/common/pepper_messages.h"
+#include "content/common/plugin_messages.h"
+#include "content/common/resource_messages.h"
+#include "content/common/socket_stream_messages.h"
+#include "content/common/speech_input_messages.h"
+#include "content/common/webblob_messages.h"
+#include "content/common/worker_messages.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
diff --git a/chrome/tools/ipclist/ipclist.cc b/chrome/tools/ipclist/ipclist.cc
new file mode 100644
index 0000000..53af9d7
--- /dev/null
+++ b/chrome/tools/ipclist/ipclist.cc
@@ -0,0 +1,120 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <algorithm>
+#include <iostream>
+#include <string>
+#include <vector>
+
+// Include once to get the type definitions
+#include "chrome/tools/ipclist/all_messages.h"
+
+struct msginfo {
+ const char* name;
+ int id;
+ int in_count;
+ int out_count;
+
+ bool operator< (const msginfo other) const {
+ return id < other.id;
+ }
+};
+
+// Redefine macros to generate table
+#include "ipc/ipc_message_null_macros.h"
+#undef IPC_MESSAGE_DECL
+#define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \
+ { #name, IPC_MESSAGE_ID(), in, out },
+
+static msginfo msgtable[] = {
+#include "chrome/tools/ipclist/all_messages.h"
+};
+#define MSGTABLE_SIZE (sizeof(msgtable)/sizeof(msgtable[0]))
+
+static bool check_msgtable() {
+ bool result = true;
+ int previous_class_id = 0;
+ int highest_class_id = 0;
+ std::vector<int> exemptions;
+
+ // Exclude test files from consideration. Do not include message
+ // files used inside the actual chrome browser in this list.
+ exemptions.push_back(TestMsgStart);
+ exemptions.push_back(FirefoxImporterUnittestMsgStart);
+
+ for (size_t i = 0; i < MSGTABLE_SIZE; ++i) {
+ int class_id = IPC_MESSAGE_ID_CLASS(msgtable[i].id);
+ if (class_id >= LastIPCMsgStart) {
+ std::cout << "Invalid LastIPCMsgStart setting\n";
+ result = false;
+ }
+ while (class_id > previous_class_id + 1) {
+ std::vector<int>::iterator iter;
+ iter = find(exemptions.begin(), exemptions.end(), previous_class_id+1);
+ if (iter == exemptions.end()) {
+ std::cout << "Missing message file: gap before " << class_id << "\n";
+ result = false;
+ break;
+ }
+ ++previous_class_id;
+ }
+ previous_class_id = class_id;
+ if (class_id > highest_class_id)
+ highest_class_id = class_id;
+ }
+
+ if (LastIPCMsgStart > highest_class_id + 1) {
+ std::cout << "Missing message file: gap before LastIPCMsgStart\n";
+ result = false;
+ }
+
+ if (!result)
+ std::cout << "Please check chrome/tools/ipclist/all_messages.h.\n";
+
+ return result;
+}
+
+static void dump_msgtable(bool show_args, bool show_ids) {
+ for (size_t i = 0; i < MSGTABLE_SIZE; ++i) {
+ if (show_ids) {
+ std::cout << "{" << IPC_MESSAGE_ID_CLASS(msgtable[i].id) << ", " <<
+ IPC_MESSAGE_ID_LINE(msgtable[i].id) << "}: ";
+ }
+ std::cout << msgtable[i].name;
+ if (show_args) {
+ std::cout << "(" << msgtable[i].in_count << " IN, " <<
+ msgtable[i].out_count << " OUT)";
+ }
+ std::cout << "\n";
+ }
+}
+
+int main(int argc, char **argv) {
+ bool show_args = false;
+ bool show_ids = false;
+ bool skip_check = false;
+
+ while (--argc > 0) {
+ ++argv;
+ if (std::string("--args") == *argv) {
+ show_args = true;
+ } else if (std::string("--ids") == *argv) {
+ show_ids = true;
+ } else if (std::string("--no-check") == *argv) {
+ skip_check = true;
+ } else {
+ std::cout << "usage: ipclist [--args] [--ids] [--no-check]\n";
+ return 1;
+ }
+ }
+
+ std::sort(msgtable, msgtable + MSGTABLE_SIZE);
+
+ if (!skip_check && check_msgtable() == false)
+ return 1;
+
+ dump_msgtable(show_args, show_ids);
+ return 0;
+}
+
diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h
index f46abe0..cb40e1f 100644
--- a/content/common/resource_messages.h
+++ b/content/common/resource_messages.h
@@ -3,17 +3,13 @@
// found in the LICENSE file.
// IPC messages for resource loading.
-// Multiply-included message file, hence no include guard.
+// Multiply-included message file, hence no include guard.
#include "base/shared_memory.h"
#include "content/common/resource_response.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/upload_data.h"
-namespace net {
-class UploadData;
-}
-
#define IPC_MESSAGE_START ResourceMsgStart
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::ResourceResponseInfo)
diff --git a/content/common/socket_stream_messages.h b/content/common/socket_stream_messages.h
index 3da8983..50d5ce8 100644
--- a/content/common/socket_stream_messages.h
+++ b/content/common/socket_stream_messages.h
@@ -3,14 +3,12 @@
// found in the LICENSE file.
// Multiply-included message file, hence no include guard.
-
#include <vector>
+#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
-class GURL;
-
#define IPC_MESSAGE_START SocketStreamMsgStart
// Web Sockets messages sent from the renderer to the browser.
diff --git a/content/common/worker_messages.h b/content/common/worker_messages.h
index 042b236..3b1e79f 100644
--- a/content/common/worker_messages.h
+++ b/content/common/worker_messages.h
@@ -17,8 +17,14 @@
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
+// Singly-included section, not converted.
+#ifndef CONTENT_COMMON_WORKER_MESSAGES_H_
+#define CONTENT_COMMON_WORKER_MESSAGES_H_
+
typedef std::pair<string16, std::vector<int> > QueuedMessage;
+#endif // CONTENT_COMMON_WORKER_MESSAGES_H_
+
#define IPC_MESSAGE_START WorkerMsgStart
// Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h
index bdc5acc..0320aaa 100644
--- a/ipc/ipc_message_macros.h
+++ b/ipc/ipc_message_macros.h
@@ -138,11 +138,16 @@
// There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent
// class (whose own traits are already defined). Note that
// IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted
-// inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END().
+// inside matching calls to IPC_STRUCT_TRAITS_BEGIN() /
+// IPC_STRUCT_TRAITS_END().
//
// Enum types are registered with a single IPC_ENUM_TRAITS() macro. There
// is no need to enumerate each value to the IPC mechanism.
//
+// Do not place semicolons following these IPC_ macro invocations. There
+// is no reason to expect that their expansion corresponds one-to-one with
+// C++ statements.
+//
// Once the types have been declared / registered, message definitions follow.
// "Sync" messages are just synchronous calls, the Send() call doesn't return
// until a reply comes back. Input parameters are first (const TYPE&), and
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 79a7bc1..16c51cb 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -77,6 +77,7 @@ enum IPCMessageStart {
ClipboardMsgStart,
BlobMsgStart,
AppCacheMsgStart,
+ LastIPCMsgStart // Must come last.
};
class DictionaryValue;
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index c7f59f3..1c89ae2 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -38,7 +38,7 @@ IPC_MESSAGE_CONTROL1(PpapiMsg_LoadPlugin, FilePath /* path */)
// PpapiHostMsg_ChannelCreated.
IPC_MESSAGE_CONTROL2(PpapiMsg_CreateChannel,
base::ProcessHandle /* host_process_handle */,
- int /* renderer_id */);
+ int /* renderer_id */)
// Each plugin may be referenced by multiple renderers. We need the instance
// IDs to be unique within a plugin, despite coming from different renderers,
@@ -345,19 +345,19 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFileRef_GetParent,
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_MakeDirectory,
pp::proxy::HostResource /* file_ref */,
PP_Bool /* make_ancestors */,
- uint32_t /* serialized_callback */);
+ uint32_t /* serialized_callback */)
IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBFileRef_Touch,
pp::proxy::HostResource /* file_ref */,
PP_Time /* last_access */,
PP_Time /* last_modified */,
- uint32_t /* serialized_callback */);
+ uint32_t /* serialized_callback */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFileRef_Delete,
pp::proxy::HostResource /* file_ref */,
- uint32_t /* serialized_callback */);
+ uint32_t /* serialized_callback */)
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBFileRef_Rename,
pp::proxy::HostResource /* file_ref */,
pp::proxy::HostResource /* new_file_ref */,
- uint32_t /* serialized_callback */);
+ uint32_t /* serialized_callback */)
// PPB_FileSystem.
IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFileSystem_Create,