参考所有分组,完成尽量多的内容。禁止顺手扩功能 smoke:锁定dlfcn禁用边界

结论:按 LinuxCNC src/emc/rs274ngc/interp_base.cc 的 dlopen/dlsym/dlerror 调用点,补强 WASM dlfcn shim 与 interp_base probe,确认浏览器安全探针中动态加载保持不可用;不扩展 smoke 解析。
This commit is contained in:
cnc
2026-06-04 19:59:14 +08:00
parent f36e2a96c4
commit 7471444781
3 changed files with 29 additions and 3 deletions

View File

@@ -1,8 +1,29 @@
#include "dlfcn.h"
#include "interp_base.hh"
#include <cstring>
// LinuxCNC source basis: src/emc/rs274ngc/interp_base.cc provides
// interp_from_shlib(), with the declaration in interp_base.hh.
// interp_from_shlib(), with the declaration in interp_base.hh. Its native
// dlopen()/dlsym() loader edge is intentionally unavailable in WASM probes.
int main() {
if (dlopen(nullptr, RTLD_GLOBAL) != nullptr) {
return 2;
}
if (dlopen("/tmp/cnc_sim_missing_interpreter.so", RTLD_NOW) != nullptr) {
return 3;
}
if (dlsym(nullptr, "makeInterp") != nullptr) {
return 4;
}
const char *error = dlerror();
if (!error || !std::strstr(error, "dynamic loading is unavailable")) {
return 5;
}
if (dlclose(nullptr) != 0) {
return 6;
}
InterpBase *interp = interp_from_shlib("nonexistent-interpreter.so");
return interp == nullptr ? 0 : 1;
}