New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utf8_heavy subs redefined warning and segfault when running test 253 with perl524 #376

Open
atoomic opened this Issue Aug 10, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@atoomic
Collaborator

atoomic commented Aug 10, 2016

This is similar to issue #253.

Using test case for issue #253 with perl524, shows similar error but also slightly different as the segfault is happening at destruction.

This is showing two different errors:

  • utf8_heavy redefined
  • segfault at destruction
> echo 'use Unicode::UCD q/prop_invmap/; my @list = prop_invmap("Uppercase_Mapping"); print "ok"' > test.pl; perlcc test.pl && ./test
Subroutine _loose_name redefined at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/utf8_heavy.pl line 16.
Subroutine SWASHNEW redefined at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/utf8_heavy.pl line 47.
okSegmentation fault
0x00007ffff78f8353 in do_clean_objs () from /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int/CORE/libperl.so
Missing separate debuginfos, use: debuginfo-install gdbm-1.10-8.el7.x86_64 glibc-2.17-106.el7_2.8.x86_64 nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64
(gdb) bt
#0  0x00007ffff78f8353 in do_clean_objs ()
   from /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int/CORE/libperl.so
#1  0x00007ffff78f6b29 in S_visit () from /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int/CORE/libperl.so
#2  0x00007ffff78f8461 in Perl_sv_clean_objs ()
   from /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int/CORE/libperl.so
#3  0x00007ffff789239f in perl_destruct ()
   from /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/x86_64-linux-64int/CORE/libperl.so
#4  0x000000000054b96e in my_perl_destruct ()
#5  0x000000000054c407 in main ()
@rurban

This comment has been minimized.

Show comment
Hide comment
@rurban

rurban Aug 11, 2016

Owner

The problem is that get_cvn_flags("Unicode::Normalize::NFKC", 24, GV_ADD) is initialized too early in init, and not in init2. (after the module bootstrap). so the SvRV of the failing SV was empty.

fixed by postponing a SvRV of a CV to init2.

Note that this would be a run-time error, the CVREF to this function is empty. The symptom, crashing at destruction, is just luck.

Owner

rurban commented Aug 11, 2016

The problem is that get_cvn_flags("Unicode::Normalize::NFKC", 24, GV_ADD) is initialized too early in init, and not in init2. (after the module bootstrap). so the SvRV of the failing SV was empty.

fixed by postponing a SvRV of a CV to init2.

Note that this would be a run-time error, the CVREF to this function is empty. The symptom, crashing at destruction, is just luck.

@rurban rurban self-assigned this Aug 11, 2016

@atoomic

This comment has been minimized.

Show comment
Hide comment
@atoomic

atoomic Aug 11, 2016

Collaborator

This is indeed fixing the segfault issue, need to check that utf8 partial saving warning

Collaborator

atoomic commented Aug 11, 2016

This is indeed fixing the segfault issue, need to check that utf8 partial saving warning

atoomic added a commit to CpanelInc/perl-compiler that referenced this issue Aug 11, 2016

B 1.54_11: delay cvref to init2
The SvRV of a xsloaded module needs to be initialized in init2, otherwise
the CV will be empty.
i.e. sv_list[9735].sv_u.svu_rv = (SV*)get_cvn_flags("Unicode::Normalize::NFKC", 24, 0);

Todo: merge this with the other GvCV_set() init2 initialization to avoid
2x get_cvn_flags().

Fixes rurban#376.
Fix delayed cvref initialization of XS module functions (rurban#376)

Signed-off-by: Nicolas Rochelemagne <rochelemagne@cpanel.net>

atoomic added a commit to CpanelInc/perl-compiler that referenced this issue Aug 11, 2016

B 1.54_11: delay cvref to init2
The SvRV of a xsloaded module needs to be initialized in init2, otherwise
the CV will be empty.
i.e. sv_list[9735].sv_u.svu_rv = (SV*)get_cvn_flags("Unicode::Normalize::NFKC", 24, 0);

Todo: merge this with the other GvCV_set() init2 initialization to avoid
2x get_cvn_flags().

Fixes rurban#376.
Fix delayed cvref initialization of XS module functions (rurban#376)

Signed-off-by: Nicolas Rochelemagne <rochelemagne@cpanel.net>

atoomic added a commit to CpanelInc/perl-compiler that referenced this issue Aug 11, 2016

B 1.54_11: delay cvref to init2
The SvRV of a xsloaded module needs to be initialized in init2, otherwise
the CV will be empty.
i.e. sv_list[9735].sv_u.svu_rv = (SV*)get_cvn_flags("Unicode::Normalize::NFKC", 24, 0);

Todo: merge this with the other GvCV_set() init2 initialization to avoid
2x get_cvn_flags().

Fixes rurban#376.
Fix delayed cvref initialization of XS module functions (rurban#376)

Signed-off-by: Nicolas Rochelemagne <rochelemagne@cpanel.net>

@rurban rurban closed this in 4c3723d Aug 11, 2016

@rurban rurban reopened this Aug 11, 2016

atoomic added a commit to atoomic/perl-compiler that referenced this issue Aug 11, 2016

Additional patch for rurban#376 for perl5.24
The SvRV of a xsloaded module needs to be initialized in init2, otherwise
the CV will be empty.
@atoomic

This comment has been minimized.

Show comment
Hide comment
@atoomic

atoomic Aug 11, 2016

Collaborator

Came with nearly the same patch as yours d6d8e70 but was suggesting to only apply it for perl524 and later this is a non issue with 522.

Collaborator

atoomic commented Aug 11, 2016

Came with nearly the same patch as yours d6d8e70 but was suggesting to only apply it for perl524 and later this is a non issue with 522.

atoomic added a commit to CpanelInc/perl-compiler that referenced this issue Aug 11, 2016

B 1.54_11: delay cvref to init2
The SvRV of a xsloaded module needs to be initialized in init2, otherwise
the CV will be empty.
i.e. sv_list[9735].sv_u.svu_rv = (SV*)get_cvn_flags("Unicode::Normalize::NFKC", 24, 0);

Todo: merge this with the other GvCV_set() init2 initialization to avoid
2x get_cvn_flags().

Fixes rurban#376.
Fix delayed cvref initialization of XS module functions (rurban#376)

Signed-off-by: Nicolas Rochelemagne <rochelemagne@cpanel.net>
@rurban

This comment has been minimized.

Show comment
Hide comment
@rurban

rurban Aug 11, 2016

Owner

I' not sure. I'm concerned that the empty cvref has some bad effects somewhere.

Owner

rurban commented Aug 11, 2016

I' not sure. I'm concerned that the empty cvref has some bad effects somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment