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

Unified Diff: base/trace_event/memory_infra_background_whitelist.h

Issue 2006943003: [tracing] Sanitize process memory dumps for background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Fixes. 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: base/trace_event/memory_infra_background_whitelist.h
diff --git a/base/trace_event/memory_infra_background_whitelist.h b/base/trace_event/memory_infra_background_whitelist.h
new file mode 100644
index 0000000000000000000000000000000000000000..1949a6b6d9602a507947990855984056849c22cb
--- /dev/null
+++ b/base/trace_event/memory_infra_background_whitelist.h
@@ -0,0 +1,45 @@
+// Copyright 2016 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.
+
+#ifndef BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_
+#define BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_
+
+// This file contains the whitelists for background mode to limit the tracing
+// overhead and remove sensitive information from traces.
+
+#include <string>
+
+namespace base {
+namespace trace_event {
+
+// The names of dump providers whitelisted for background tracing. Dump
+// providers can be added here only if the background mode dump has very
+// less performance and memory overhead.
+const char* const kDumpProviderWhitelist[] = {
Primiano Tucci (use gerrit) 2016/06/02 20:24:04 These should be moved to an anonymous namespace in
ssid 2016/06/03 01:59:46 Sorry, fixed.
+ // TODO(ssid): Fill this list with dump provider names which support
+ // background mode, crbug.com/613198.
+ nullptr // End of list marker.
+};
+
+// A list of string names that are allowed for the memory allocator dumps in
+// background mode.
+const char* const kAllocatorDumpNameWhitelist[] = {
Primiano Tucci (use gerrit) 2016/06/02 20:24:04 ditto for this.
ssid 2016/06/03 01:59:46 Done.
+ // TODO(ssid): Fill this list with dump names, crbug.com/613198.
+ nullptr // End of list marker.
+};
+
+// Checks if the given |mdp_name| is in the whitelist.
+bool IsMemoryDumpProviderWhitelisted(const char* mdp_name);
+
+// Checks if the given |mad_name| matches any of the whitelisted patterns.
+bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& mad_name);
+
+// The whitelist is replaced with the given list for tests:
+void SetDumpProviderWhitelistForTesting(const char* const* list);
+void SetAllocatorDumpNameWhitelistForTesting(const char* const* list);
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_

Powered by Google App Engine
This is Rietveld 408576698