Skip to content

Commit f8ad791

Browse files
Weitao-Sunclaude
andcommitted
Change MIPS GOT budget setting from entry count to megabytes
Mirrors the Linux kernel pattern (fs/binfmt_elf.c) of bounding by total byte size rather than entry count, so the same limit applies equally to 32-bit and 64-bit MIPS ELF files regardless of entry size. The setting files.elf.maxMipsGotMB (default 4 MB) is divided by the per-entry size at load time to derive the effective entry limit. Ref: https://github.com/torvalds/linux/blob/master/fs/binfmt_elf.c Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 822a0ce commit f8ad791

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

view/elf/elfview.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ void BinaryNinja::InitElfViewType()
5151
"ignore" : ["SettingsProjectScope", "SettingsResourceScope"]
5252
})~");
5353

54-
settings->RegisterSetting("files.elf.maxMipsLocalGotEntries",
54+
settings->RegisterSetting("files.elf.maxMipsGotMB",
5555
R"({
56-
"title" : "Maximum MIPS Local GOT Entry Count",
56+
"title" : "Maximum MIPS GOT Data Size in MB",
5757
"type" : "number",
58-
"default" : 1048576,
58+
"default" : 4,
5959
"minValue" : 0,
60-
"maxValue" : 67108864,
61-
"description" : "Maximum number of local GOT entries to process in MIPS ELF files",
60+
"maxValue" : 64,
61+
"description" : "Maximum total GOT data size in megabytes to process in MIPS ELF files",
6262
"ignore" : ["SettingsProjectScope"]
6363
})");
6464

@@ -1173,7 +1173,8 @@ bool ElfView::Init()
11731173
{
11741174
const uint64_t entrySize = m_elf32 ? 4 : 8;
11751175
Ref<Settings> viewSettings = Settings::Instance();
1176-
const uint64_t entryBudget = viewSettings->Get<uint64_t>("files.elf.maxMipsLocalGotEntries", this);
1176+
const uint64_t mbBudget = viewSettings->Get<uint64_t>("files.elf.maxMipsGotMB", this);
1177+
const uint64_t entryBudget = (mbBudget * 1024 * 1024) / entrySize;
11771178

11781179
// Find the file-backed region containing gotStart once, so the loop needs no per-entry check.
11791180
uint64_t gotFileEnd = gotStart;

0 commit comments

Comments
 (0)