Summary: | memcheck/tests/sem fails on s390x with glibc 2.34 | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Mark Wielaard <mark> |
Component: | memcheck | Assignee: | Julian Seward <jseward> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | arnez, fweimer, sam |
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Fix sys_ipc semtimedop for s390x |
Description
Mark Wielaard
2021-10-28 17:19:09 UTC
Note the following in glibc sysdeps/unix/sysv/linux/s390/ipc_priv.h: /* The s390 sys_ipc variant has only five parameters instead of six (as for default variant). The difference is the handling of SEMTIMEDOP where on s390 the third parameter is used as a pointer to a struct timespec where the generic variant uses fifth parameter. */ #undef SEMTIMEDOP_IPC_ARGS #define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ (__nsops), (__timeout), (__sops) So maybe we are hitting that? But why only with glibc 2.34? (In reply to Mark Wielaard from comment #1) > Note the following in glibc sysdeps/unix/sysv/linux/s390/ipc_priv.h: > [...] > So maybe we are hitting that? But why only with glibc 2.34? You're right that this is different on s390x. And since the difference is not handled in Valgrind, this can't work correctly, and probably never has. But as far as I know, the glibc doesn't normally exploit the sys_ipc variant, but uses the semtimedop syscall instead, if available. It is a bit curious why this would change in a newer glibc. Is there perhaps something wrong with the glibc configuration? Created attachment 146450 [details]
Fix sys_ipc semtimedop for s390x
Apart from a potential glibc configuration problem, Valgrind should be fixed as well. So this is a possible fix for the bad invocation of the sys_ipc semtimedop call on s390x platforms.
The patch looks good and I tested it on f34 (glibc-2.33-20.fc34.s390x) an f35 (glibc-2.34-25.fc35.s390x) perl tests/vg_regtest memcheck/tests/sem.vgtest succeeds before and after the patch with glibc 2.33 it fails before and succeeds after the patch with glibc 2.34 I don't know why on glibc 2.34 it looks like semtimedop goes through the ipc syscall multiplexer. I added Florian to the CC who might know if this was a deliberate change in glibc. I think for several releases, glibc used the semtimedop system call by mistake: it was only added to the kernel in Linux 5.1, so this led to compatibility problems. Pushed as commit 03a8b24ae362f13c7f97746f72f40240aeb5aade. |