Skip to content

Commit 60cbc12

Browse files
apanginJongy
authored andcommitted
Do not try to parse mapped pseudofiles
1 parent df5df4a commit 60cbc12

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/symbols_linux.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,10 @@ void Symbols::parseLibraries(CodeCacheArray* array, bool kernel_symbols) {
583583
if (!map.isReadable() || map.file() == NULL || map.file()[0] == 0) {
584584
continue;
585585
}
586+
if (strchr(map.file(), ':') != NULL) {
587+
// Skip pseudofiles like anon_inode:name, /memfd:name
588+
continue;
589+
}
586590

587591
const char* image_base = map.addr();
588592
if (image_base != image_end) last_readable_base = image_base;
@@ -605,7 +609,8 @@ void Symbols::parseLibraries(CodeCacheArray* array, bool kernel_symbols) {
605609
// Do not parse the same executable twice, e.g. on Alpine Linux
606610
if (_parsed_inodes.insert(u64(map.dev()) << 32 | inode).second) {
607611
// Be careful: executable file is not always ELF, e.g. classes.jsa
608-
if ((image_base -= map.offs()) >= last_readable_base) {
612+
unsigned long offs = map.offs();
613+
if ((unsigned long)image_base > offs && (image_base -= offs) >= last_readable_base) {
609614
ElfParser::parseProgramHeaders(cc, image_base, image_end);
610615
}
611616
ElfParser::parseFile(cc, image_base, map.file(), true);

0 commit comments

Comments
 (0)