Commit Detail
Commit 84df6c8
Python snapshots: Fix path confusion when preloading dynamic libraries (#5335) There was a bug where we confused the site-packages directory with the /usr/lib directory for the sake of resolving dynamic library paths. This causes us to preload libcrypto.so under the incorrect path /session/lib/python3.13/site-packages/libcrypto.so instead of /usr/lib/libcrypto.so where it belongs. As a result of this, if we import any new packages (for example hashlib) that depend on libcrypto, the loader won't find it and will load it a second time. This works alright except that if we make a stacked memory snapshot, when we do the preloading we'll confuse both paths into /session/lib/python3.13/site-packages/libcrypto.so and the second load will be dropped. This causes an incorrect offset in the table base and so the loader will relocate all shared libraries loaded after haslib incorrectly. The bug was introduced here: https://github.com/cloudflare/workerd/pull/4612/files#diff-510242e139d24007d0356f32dbf4dfb6395b35498b5106813bb5bc6c9edd6030R295-R307 but only became noticeable when we started using dedicated snapshots.
Files changed
1 file changed~1 modified