diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-02-11 17:02:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-02-11 17:02:40 +0000 |
commit | 6fb19d011ac2361a9646e0ec30c0c711306b78e3 (patch) | |
tree | c2bcb393396769a32d717b7850fea86e7241ea34 /gnu/usr.bin | |
parent | 026ac575aa702625fbdbdfed303ad4b8a1f45b66 (diff) |
When clang was changed to -fcommon, perl's P_hash_{seed,state} variables
moved into BSS in the .o, with padding rules following the types -- they
are both char[]. Since P_hash_seed is (system-dependent) not a multiple of 8,
P_hash_state gets layed out misaligned, which sucks because the hash functions
demand 64-bit alignment for both variables. There is the possibility of using
misalignment macros, but this is not cheap. Could also use kernel-trap fault
repair, but the performance would really suck for something so crucial.
The correct fix would be for upstream to declare these types as uint64[],
we have requested that in https://github.com/Perl/perl5/issues/18555
In the meantime, carry a diff to roundup P_hash_seed to 64-bit alignment so that
P_hash_state will land aligned.
ok afresh1
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/perl/hv_func.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/usr.bin/perl/hv_func.h b/gnu/usr.bin/perl/hv_func.h index a519839d6c0..151aead9bf3 100644 --- a/gnu/usr.bin/perl/hv_func.h +++ b/gnu/usr.bin/perl/hv_func.h @@ -83,7 +83,8 @@ #define _PERL_HASH_FUNC "SBOX32_WITH_" __PERL_HASH_FUNC -#define _PERL_HASH_SEED_BYTES ( __PERL_HASH_SEED_BYTES + (int)( 3 * sizeof(U32) ) ) +#define _PERL_HASH_SEED_roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#define _PERL_HASH_SEED_BYTES ( _PERL_HASH_SEED_roundup(__PERL_HASH_SEED_BYTES + (int)( 3 * sizeof(U32)), sizeof(U64) ) ) #define _PERL_HASH_STATE_BYTES \ ( __PERL_HASH_STATE_BYTES + ( ( 1 + ( 256 * SBOX32_MAX_LEN ) ) * sizeof(U32) ) ) |