Date: Tue, 01 Oct 2019 23:44:31 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 240989] Linuxulator: futexes can't be shared between 32- and 64-bit applications Message-ID: <bug-240989-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240989 Bug ID: 240989 Summary: Linuxulator: futexes can't be shared between 32- and 64-bit applications Product: Base System Version: 12.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: iwtcex@gmail.com Here's a small example: #define _GNU_SOURCE #include <assert.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/mman.h> #include <linux/futex.h> #define SHM_FILE_PATH "/futex-bug" int main() { int fd =3D shm_open(SHM_FILE_PATH, O_CREAT | O_RDWR, 0777); assert(fd !=3D -1); ftruncate(fd, 4); int* addr =3D mmap(NULL, 4, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); assert(addr !=3D MAP_FAILED); close(fd); #ifdef WAIT struct timespec timeout =3D {.tv_sec =3D 1, .tv_nsec =3D 0}; int err =3D -1; do { err =3D syscall(SYS_futex, addr, FUTEX_WAIT, 0, &timeout, NULL, 0); if (err =3D=3D -1) { printf("FUTEX_WAIT: %d [%s]\n", err, strerror(errno));=20=20 } else { printf("FUTEX_WAIT: %d\n", err); } } while (err =3D=3D -1 && errno =3D=3D ETIMEDOUT); shm_unlink(SHM_FILE_PATH); #else int err =3D syscall(SYS_futex, addr, FUTEX_WAKE, 1, NULL, NULL, 0); printf("FUTEX_WAKE: %d\n", err); #endif return 0; } Compile this with: /compat/linux/bin/cc -DWAIT -m32 --sysroot=3D/compat/linux futex_bug.c -lrt= -o wait32 /compat/linux/bin/cc -m32 --sysroot=3D/compat/linux futex_bug.c -lrt= -o wake32 /compat/linux/bin/cc -m64 --sysroot=3D/compat/linux futex_bug.c -lrt= -o wake64 Run wait32, then try wake64 and wake32. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240989-227>