-
Notifications
You must be signed in to change notification settings - Fork 584
Add additional check for custom array/hash access checking #23399
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
base: blead
Are you sure you want to change the base?
Conversation
PL_check[] can have customized checks for array/hash elements in the OP_AELEM, OP_EXISTS, and OP_DELETE elements. When these are set, the multideref optimization is turned off. It turns out that checking for this always shows that they are not the standard values on z/OS, because that platform's function pointers may point to a "function descriptor" and not the actual function, or it may not. It's not clear to me if this implementation conforms to the C Standard or not, but it is what it is. As a result our test suite fails some tests that are expecting non-custom entries in those slots. This commit builds upon some ideas from Dave Mitchell and Richard Leach to add 3 entries to the array of function pointers. These entries are initialized the same way the others are, so that a comparison against them when no customization has been done should succeed. The current comparisons are retained, so that it's likely on z/OS one or the other will succeed when no customization is currently in place.
I imagine most compilers would know to optimize the reference away when the first conditional has ruled out all but one possibility, but I think it is clearer anyway to use that single value.
It's also unlikely that the op_type will be any given value, but I expect the compiler and libc know that. This stresses that it is unlikely some module will customize the handling of these checkers.
I think its better to figure out which Z/OS C compiler flag/linker flag turns on function pointer equality, and throw that cmd line flag into This bug is obvious to understand for any Linux devs. Its basic ELF interposition at work. The integer address you get by typing PL_check[PERL_CK_NULL] is the the tiny jump shim C function that the PLT/GOT scheme requires, so that https://docs.oracle.com/cd/E19683-01/816-1386/6m7qcobkv/index.html#indexterm-315 A possible fix for Z/OS could also be 1 time hacks like this aren't sustainable, and they won't fix any of the For example, this PR didn't catch this line Line 5121 in 9ef5300
How many more of these lines exist in Perl ecosystem? Its pretty well documented Z/OS has plenty of different ABIs inside 1 or more address spaces per process. And Z/OS C stack is a linked list if I read this correctly. https://share.confex.com/share/119/webprogram/Handout/Session11408/Save_area_Conventions.pdf A https://www.ibm.com/docs/en/zos/2.4.0?topic=qualifiers-far-type-qualifier-c-only
maybe this option for ZOS? https://www.ibm.com/docs/en/zos/2.4.0?topic=qualifiers-fdptr-type-qualifier-c-only
So yeah, this is strictly the fault of the Perl 5 interpreter for assuming Instead of adding extra entries to a P5P created array stored in Or properly declare arrays PL_check/PL_ppaddr with a 128 bit pointer type. |
PL_check[] can have customized checks for array/hash elements in the
OP_AELEM, OP_EXISTS, and OP_DELETE elements. When these are set, the
multideref optimization is turned off.
It turns out that checking for this always shows that they are not the
standard values on z/OS, because that platform's function pointers may
point to a "function descriptor" and not the actual function, or it may
not. It's not clear to me if this implementation conforms to the C
Standard or not, but it is what it is. As a result our test suite fails
some tests that are expecting non-custom entries in those slots.
This commit builds upon some ideas from Dave Mitchell and Richard Leach
to add 3 entries to the array of function pointers. These entries are
initialized the same way the others are, so that a comparison against
them when no customization has been done should succeed.
The current comparisons are retained, so that it's likely on z/OS one or
the other will succeed when no customization is currently in place.