Mailing List Archive

Does anyone know what MP_NEED_HASH_SEED_FIXUP is for?
The reason I ask is that it is broken as of perl 5.33.7 and it looks
like it will remain that way. See:
https://github.com/Perl/perl5/issues/18617

The problem is that the assignment to PL_hash_seed done in
modperl_hash_seed_set() is no longer possible, and there is a
suggestion that it was terribly wrong of mod_perl to be doing this
anyway so the bug is really in mod_perl, not the perl change that
causes the build breakage.

If nobody knows any better than I'm inclined to apply the following
diff to simply switch off MP_NEED_HASH_SEED_FIXUP for perl 5.33.7 and
higher:

Index: src/modules/perl/modperl_perl.c
===================================================================
--- src/modules/perl/modperl_perl.c (revision 1887671)
+++ src/modules/perl/modperl_perl.c (working copy)
@@ -210,7 +210,10 @@
}
}

-#if !(MP_PERL_VERSION_AT_MOST(5, 8, 0)) && \
+/* The need for MP_NEED_HASH_SEED_FIXUP is unclear, and it no longer works as
+ * of Perl 5.33.7 anyway: See https://github.com/Perl/perl5/issues/18617 */
+#if (!(MP_PERL_VERSION_AT_MOST(5, 8, 0)) && \
+ MP_PERL_VERSION_AT_MOST(5, 33, 6)) && \
(defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT))
#define MP_NEED_HASH_SEED_FIXUP
#endif

Using Apache 2.4.46 and mod_perl 2.0.11 on Windows 10 with VS2019 x64
I get the following test failures from a build with perl 5.33.6:

t\filter\in_bbs_inject_header.t (Wstat: 0 Tests: 36 Failed: 3)
Failed tests: 22, 26, 30
t\modperl\env.t (Wstat: 0 Tests: 164 Failed: 17)
Failed tests: 25, 28, 31, 43, 46, 49, 55, 58, 73, 82
85, 88, 91, 97, 142, 145, 163
t\modperl\setupenv.t (Wstat: 0 Tests: 63 Failed: 6)
Failed tests: 8, 22, 29, 36, 50, 57
t\preconnection\note.t (Wstat: 0 Tests: 1 Failed: 1)
Failed test: 1

As of 5.33.7, the build now fails:

modperl_perl.c(271): error C2102: '&' requires l-value

But with the above patch applied the build works again, and I actually
have fewer test failures!:

t\modperl\env.t (Wstat: 0 Tests: 158 Failed: 17)
Failed tests: 25, 28, 31, 43, 46, 49, 55, 58, 67, 76
79, 82, 85, 91, 136, 139, 157
t\preconnection\note.t (Wstat: 0 Tests: 1 Failed: 1)
Failed test: 1

Please can people test this patch on other setups and report whether
it causes any breakage.

And if anyone can remember what this hash seed fix-up was intended to
do then it would be interesting to hear. I worry that something that I
haven't tested may be requiring it.

The Changes file has this to say about it:

"perl 5.8.1 randomizes the hash seed, because we precalculate the hash
values of mgv elements the hash seed has to be the same across all
perl interpreters. So mod_perl now intercepts cases where perl would
have randomize it, do the seed randomization by itself and tell perl
to use that value."

That change is rev. 70047 in SVN (30 July 2003), but the commit
comment is just the same as the Changes comment above. No tests seem
to have been added, and I don't have an example of anything that
requires this fix-up in order to work.

Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Does anyone know what MP_NEED_HASH_SEED_FIXUP is for? [ In reply to ]
Hi Steve,

I remember the original problem with rand(), but not what this change was
about. There used to be a problem with all mod_perl child processes
producing the same series of random numbers, because the seed was
initialized before forking. This sounds like a different problem.

- Perrin

On Mon, Mar 15, 2021 at 9:58 AM Steve Hay
<steve.m.hay@googlemail.com.invalid> wrote:

> The reason I ask is that it is broken as of perl 5.33.7 and it looks
> like it will remain that way. See:
> https://github.com/Perl/perl5/issues/18617
>
> The problem is that the assignment to PL_hash_seed done in
> modperl_hash_seed_set() is no longer possible, and there is a
> suggestion that it was terribly wrong of mod_perl to be doing this
> anyway so the bug is really in mod_perl, not the perl change that
> causes the build breakage.
>
> If nobody knows any better than I'm inclined to apply the following
> diff to simply switch off MP_NEED_HASH_SEED_FIXUP for perl 5.33.7 and
> higher:
>
> Index: src/modules/perl/modperl_perl.c
> ===================================================================
> --- src/modules/perl/modperl_perl.c (revision 1887671)
> +++ src/modules/perl/modperl_perl.c (working copy)
> @@ -210,7 +210,10 @@
> }
> }
>
> -#if !(MP_PERL_VERSION_AT_MOST(5, 8, 0)) && \
> +/* The need for MP_NEED_HASH_SEED_FIXUP is unclear, and it no longer
> works as
> + * of Perl 5.33.7 anyway: See https://github.com/Perl/perl5/issues/18617
> */
> +#if (!(MP_PERL_VERSION_AT_MOST(5, 8, 0)) && \
> + MP_PERL_VERSION_AT_MOST(5, 33, 6)) && \
> (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT))
> #define MP_NEED_HASH_SEED_FIXUP
> #endif
>
> Using Apache 2.4.46 and mod_perl 2.0.11 on Windows 10 with VS2019 x64
> I get the following test failures from a build with perl 5.33.6:
>
> t\filter\in_bbs_inject_header.t (Wstat: 0 Tests: 36 Failed: 3)
> Failed tests: 22, 26, 30
> t\modperl\env.t (Wstat: 0 Tests: 164 Failed: 17)
> Failed tests: 25, 28, 31, 43, 46, 49, 55, 58, 73, 82
> 85, 88, 91, 97, 142, 145, 163
> t\modperl\setupenv.t (Wstat: 0 Tests: 63 Failed: 6)
> Failed tests: 8, 22, 29, 36, 50, 57
> t\preconnection\note.t (Wstat: 0 Tests: 1 Failed: 1)
> Failed test: 1
>
> As of 5.33.7, the build now fails:
>
> modperl_perl.c(271): error C2102: '&' requires l-value
>
> But with the above patch applied the build works again, and I actually
> have fewer test failures!:
>
> t\modperl\env.t (Wstat: 0 Tests: 158 Failed: 17)
> Failed tests: 25, 28, 31, 43, 46, 49, 55, 58, 67, 76
> 79, 82, 85, 91, 136, 139, 157
> t\preconnection\note.t (Wstat: 0 Tests: 1 Failed: 1)
> Failed test: 1
>
> Please can people test this patch on other setups and report whether
> it causes any breakage.
>
> And if anyone can remember what this hash seed fix-up was intended to
> do then it would be interesting to hear. I worry that something that I
> haven't tested may be requiring it.
>
> The Changes file has this to say about it:
>
> "perl 5.8.1 randomizes the hash seed, because we precalculate the hash
> values of mgv elements the hash seed has to be the same across all
> perl interpreters. So mod_perl now intercepts cases where perl would
> have randomize it, do the seed randomization by itself and tell perl
> to use that value."
>
> That change is rev. 70047 in SVN (30 July 2003), but the commit
> comment is just the same as the Changes comment above. No tests seem
> to have been added, and I don't have an example of anything that
> requires this fix-up in order to work.
>
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
>
>