[+] Insert anon/other pages into process map of linux processes
This commit is contained in:
parent
237d2d070c
commit
a66fb2c510
@ -36,14 +36,6 @@ namespace Aurora::Process
|
|||||||
size_t size,
|
size_t size,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
auto index = file.find_last_of(".so");
|
|
||||||
if (index != AuString::npos)
|
|
||||||
{
|
|
||||||
file = file.substr(0, index);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AuString fileName = info->dlpi_name[0] ? info->dlpi_name : AuString{};
|
AuString fileName = info->dlpi_name[0] ? info->dlpi_name : AuString{};
|
||||||
if (fileName.empty())
|
if (fileName.empty())
|
||||||
{
|
{
|
||||||
@ -81,6 +73,7 @@ namespace Aurora::Process
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sections sections;
|
||||||
AuParse::SplitNewlines(map, [&](const AuString &line)
|
AuParse::SplitNewlines(map, [&](const AuString &line)
|
||||||
{
|
{
|
||||||
char *endPtr;
|
char *endPtr;
|
||||||
@ -92,6 +85,8 @@ namespace Aurora::Process
|
|||||||
if (errno == ERANGE) return;
|
if (errno == ERANGE) return;
|
||||||
if (*endPtr != ' ') return;
|
if (*endPtr != ' ') return;
|
||||||
|
|
||||||
|
auto perms = endPtr + 1;
|
||||||
|
|
||||||
auto A = line.find_first_of(':');
|
auto A = line.find_first_of(':');
|
||||||
if (A == AuString::npos) return;
|
if (A == AuString::npos) return;
|
||||||
|
|
||||||
@ -131,10 +126,26 @@ namespace Aurora::Process
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
Section sect {};
|
||||||
//printf("%llx %llx %s\n", base, end, name.c_str());
|
|
||||||
|
|
||||||
|
sect.origVa = 0;
|
||||||
|
sect.baseVa = base;
|
||||||
|
sect.size = end - base;
|
||||||
|
sect.fsOff = 0;
|
||||||
|
|
||||||
|
sect.pt.readable = perms[0] == 'r';
|
||||||
|
sect.pt.writable = perms[1] == 'w';
|
||||||
|
sect.pt.NX = perms[2] != 'x';
|
||||||
|
|
||||||
|
sect.name = AuMove(name);
|
||||||
|
AuTryInsert(sections, sect);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
BorrowOtherSectionArray([&](AuList<Section> &out)
|
||||||
|
{
|
||||||
|
out.clear();
|
||||||
|
out.insert(out.end(), sections.begin(), sections.end());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PassThreeGatherMissingProgNames()
|
static void PassThreeGatherMissingProgNames()
|
||||||
@ -205,9 +216,7 @@ namespace Aurora::Process
|
|||||||
AuUInt fileOffset = section.sh_offset;
|
AuUInt fileOffset = section.sh_offset;
|
||||||
AuUInt programOffset = section.sh_addr;
|
AuUInt programOffset = section.sh_addr;
|
||||||
|
|
||||||
|
|
||||||
Section sect {};
|
Section sect {};
|
||||||
|
|
||||||
sect.origVa = section.sh_addr;
|
sect.origVa = section.sh_addr;
|
||||||
sect.baseVa = 0;
|
sect.baseVa = 0;
|
||||||
|
|
||||||
@ -238,7 +247,10 @@ namespace Aurora::Process
|
|||||||
|
|
||||||
sect.name = sectionName;
|
sect.name = sectionName;
|
||||||
|
|
||||||
AuTryInsert(modSections, sect);
|
if (sect.fsOff || sect.size)
|
||||||
|
{
|
||||||
|
AuTryInsert(modSections, sect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pub = AuMakeShared<PublicModule>();
|
auto pub = AuMakeShared<PublicModule>();
|
||||||
|
@ -131,6 +131,11 @@ namespace Aurora::Process
|
|||||||
|
|
||||||
for (const auto §ion : mod->sections)
|
for (const auto §ion : mod->sections)
|
||||||
{
|
{
|
||||||
|
if (!section.baseVa)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (AuUInt i = section.baseVa; i < section.baseVa + section.size; i += (kMinPageAlignment * kPageBufferPad))
|
for (AuUInt i = section.baseVa; i < section.baseVa + section.size; i += (kMinPageAlignment * kPageBufferPad))
|
||||||
{
|
{
|
||||||
auto itr = gModulePtrMap.find(ToLowestPageAlignment(i));
|
auto itr = gModulePtrMap.find(ToLowestPageAlignment(i));
|
||||||
@ -155,7 +160,6 @@ namespace Aurora::Process
|
|||||||
static AuOptional<Section> FindInCache(AuUInt pointer)
|
static AuOptional<Section> FindInCache(AuUInt pointer)
|
||||||
{
|
{
|
||||||
auto curPtr = ToLowestPageAlignment(pointer);
|
auto curPtr = ToLowestPageAlignment(pointer);
|
||||||
|
|
||||||
auto temp = GetSectionCache(curPtr);
|
auto temp = GetSectionCache(curPtr);
|
||||||
if (temp.has_value()) return temp;
|
if (temp.has_value()) return temp;
|
||||||
|
|
||||||
@ -209,7 +213,7 @@ namespace Aurora::Process
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BorrowOtherSectionArray(const AuConsumer<AuList<Section>> &callback)
|
void BorrowOtherSectionArray(const AuConsumer<AuList<Section>&> &callback)
|
||||||
{
|
{
|
||||||
AU_LOCK_GUARD(gMutexUnique);
|
AU_LOCK_GUARD(gMutexUnique);
|
||||||
callback(gOtherSections);
|
callback(gOtherSections);
|
||||||
|
@ -15,7 +15,7 @@ namespace Aurora::Process
|
|||||||
AuUInt modBase;
|
AuUInt modBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
void BorrowOtherSectionArray(const AuConsumer<AuList<Section>> &callback);
|
void BorrowOtherSectionArray(const AuConsumer<AuList<Section>&> &callback);
|
||||||
|
|
||||||
PublicModule GetFromModuleCache(AuUInt handle);
|
PublicModule GetFromModuleCache(AuUInt handle);
|
||||||
void InsertModuleCache(const ModuleBasePair &pair, const AuSPtr<PublicModule> &mod);
|
void InsertModuleCache(const ModuleBasePair &pair, const AuSPtr<PublicModule> &mod);
|
||||||
|
Loading…
Reference in New Issue
Block a user