Skip to content

Commit

Permalink
Merge pull request #1167 from mintsuki/rtld-ignore-dt-flags
Browse files Browse the repository at this point in the history
rtld: Add list of supported DT_FLAGS{,_1} to ignore
  • Loading branch information
mintsuki authored Oct 17, 2024
2 parents fb9b3db + 50894ac commit b7e6c6a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions options/rtld/generic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ static frg::vector<frg::string_view, MemoryAllocator> parseList(frg::string_view
return list;
}

#ifndef MLIBC_STATIC_BUILD
static constexpr uint64_t supportedDtFlags = DF_BIND_NOW;
static constexpr uint64_t supportedDtFlags1 = DF_1_NOW;
#endif

extern "C" void *interpreterMain(uintptr_t *entry_stack) {
if(logEntryExit)
mlibc::infoLogger() << "Entering ld.so" << frg::endlog;
Expand Down Expand Up @@ -337,6 +342,20 @@ extern "C" void *interpreterMain(uintptr_t *entry_stack) {
case DT_RELRENT:
case DT_PLTGOT:
continue;
case DT_FLAGS: {
if((ent->d_un.d_val & ~supportedDtFlags) == 0) {
continue;
}
mlibc::panicLogger() << "rtld: unexpected DT_FLAGS value of " << frg::hex_fmt(ent->d_un.d_val) << " in program interpreter" << frg::endlog;
break;
}
case DT_FLAGS_1: {
if((ent->d_un.d_val & ~supportedDtFlags1) == 0) {
continue;
}
mlibc::panicLogger() << "rtld: unexpected DT_FLAGS_1 value of " << frg::hex_fmt(ent->d_un.d_val) << " in program interpreter" << frg::endlog;
break;
}
default:
mlibc::panicLogger() << "rtld: unexpected dynamic entry " << ent->d_tag << " in program interpreter" << frg::endlog;
}
Expand Down

0 comments on commit b7e6c6a

Please sign in to comment.