forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
tsepez@chromium.org
committed
Mar 17, 2011
1 parent
5e3ebf1
commit e503a12
Showing
12 changed files
with
215 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Wherever a message file is found, we follow. | ||
include_rules = [ | ||
"+ppapi/proxy", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters