Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #119409] DynaLoader::dl_unload_file() is unsafe with -DPERL_GLOBAL_STRUCT_PRIVATE

3 views
Skip to first unread message

Nicholas Clark

unread,
Aug 21, 2013, 3:18:51 PM8/21/13
to bugs-bi...@rt.perl.org
# New Ticket Created by Nicholas Clark
# Please include the string: [perl #119409]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119409 >


DynaLoader::dl_unload_file() is not safe when perl was built with
-DPERL_GLOBAL_STRUCT_PRIVATE

This is because -DPERL_GLOBAL_STRUCT_PRIVATE uses alternative implementations
of Perl_my_cxt_init() and Perl_my_cxt_index() which store the pointer to the
extension name. For a dynamically loaded shared object this is a pointer to
memory which will be released if that shared object is unloaded, meaning that
any *other* module which calls Perl_my_cxt_index() will likely attempt a read
of unmapped memory.

I believe that -DPERL_GLOBAL_STRUCT_PRIVATE is only needed for the Symbian
port of Perl, and possibly only for some platform variants of Symbian.

I see three possible resolutions of this:

1) Replace the alternative implementation of Perl_my_cxt_index()/
Perl_my_cxt_init() with one that does not store and compare pointers
(eg a radix tree or similar, if we implement a useful data structure for
some other reason)
2) De-register contexts as part of adding some more general "unload" hook
for XS modules. (The currently missing opposite of BOOT)
3) Stall until such time as retaining the Symbian port for those devices
needing -DPERL_GLOBAL_STRUCT_PRIVATE makes no sense.
(ie commercial support for the last Symbian devices needing it has ended)

I don't see this as a priority to address, and have marked the tests as
todo_skip() for the problem configuration.

Nicholas Clark

0 new messages