-
Notifications
You must be signed in to change notification settings - Fork 553
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
segfault on goto &xs_sub when calling sub is replaced #19936
Labels
Comments
|
Sample CPANtesters failure report: @iabyn, can you take a look? |
iabyn
added a commit
that referenced
this issue
Jul 9, 2022
GH #19936 When the sub which is being left gets freed, like: sub foo { *foo = sub {}; goto &xs_sub } it can leave PL_op as a NULL pointer while the XS sub is being executed. My recent commit v5.37.1-83-g58cf04199f, which fixed the value of GIMME_V in such XS subs, made the problem more noticeable, since it caused PL_op to always be accessed. The fix is to defer the freeing of the old sub when goto'ing an XS sub.
|
On Fri, Jul 08, 2022 at 11:41:58PM -0700, Graham Knop wrote:
The commit 58cf041 is causing segfaults when you goto an XS sub, if the calling sub has been replaced.
This is breaking the module Types::ReadOnly. https://rt.cpan.org/Ticket/Display.html?id=143710
**Steps to Reproduce**
```
$ perl -e'sub foo { *foo = sub {}; goto &utf8::is_utf8 }; foo "";'
Segmentation fault: 11
```
Turns out this was a pre-existing bug; my recent change just made it more
noticeable.
Should be fixed how by v5.37.1-102-gf4cc8ab9db :
commit f4cc8ab
Author: David Mitchell ***@***.***>
AuthorDate: Sat Jul 9 19:03:10 2022 +0100
Commit: David Mitchell ***@***.***>
CommitDate: Sat Jul 9 19:03:10 2022 +0100
avoid SEGVs on goto &xs_sub
GH #19936
When the sub which is being left gets freed, like:
sub foo { *foo = sub {}; goto &xs_sub }
it can leave PL_op as a NULL pointer while the XS sub is being executed.
My recent commit v5.37.1-83-g58cf04199f, which fixed the value of
GIMME_V in such XS subs, made the problem more noticeable, since it
caused PL_op to always be accessed.
The fix is to defer the freeing of the old sub when goto'ing an XS sub.
M pp_ctl.c
M t/op/goto.t
…--
I thought I was wrong once, but I was mistaken.
|
scottchiefbaker
pushed a commit
to scottchiefbaker/perl5
that referenced
this issue
Nov 3, 2022
GH Perl#19936 When the sub which is being left gets freed, like: sub foo { *foo = sub {}; goto &xs_sub } it can leave PL_op as a NULL pointer while the XS sub is being executed. My recent commit v5.37.1-83-g58cf04199f, which fixed the value of GIMME_V in such XS subs, made the problem more noticeable, since it caused PL_op to always be accessed. The fix is to defer the freeing of the old sub when goto'ing an XS sub.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The commit 58cf041 is causing segfaults when you goto an XS sub, if the calling sub has been replaced.
This is breaking the module Types::ReadOnly. https://rt.cpan.org/Ticket/Display.html?id=143710
Steps to Reproduce
The choice of utf8::is_utf8 is arbitrary, it can be any XS sub.
Perl configuration
The text was updated successfully, but these errors were encountered: