Skip to content

Commit 6740d00

Browse files
aperezkusmour
authored andcommitted
Allow loading modules from /dev/shm
Summary: On production machines, it looks like our [XAR](https://www.internalfb.com/intern/wiki/Python/Python_Packaging/XAR/)-based Python bundles are mounted into `/dev/shm/` instead of `/mnt/xarfuse`. We're currently ignoring any module path that starts with `/dev/`, so I'm relaxing the path regex check to allow us to load modules from XARs. Test Plan: Before this patch, printing the backtrace on coredump `m29bktmqgek9s120` wouldn't show information for certain frames (e.g., frame #0 in the example below): ``` $ lldb /mnt/xarfuse/uid-540188/4e1bfb91-seed-nspid4026531836_cgpid18240-ns-4026531841/runtime/bin/llama-sheriff#native-main#platform-runtime#python#py_version_3_10 -c m29bktmqgek9s120 (lldb) target create "/mnt/xarfuse/uid-540188/4e1bfb91-seed-nspid4026531836_cgpid18240-ns-4026531841/runtime/bin/llama-sheriff#native-main#platform-runtime#python#py_version_3_10" --core "m29bktmqgek9s120" Core file '/home/alexandreperez/temp/llama/m29bktmqgek9s120' (x86_64) was loaded. (lldb) bt * thread #1, name = 'llama-sheriff#n', stop reason = signal SIGSEGV * frame #0: 0x00005633b351bdcf frame #1: 0x00007f2573c97790 libc.so.6`__GI___nptl_deallocate_tsd [inlined] __GI___nptl_deallocate_tsd at nptl_deallocate_tsd.c:74:29 frame #2: 0x00007f2573c9771b libc.so.6`__GI___nptl_deallocate_tsd at nptl_deallocate_tsd.c:23:1 frame llvm#3: 0x00007f2573c9aada libc.so.6`start_thread(arg=<unavailable>) at pthread_create.c:445:3 frame llvm#4: 0x00007f2573d2d17c libc.so.6`__clone3 at clone3.S:81 (lldb) ``` After this diff: ``` $ lldb /mnt/xarfuse/uid-540188/4e1bfb91-seed-nspid4026531836_cgpid18240-ns-4026531841/runtime/bin/llama-sheriff#native-main#platform-runtime#python#py_version_3_10 -c m29bktmqgek9s120 (lldb) target create "/mnt/xarfuse/uid-540188/4e1bfb91-seed-nspid4026531836_cgpid18240-ns-4026531841/runtime/bin/llama-sheriff#native-main#platform-runtime#python#py_version_3_10" --core "m29bktmqgek9s120" Core file '/home/alexandreperez/temp/llama/m29bktmqgek9s120' (x86_64) was loaded. (lldb) bt * thread #1, name = 'llama-sheriff#n', stop reason = signal SIGSEGV * frame #0: 0x00005633b351bdcf llama-sheriff#native-main#platform-runtime#python#py_version_3_10`folly::threadlocal_detail::StaticMetaBase::onThreadExit(void*) + 175 frame #1: 0x00007f2573c97790 libc.so.6`__GI___nptl_deallocate_tsd [inlined] __GI___nptl_deallocate_tsd at nptl_deallocate_tsd.c:74:29 frame #2: 0x00007f2573c9771b libc.so.6`__GI___nptl_deallocate_tsd at nptl_deallocate_tsd.c:23:1 frame llvm#3: 0x00007f2573c9aada libc.so.6`start_thread(arg=<unavailable>) at pthread_create.c:445:3 frame llvm#4: 0x00007f2573d2d17c libc.so.6`__clone3 at clone3.S:81 (lldb) ``` Reviewers: jeffreytan, gclayton, hyubo, #lldb_team Reviewed By: hyubo Subscribers: pdepetro, #python_debugging, #lldb_team Differential Revision: https://phabricator.intern.facebook.com/D55261258
1 parent 25d5589 commit 6740d00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Plugins/DynamicLoader/ModuleList-DYLD/DynamicLoaderDumpWithModuleList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void DynamicLoaderDumpWithModuleList::LoadAllModules(
173173
bool DynamicLoaderDumpWithModuleList::ShouldLoadModule(
174174
const std::string &module_name) {
175175
// Use a regular expression to match /dev/* path
176-
static const std::regex pattern("^/dev/.*$");
176+
static const std::regex pattern("^/dev/(?!shm.*).*$");
177177
return !std::regex_match(module_name, pattern);
178178
}
179179

0 commit comments

Comments
 (0)