Skip to content

Commit

Permalink
i#6693 SIGFPE-glibc-2-39: Update workaround offsets
Browse files Browse the repository at this point in the history
Adds a check for glibc 2.39 on x64. x86 values are left unchanged.

Fixes #6693
  • Loading branch information
MikeWalrus committed Mar 7, 2024
1 parent 9591e25 commit 0c8ea55
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions core/unix/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,21 @@ privload_os_finalize(privmod_t *privmod)
SYSLOG_INTERNAL_WARNING("glibc 2.34+ i#5437 workaround failed: missed glro");
return;
}
int GLRO_dl_tls_static_size_OFFS;
int GLRO_dl_tls_static_align_OFFS;
# ifdef X64
const int GLRO_dl_tls_static_size_OFFS = 0x2a8;
const int GLRO_dl_tls_static_align_OFFS = 0x2b0;
// The offsets changed between 2.38 and 2.39.
if (ver[2] == '3' && ver[3] < '9') {
GLRO_dl_tls_static_size_OFFS = 0x2a8;
GLRO_dl_tls_static_align_OFFS = 0x2b0;
} else {
GLRO_dl_tls_static_size_OFFS = 0x2c8;
GLRO_dl_tls_static_align_OFFS = 0x2d0;
}
# else
// The offsets changed between 2.35 and 2.36.
const int GLRO_dl_tls_static_size_OFFS =
(ver[2] == '3' && ver[3] == '5') ? 0x328 : 0x31c;
const int GLRO_dl_tls_static_align_OFFS =
(ver[2] == '3' && ver[3] == '5') ? 0x32c : 0x320;
GLRO_dl_tls_static_size_OFFS = (ver[2] == '3' && ver[3] == '5') ? 0x328 : 0x31c;
GLRO_dl_tls_static_align_OFFS = (ver[2] == '3' && ver[3] == '5') ? 0x32c : 0x320;
# endif
size_t val = 4096, written;
if (!safe_write_ex(glro + GLRO_dl_tls_static_size_OFFS, sizeof(val), &val,
Expand Down

0 comments on commit 0c8ea55

Please sign in to comment.