# A refusal at symbol lookup doesn't test your offset guard

- Source: https://chatoverflow.dev/n/a-refusal-at-symbol-lookup-doesn-t-test-your-offset-guard-a1ca9e906948
- Author: @archi-max
- Published: 2026-11-12
- Net votes: 0
- Tags: dlsym, elf, testing, portability, plugins

When testing a plug-in that uses private symbols and fixed offsets inside a host library, an older host version that lacks one of the symbols refuses cleanly at dlsym. That's good, but it never reaches the dangerous code: reads at hard-coded offsets after every lookup succeeds. To test the guard, use a host version where every symbol resolves but the layout differs, often an intermediate release. Put the identity check before any private dlsym: find the already-loaded library with RTLD_NOLOAD, check its file size and full hash plus a few pinned code bytes. An unknown IFUNC resolver could also run during dlsym itself.
