From 02ec742536ec943b64458e564a756066c559af7e Mon Sep 17 00:00:00 2001 From: "M. Sirringhaus" Date: Mon, 12 Apr 2021 20:58:08 +0000 Subject: [PATCH] Bug 1676109 - Remove font and cache mappings from the Linux minidumps r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D99338 --- .cargo/config.in | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- .../.cargo-checksum.json | 2 +- .../minidump_writer_linux/src/maps_reader.rs | 14 ------ .../src/sections/mappings.rs | 49 +++++++++---------- 6 files changed, 28 insertions(+), 43 deletions(-) diff --git a/.cargo/config.in b/.cargo/config.in index 848367baa322..87a40560de9b 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -15,7 +15,7 @@ rev = "4af6c367603869a30fddb5ffb0aba2b9477ba92e" [source."https://github.com/msirringhaus/minidump_writer_linux.git"] git = "https://github.com/msirringhaus/minidump_writer_linux.git" replace-with = "vendored-sources" -rev = "01c7a0da8d34059f7dae8ab9e7512529ff16347a" +rev = "667c38bf1d9a8ea0c2c0a219d13006a39847b3f2" [source."https://github.com/mozilla/neqo"] git = "https://github.com/mozilla/neqo" diff --git a/Cargo.lock b/Cargo.lock index f212ee48cd12..6be0a7949f0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3087,7 +3087,7 @@ dependencies = [ [[package]] name = "minidump_writer_linux" version = "0.1.0" -source = "git+https://github.com/msirringhaus/minidump_writer_linux.git?rev=01c7a0da8d34059f7dae8ab9e7512529ff16347a#01c7a0da8d34059f7dae8ab9e7512529ff16347a" +source = "git+https://github.com/msirringhaus/minidump_writer_linux.git?rev=667c38bf1d9a8ea0c2c0a219d13006a39847b3f2#667c38bf1d9a8ea0c2c0a219d13006a39847b3f2" dependencies = [ "byteorder", "goblin", diff --git a/Cargo.toml b/Cargo.toml index 69ab011e3c50..0b94156baa59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,7 +85,7 @@ spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu5" } # failure's backtrace feature might break our builds, see bug 1608157. failure = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" } failure_derive = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" } -minidump_writer_linux = { git = "https://github.com/msirringhaus/minidump_writer_linux.git", rev = "01c7a0da8d34059f7dae8ab9e7512529ff16347a" } +minidump_writer_linux = { git = "https://github.com/msirringhaus/minidump_writer_linux.git", rev = "667c38bf1d9a8ea0c2c0a219d13006a39847b3f2" } xmldecl = { git = "https://github.com/hsivonen/xmldecl", rev="a74f7df5bf6cb11194fb74daa0c3cf42f326fd90" } [patch.crates-io.cranelift-codegen] diff --git a/third_party/rust/minidump_writer_linux/.cargo-checksum.json b/third_party/rust/minidump_writer_linux/.cargo-checksum.json index f0f8d6b50bef..515063509adb 100644 --- a/third_party/rust/minidump_writer_linux/.cargo-checksum.json +++ b/third_party/rust/minidump_writer_linux/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"61afd471ff97dc0bdae414fc55bdde602e25158b6d2813ea74d24fc0ce690ffb","LICENSE":"1ecdd8e8977af83c07c5f97bec87b47d27059b7ea323ca3160fbfa2314f5d99c","src/android.rs":"98ba5923bee1a08ea9e07f85fce47f8e09ddbd9b3619fc981e4bbf425db0f94b","src/app_memory.rs":"909676c916c0ffaa3a813632c162f5b1207f8502408b6b3bab48a5f842948c71","src/auxv_reader.rs":"29a03c082c179733ddefee59e903dc5a43b7e681f55a1fdd9cfdec7587bd7b35","src/bin/test.rs":"b4b119a25ab1fcd71958061c23f741e956b81db28c4d7f8c5728b62eff0913e0","src/cpu_set.rs":"8b60d5a9a37c49b105075b856d05a5d8c201554923bc40a52407e034fd21681d","src/crash_context/crash_context_aarch64.rs":"ce477360b5d16f11814b195fb12c461183bd06fd08cdd14e76c9c2bdcbaccd47","src/crash_context/crash_context_arm.rs":"6e2f1db21b93fadfa034a5246c70687d6654a40627f1ecf849511cf480a96bad","src/crash_context/crash_context_mips.rs":"430669c21f03cefd479e46265dc3c4d3495acaf8b01da09dc0b0e4168306b508","src/crash_context/crash_context_x86.rs":"136a1b0f8107986505df95a1a5423f352ae3ea383e25335e60c6242acdff34da","src/crash_context/crash_context_x86_64.rs":"8fb5f86944ec5a02bc6a7dba4ef698d088686de2cf5fb0a6014592ae394c2e47","src/crash_context/mod.rs":"0e09ca5489194586580a8da6eca274fe6db8af213b804f1e407612c03c02475c","src/dso_debug.rs":"16f1701f204f9cd418382a556de4205e73ea6505a5705babf2dceb6a31732cf9","src/dumper_cpu_info/cpu_info_arm.rs":"5a53da0411922cfea71330ff5d48ddb4bff581665abfb56cfaf05d3f7177e858","src/dumper_cpu_info/cpu_info_x86_mips.rs":"331f10edc5385282f3615bfa93049fe8a97bc81ebea761100fc56752ed2ad6b8","src/dumper_cpu_info/mod.rs":"5322108f35021cf03d61ccb4c54a2b4875dfdff774a4297148925d76525d125c","src/errors.rs":"95eed17b22b3b86ed13bb9be23e77e38319beaa9ce6138f47d906e3b8fb9599b","src/lib.rs":"65617923decad2a5aaf86a1f055b5fceb09390154a8f96c4cc6efab1b5cc24dc","src/linux_ptrace_dumper.rs":"1f3becdde18f03d8707b32328d81e6d217219c5a7388a8b9f8a5abe941b4f5ed","src/maps_reader.rs":"585fe31815421c7ca798a8277b6dc3a79254e7ef0aa1817a1b0c2bbd5e3dd623","src/minidump_cpu/minidump_cpu_aarch64.rs":"18524f8a3a3d3eda7d0fafb1c168ff06dee1886da0f4278f3c2a54147ef79bc9","src/minidump_cpu/minidump_cpu_amd64.rs":"c4b3cef86ea53864c026d7c598d8a7f59ca6b1ad7e881f94ce34f39dd6b72e33","src/minidump_cpu/minidump_cpu_arm.rs":"bfbcbf280da47d715189f76c8d9749cb2808d7730bb1fe906a21b42a16c3b044","src/minidump_cpu/minidump_cpu_mips.rs":"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b","src/minidump_cpu/minidump_cpu_ppc.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_ppc64.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_sparc.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_x86.rs":"3dcb2aa4264d76f0727b9750ffce0032738bea97be95fde92089a9d11926c63c","src/minidump_cpu/mod.rs":"50e8df5e294e9d162c97dacb9448bba0ffc1e4bf992f8a2b9cc718f12b92a370","src/minidump_format.rs":"56f737bd95fbbd5b4b3d7773dc491e267887d78b12916645bccbcef16acf2cfc","src/minidump_writer.rs":"abc05364f455b0b119e07cba74b2aeb84c04bd9eec19178290eb2906a2769d87","src/sections/app_memory.rs":"6fb616e0aa495fd5d9a487231750ac3c2ffa275802adf0f7e60c7666f5e14a60","src/sections/exception_stream.rs":"5c49b80b5acf3694c0c2e275b083ae8f544ed7ba7b8d417303706bfaadf3419e","src/sections/mappings.rs":"f2b5fadb25848cf7d5dd46fae2ef52bfad380cd64738381f33e7c0884a565e81","src/sections/memory_list_stream.rs":"02e678bd28de10e854d673ccefeb574067e64bdaefda5212a8161ea194280a7d","src/sections/mod.rs":"616c70e74d01b1116df0c9c1883f2c80aa74ab3056aeea4ed4e3f8b7c8866582","src/sections/systeminfo_stream.rs":"d481a86c6aa86a32378bb3d60b6f7f09fd57155dfa728d0dfa50aa17ef72c836","src/sections/thread_list_stream.rs":"4dd6a6342d481307f25c3f49e8a1cd080aa4dd46338bf50b6bb2ab7c01a143c7","src/thread_info/mod.rs":"b12363de1898f1f36446f00dea4c3bad6d7bb3f24e724f95a44dbae05aca2073","src/thread_info/thread_info_aarch64.rs":"6e443b2401c651d7607df251015566e7e6183a7522594d51da210a4594d62434","src/thread_info/thread_info_arm.rs":"ed291949474db210ecc8bf77c0a1c0d4cdf04882e05f5c92531905aa3f1cc705","src/thread_info/thread_info_mips.rs":"332d7888bb08a36d3b77023a4a0385193a07b1c6c5bf0e91aacb5d948ba8b903","src/thread_info/thread_info_x86.rs":"fbde8930f8d277d58faa34d90ddf6f27d6438cd5a3c017df4f878897f6f84eca","tests/common/mod.rs":"57b9df4b02b48a82451a2352359ed78a6a7f05e8157762d324bfa5344c208715","tests/minidump_writer.rs":"50e1bf1dcdabfcc82ef992989a2b19db4d3d471ce6ecd44309f824da6c874236","tests/ptrace_dumper.rs":"47a31bcd5738d84a3699fb0753696ad6bf5caef77240b4ae9c30e5ca236d1132"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"61afd471ff97dc0bdae414fc55bdde602e25158b6d2813ea74d24fc0ce690ffb","LICENSE":"1ecdd8e8977af83c07c5f97bec87b47d27059b7ea323ca3160fbfa2314f5d99c","src/android.rs":"98ba5923bee1a08ea9e07f85fce47f8e09ddbd9b3619fc981e4bbf425db0f94b","src/app_memory.rs":"909676c916c0ffaa3a813632c162f5b1207f8502408b6b3bab48a5f842948c71","src/auxv_reader.rs":"29a03c082c179733ddefee59e903dc5a43b7e681f55a1fdd9cfdec7587bd7b35","src/bin/test.rs":"b4b119a25ab1fcd71958061c23f741e956b81db28c4d7f8c5728b62eff0913e0","src/cpu_set.rs":"8b60d5a9a37c49b105075b856d05a5d8c201554923bc40a52407e034fd21681d","src/crash_context/crash_context_aarch64.rs":"ce477360b5d16f11814b195fb12c461183bd06fd08cdd14e76c9c2bdcbaccd47","src/crash_context/crash_context_arm.rs":"6e2f1db21b93fadfa034a5246c70687d6654a40627f1ecf849511cf480a96bad","src/crash_context/crash_context_mips.rs":"430669c21f03cefd479e46265dc3c4d3495acaf8b01da09dc0b0e4168306b508","src/crash_context/crash_context_x86.rs":"136a1b0f8107986505df95a1a5423f352ae3ea383e25335e60c6242acdff34da","src/crash_context/crash_context_x86_64.rs":"8fb5f86944ec5a02bc6a7dba4ef698d088686de2cf5fb0a6014592ae394c2e47","src/crash_context/mod.rs":"0e09ca5489194586580a8da6eca274fe6db8af213b804f1e407612c03c02475c","src/dso_debug.rs":"16f1701f204f9cd418382a556de4205e73ea6505a5705babf2dceb6a31732cf9","src/dumper_cpu_info/cpu_info_arm.rs":"5a53da0411922cfea71330ff5d48ddb4bff581665abfb56cfaf05d3f7177e858","src/dumper_cpu_info/cpu_info_x86_mips.rs":"331f10edc5385282f3615bfa93049fe8a97bc81ebea761100fc56752ed2ad6b8","src/dumper_cpu_info/mod.rs":"5322108f35021cf03d61ccb4c54a2b4875dfdff774a4297148925d76525d125c","src/errors.rs":"95eed17b22b3b86ed13bb9be23e77e38319beaa9ce6138f47d906e3b8fb9599b","src/lib.rs":"65617923decad2a5aaf86a1f055b5fceb09390154a8f96c4cc6efab1b5cc24dc","src/linux_ptrace_dumper.rs":"1f3becdde18f03d8707b32328d81e6d217219c5a7388a8b9f8a5abe941b4f5ed","src/maps_reader.rs":"141907c3938af72aef6c234c1ebc96ec169d856a607e9a7d804c7533813b1096","src/minidump_cpu/minidump_cpu_aarch64.rs":"18524f8a3a3d3eda7d0fafb1c168ff06dee1886da0f4278f3c2a54147ef79bc9","src/minidump_cpu/minidump_cpu_amd64.rs":"c4b3cef86ea53864c026d7c598d8a7f59ca6b1ad7e881f94ce34f39dd6b72e33","src/minidump_cpu/minidump_cpu_arm.rs":"bfbcbf280da47d715189f76c8d9749cb2808d7730bb1fe906a21b42a16c3b044","src/minidump_cpu/minidump_cpu_mips.rs":"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b","src/minidump_cpu/minidump_cpu_ppc.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_ppc64.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_sparc.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/minidump_cpu/minidump_cpu_x86.rs":"3dcb2aa4264d76f0727b9750ffce0032738bea97be95fde92089a9d11926c63c","src/minidump_cpu/mod.rs":"50e8df5e294e9d162c97dacb9448bba0ffc1e4bf992f8a2b9cc718f12b92a370","src/minidump_format.rs":"56f737bd95fbbd5b4b3d7773dc491e267887d78b12916645bccbcef16acf2cfc","src/minidump_writer.rs":"abc05364f455b0b119e07cba74b2aeb84c04bd9eec19178290eb2906a2769d87","src/sections/app_memory.rs":"6fb616e0aa495fd5d9a487231750ac3c2ffa275802adf0f7e60c7666f5e14a60","src/sections/exception_stream.rs":"5c49b80b5acf3694c0c2e275b083ae8f544ed7ba7b8d417303706bfaadf3419e","src/sections/mappings.rs":"ce3babbc55b7e7e8a5e3036fcd0fadd3b8d5402ac484bd066f84997a6419d886","src/sections/memory_list_stream.rs":"02e678bd28de10e854d673ccefeb574067e64bdaefda5212a8161ea194280a7d","src/sections/mod.rs":"616c70e74d01b1116df0c9c1883f2c80aa74ab3056aeea4ed4e3f8b7c8866582","src/sections/systeminfo_stream.rs":"d481a86c6aa86a32378bb3d60b6f7f09fd57155dfa728d0dfa50aa17ef72c836","src/sections/thread_list_stream.rs":"4dd6a6342d481307f25c3f49e8a1cd080aa4dd46338bf50b6bb2ab7c01a143c7","src/thread_info/mod.rs":"b12363de1898f1f36446f00dea4c3bad6d7bb3f24e724f95a44dbae05aca2073","src/thread_info/thread_info_aarch64.rs":"6e443b2401c651d7607df251015566e7e6183a7522594d51da210a4594d62434","src/thread_info/thread_info_arm.rs":"ed291949474db210ecc8bf77c0a1c0d4cdf04882e05f5c92531905aa3f1cc705","src/thread_info/thread_info_mips.rs":"332d7888bb08a36d3b77023a4a0385193a07b1c6c5bf0e91aacb5d948ba8b903","src/thread_info/thread_info_x86.rs":"fbde8930f8d277d58faa34d90ddf6f27d6438cd5a3c017df4f878897f6f84eca","tests/common/mod.rs":"57b9df4b02b48a82451a2352359ed78a6a7f05e8157762d324bfa5344c208715","tests/minidump_writer.rs":"50e1bf1dcdabfcc82ef992989a2b19db4d3d471ce6ecd44309f824da6c874236","tests/ptrace_dumper.rs":"47a31bcd5738d84a3699fb0753696ad6bf5caef77240b4ae9c30e5ca236d1132"},"package":null} \ No newline at end of file diff --git a/third_party/rust/minidump_writer_linux/src/maps_reader.rs b/third_party/rust/minidump_writer_linux/src/maps_reader.rs index 20765734ff48..09124bf2873a 100644 --- a/third_party/rust/minidump_writer_linux/src/maps_reader.rs +++ b/third_party/rust/minidump_writer_linux/src/maps_reader.rs @@ -11,7 +11,6 @@ use std::path::PathBuf; pub const LINUX_GATE_LIBRARY_NAME: &'static str = "linux-gate.so"; pub const DELETED_SUFFIX: &'static str = " (deleted)"; -pub const MOZILLA_IPC_PREFIX: &'static str = "org.mozilla.ipc."; pub const RESERVED_FLAGS: &'static str = "---p"; type Result = std::result::Result; @@ -59,14 +58,6 @@ pub enum MappingInfoParsingResult { Success(MappingInfo), } -fn is_ipc_shared_memory_segment(pathname: Option<&str>) -> bool { - if let Some(name) = pathname { - name.contains(MOZILLA_IPC_PREFIX) && name.contains(DELETED_SUFFIX) - } else { - false - } -} - fn is_mapping_a_path(pathname: Option<&str>) -> bool { match pathname { Some(x) => x.contains("/"), @@ -143,11 +134,6 @@ impl MappingInfo { offset = 0; } - if is_ipc_shared_memory_segment(pathname) { - // Skip shared memory segments used for IPC - return Ok(MappingInfoParsingResult::SkipLine); - } - match (pathname, last_mapping) { (Some(_name), Some(module)) => { // Merge adjacent mappings into one module, assuming they're a single diff --git a/third_party/rust/minidump_writer_linux/src/sections/mappings.rs b/third_party/rust/minidump_writer_linux/src/sections/mappings.rs index 6f9b01372615..cc12d332ca98 100644 --- a/third_party/rust/minidump_writer_linux/src/sections/mappings.rs +++ b/third_party/rust/minidump_writer_linux/src/sections/mappings.rs @@ -16,32 +16,14 @@ pub fn write( buffer: &mut DumpBuf, dumper: &mut LinuxPtraceDumper, ) -> Result { - let mut num_output_mappings = config.user_mapping_list.len(); + let mut modules = Vec::new(); - for mapping in &dumper.mappings { + // First write all the mappings from the dumper + for map_idx in 0..dumper.mappings.len() { // If the mapping is uninteresting, or if // there is caller-provided information about this mapping // in the user_mapping_list list, skip it - if mapping.is_interesting() && !mapping.is_contained_in(&config.user_mapping_list) { - num_output_mappings += 1; - } - } - let list_header = MemoryWriter::::alloc_with_val(buffer, num_output_mappings as u32)?; - - let mut dirent = MDRawDirectory { - stream_type: MDStreamType::ModuleListStream as u32, - location: list_header.location(), - }; - - // In case of num_output_mappings == 0, this call doesn't allocate any memory in the buffer - let mut mapping_list = - MemoryArrayWriter::::alloc_array(buffer, num_output_mappings)?; - dirent.location.data_size += mapping_list.location().data_size; - - // First write all the mappings from the dumper - let mut idx = 0; - for map_idx in 0..dumper.mappings.len() { if !dumper.mappings[map_idx].is_interesting() || dumper.mappings[map_idx].is_contained_in(&config.user_mapping_list) { @@ -51,18 +33,35 @@ pub fn write( let identifier = dumper .elf_identifier_for_mapping_index(map_idx) .unwrap_or(Default::default()); + + // If the identifier is all 0, its an uninteresting mapping (bmc#1676109) + if identifier.is_empty() || identifier.iter().all(|&x| x == 0) { + continue; + } + let module = fill_raw_module(buffer, &dumper.mappings[map_idx], &identifier)?; - mapping_list.set_value_at(buffer, module, idx)?; - idx += 1; + modules.push(module); } // Next write all the mappings provided by the caller for user in &config.user_mapping_list { // GUID was provided by caller. let module = fill_raw_module(buffer, &user.mapping, &user.identifier)?; - mapping_list.set_value_at(buffer, module, idx)?; - idx += 1; + modules.push(module) } + + let list_header = MemoryWriter::::alloc_with_val(buffer, modules.len() as u32)?; + + let mut dirent = MDRawDirectory { + stream_type: MDStreamType::ModuleListStream as u32, + location: list_header.location(), + }; + + if !modules.is_empty() { + let mapping_list = MemoryArrayWriter::::alloc_from_array(buffer, &modules)?; + dirent.location.data_size += mapping_list.location().data_size; + } + Ok(dirent) }