[PATCH] D124212: [sanitizer] Use canonical syscalls everywhere
Ulrich Weigand via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 09:46:54 PDT 2022
uweigand added a comment.
In D124212#3480335 <https://reviews.llvm.org/D124212#3480335>, @eugenis wrote:
> Thanks. Ulrich, could you help me with the s390 failures? I can reland with a `#define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS !SANITIZER_S390` for now, but it would be great to remove the non-canonical code path completely.
Looks like the problem is in `internal_fork`. This code path:
return internal_syscall(SYSCALL(clone), SIGCHLD, 0);
fails on s390x because the low-level `clone` syscall interface is different between architectures. To quote the Linux manpage:
The raw system call interface on x86-64 and some other architectures (including sh, tile, and alpha) is roughly:
long clone(unsigned long flags, void *child_stack,
int *ptid, int *ctid,
unsigned long newtls);
[... ]
On the cris and s390 architectures, the order of the first two arguments is reversed:
long clone(void *child_stack, unsigned long flags,
int *ptid, int *ctid,
unsigned long newtls);
This means that instead of passing NULL as child stack pointer, we're passing SIGCHLD (0x11), and so the child crashes when accessing the stack.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124212/new/
https://reviews.llvm.org/D124212
More information about the llvm-commits
mailing list