Skip to content

Commit

Permalink
rtld: Ignore '-z now' related bind flags in program interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Oct 17, 2024
1 parent fb9b3db commit 8445a51
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions options/rtld/generic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ static frg::vector<frg::string_view, MemoryAllocator> parseList(frg::string_view
return list;
}

static constexpr uint64_t supportedDtFlags = DF_BIND_NOW;
static constexpr uint64_t supportedDtFlags1 = DF_1_NOW;

extern "C" void *interpreterMain(uintptr_t *entry_stack) {
if(logEntryExit)
mlibc::infoLogger() << "Entering ld.so" << frg::endlog;
Expand Down Expand Up @@ -337,6 +340,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 8445a51

Please sign in to comment.