[Bug 1204317] New: shm_open segfaults in statically built program
https://bugzilla.suse.com/show_bug.cgi?id=1204317 Bug ID: 1204317 Summary: shm_open segfaults in statically built program Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.4 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: screening-team-bugs@suse.de Reporter: mkoutny@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- ## Reproducer: #include <assert.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> void dummy_handler(int signum) { } int main(int argc, char *argv[]) { int fd; struct sigaction sa = { .sa_handler = dummy_handler, }; sigaction(SIGINT, &sa, NULL); umask(0); fd = shm_open("/my.lock", O_CREAT | O_RDWR, S_IRWXU | S_IRWXO | S_IRWXG); assert(fd >= 0); return 0; } Static build like:
cc -pthread --std=gnu99 -g -c -o minimal.o minimal.c cc minimal.o -static -pthread -lm -lrt -o minimal
Dynamic build like:
cc -pthread --std=gnu99 -g -c -o minimal.o minimal.c cc minimal.o -static -pthread -lm -lrt -o minimal
## Expected behavior Statically built program exits with 0. ## Actual behavior The statically built program segfaults, I can only get this stacktrace:
(gdb) bt #0 0x0000000000000000 in ?? () #1 0x0000000000401077 in __shm_directory (len=0x7fffffffe290) at ../sysdeps/unix/sysv/linux/shm-directory.c:124 #2 0x0000000000400c32 in shm_open (name=0x4a81e4 "/my.lock", oflag=66, mode=511) at ../sysdeps/posix/shm_open.c:36 #3 0x0000000000400bb8 in main (argc=1, argv=0x7fffffffe4c8) at minimal.c:21
It looks to me like a problem with the internal "once" call implementation. ## Environment glibc-2.31-150300.41.1.x86_64 glibc-devel-2.31-150300.41.1.x86_64 glibc-devel-static-2.31-150300.41.1.x86_64 gcc-7-3.9.1.x86_64 (When I try the same on openSUSE TW with glibcs 2.36-6.1, it works as expected.) ## Misc A workaround [1] I didn't try. [1] https://stackoverflow.com/a/47914897 -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1204317 https://bugzilla.suse.com/show_bug.cgi?id=1204317#c1 --- Comment #1 from Michal Koutn� <mkoutny@suse.com> --- (In reply to Michal Koutn� from comment #0)
Dynamic build like:
cc -pthread --std=gnu99 -g -c -o minimal.o minimal.c cc minimal.o -static -pthread -lm -lrt -o minimal
Copy-paste mistake, there's no -static in both.
cc -pthread --std=gnu99 -g -c -o minimal.o minimal.c cc minimal.o -pthread -lm -lrt -o minimal
-- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1204317 Chenzi Cao <chcao@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|screening-team-bugs@suse.de |schwab@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com