← Back to Pull requests

Devel::PPPort: skip calling a pp func from an XSUB with RC stack #24953

Merged
tonycoz merged 3 files (23 lines) on Oct 23, 2026 10:48 UTC
View on GitHub
tonycoz tonycoz commented on Oct 12, 2026 04:11 UTC
Author

Fixes #24938

-------------------------------------------------------------------------------
<!--
Significant or noteworthy changes to Perl must be documented in pod/perldelta.pod.

Consider if the changes in this pull request are worthy of a perldelta
entry, then pick the appropriate line below and remove the others.
-->

  • This set of changes does not require a perldelta entry.
  • Diff: 23 lines (+20 / -3) across 3 files Reviewer: jkeenan Review duration: 16237m
    All Vouch review confidence checks passed
    Residual risk 0.03 = Change Risk (0.25) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.25 · 23 lines diff across 3 files
    0.25
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.86 · 5 substantive comment(s)
    0.86
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    88%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.190
    Real PR Conversation Timeline
    17 items
    jkeenan jkeenan commented on code on Oct 12, 2026 13:41 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -448,7 +450,16 @@ ok(defined &Devel::PPPort::PL_tokenbuf());
     ok(ivers($]) >= ivers("5.009005") || &Devel::PPPort::PL_parser());
     ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/);
     ok(defined &Devel::PPPort::PL_hints());
    -is(&Devel::PPPort::PL_ppaddr("mhx"), "MHX");
    +
    +{
    +  if ($Config{ccflags} =~ /-DPERL_RC_STACK/) {
    +    # testutils skip doesn't "last SKIP"

    @tonycoz, in https://github.com/Perl/perl5/issues/24954 I have raised the question of why dist/Devel-PPPort/t/testutil.pl has #last SKIP; commented out. The discussion in that ticket may allow us to take a different approach here.

    jkeenan jkeenan commented on Oct 12, 2026 13:46 UTC
    Contributor

    I used the GH web interface to resolve the merge conflicts in Changes. Our GH CI then re-started and all rigs have PASSed. Except for the question I posed above, the p.r. looks good and it addresses the problem described in GH #24938. However, I don't know why the web interface is still displaying the message "This branch cannot be rebased due to conflicts".

    jkeenan jkeenan commented on Oct 12, 2026 13:58 UTC
    Contributor

    However, I don't know why the web interface is still displaying the message "This branch cannot be rebased due to conflicts".

    I built a local branch based on this pull request, but when I called git rebase blead, I got notification of merge conflicts -- the same few lines which I had earlier corrected in the GH web interface -- which I had to manually resolve to continue rebasing and testing. So now I question whether resolving merge conflicts through the web interface actually works!

    tonycoz tonycoz commented on Oct 12, 2026 21:37 UTC
    Author

    So now I question whether resolving merge conflicts through the web interface actually works!

    I don't know why it complained, I rebased on blead and applied the same resolution to Changes you did, and the difference between my commit and yours was the sync-with-cpan change, I expect I rebased on a later blead.

    Your commit was a large merge commit which may have confused the conflict detection.

    jkeenan jkeenan commented on code on Oct 13, 2026 02:43 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    This p.r. tests satisfactorily against a perl configured like this:

    $ ./perl -Ilib -V:config_args
    config_args='-des -Dusedevel -Accflags=-DPERL_RC_STACK';
    

    But it would be good if someone familiar with PL_ppaddr could confirm that this is an appropriate use thereof. Once that happens, the p.r. should be good to merge.

    jkeenan jkeenan commented on code on Oct 15, 2026 17:20 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    Could we get some eyeballs on this code from contributors who have touched it in the past? Thanks!

    @wolfsage @atoomic @mhx

    richardleach richardleach commented on code on Oct 19, 2026 14:49 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    I'm not very familiar with PL_ppaddr in PPPort, but having a quick eyeball at it, it seems reasonable.

    The test in #24938 is essentially achieving uc "mhx" by calling the uc function (pp_uc) directly via:

    void
    PL_ppaddr(string)
            char *string
            PPCODE:
                    PUSHMARK(SP);
                    mXPUSHs(newSVpv(string, 0));
                    PUTBACK;
                    ENTER;
                    (void)*(PL_ppaddr[OP_UC])(aTHXR);
                    SPAGAIN;
                    LEAVE;
                    XSRETURN(1);
    

    That is an XSUB, operating on a non-refcounted stack even under PERL_RC_STACK, calling a pp_ function which does operate on a refcounted-stack under PERL_RC_STACK. pp_uc is still PP_wrapped, so calls Perl_pp_wrap, which tweaks argument refcounts and duplicates the argument to boot.

    Addressing #24938 boils down to either:
    modifying the PL_ppaddr XSUB above to understand all those the stack adjustments
    skipping the affected test under RC_STACK builds

    The test doesn't seem to provide enough benefit to make the first option a good use of time.

    jkeenan jkeenan commented on code on Oct 20, 2026 11:21 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    @tonycoz: Here @richardleach appears to disagree with your change to .../parts/inc/variables. Would you like to comment?

    richardleach richardleach commented on code on Oct 20, 2026 12:09 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    @tonycoz: Here @richardleach appears to disagree with your change to .../parts/inc/variables. Would you like to comment?

    Apologies, that wasn't my intention. I meant to say that I can see what this PR is doing and why, and it seems reasonable.

    tonycoz tonycoz commented on code on Oct 20, 2026 22:09 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -409,6 +409,7 @@ other_variables()
                     ppp_TESTVAR(PL_sv_arenaroot);
                     ppp_TESTVAR(PL_tainted);
                     ppp_TESTVAR(PL_tainting);
    +                ppp_TESTVAR(PL_ppaddr);

    Apologies, that wasn't my intention. I meant to say that I can see what this PR is doing and why, and it seems reasonable.

    That's how I read it.

    Leont Leont commented on code on Oct 21, 2026 00:46 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -448,7 +450,16 @@ ok(defined &Devel::PPPort::PL_tokenbuf());
     ok(ivers($]) >= ivers("5.009005") || &Devel::PPPort::PL_parser());
     ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/);
     ok(defined &Devel::PPPort::PL_hints());
    -is(&Devel::PPPort::PL_ppaddr("mhx"), "MHX");
    +
    +{
    +  if ($Config{ccflags} =~ /-DPERL_RC_STACK/) {

    It appears

    if (defined &Internals::stack_refcounted && (Internals::stack_refcounted() & 1)
    

    is the right way to check for this?

    tonycoz tonycoz commented on code on Oct 21, 2026 02:34 UTC
    Code Review
    dist/Devel-PPPort/parts/inc/variables:1
    @@ -448,7 +450,16 @@ ok(defined &Devel::PPPort::PL_tokenbuf());
     ok(ivers($]) >= ivers("5.009005") || &Devel::PPPort::PL_parser());
     ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/);
     ok(defined &Devel::PPPort::PL_hints());
    -is(&Devel::PPPort::PL_ppaddr("mhx"), "MHX");
    +
    +{
    +  if ($Config{ccflags} =~ /-DPERL_RC_STACK/) {

    I think you're right, updated.

    Thanks

    tonycoz tonycoz commented on Oct 21, 2026 02:35 UTC
    Author

    Also bumped the version and moved the change in Changes to the new version, since the new dev release is due.

    jkeenan jkeenan approved these changes on Oct 21, 2026 10:00 UTC
    Approved Reviewer

    Approved these changes.

    jkeenan jkeenan commented on Oct 22, 2026 11:36 UTC
    Contributor

    @richardleach @Leont, Can we go forward with this pull request? (We would then be able to work on GH #24936.) Thanks.

    richardleach richardleach commented on Oct 22, 2026 12:08 UTC
    Contributor

    @richardleach @Leont, Can we go forward with this pull request? (We would then be able to work on GH #24936.) Thanks.

    LGTM

    Reviewers
    Assignees
    tonycoz tonycoz
    Labels
    risk: low confidence: 88.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 24.9% (LOW) · Higher = larger blast radius
    24.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.9% · Lower = rushed or shallow review
    88.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 2.8% · Safe to merge
    2.8%
    Repository