linux-application-whitelisting / fapolicyd

File Access Policy Daemon
GNU General Public License v3.0
192 stars 55 forks source link

Fix 'error label at end of compound statement' #289

Closed radosroka closed 6 months ago

radosroka commented 6 months ago
radosroka commented 6 months ago

On almalinux8 and rockylinux8 the error was fixed but there is another 'undefined reference to `gettid''

stevegrubb commented 6 months ago

This looks bogus. gcc 13/14 is not complaining. The gettid needs to have _GNU_SOURCE passed which is in the Makefile.am fapolicyd_CFLAGS. Hmm...

radosroka commented 6 months ago
 /bin/sh ../libtool  --tag=CC   --mode=link gcc -fPIE -DPIE -pthread -g -W -Wall -Wshadow -Wundef -Wno-unused-result -Wno-unused-parameter -D_GNU_SOURCE  -g -O2 -pie -Wl,-z,relro -Wl,-z,now  -static  -o fapolicyd daemon/fapolicyd-fapolicyd.o daemon/fapolicyd-mounts.o daemon/fapolicyd-notify.o libfapolicyd.la -llmdb -lseccomp -lcap-ng -lmagic -lcrypto -ludev -lrpmio -lrpm 
libtool: link: gcc -fPIE -DPIE -pthread -g -W -Wall -Wshadow -Wundef -Wno-unused-result -Wno-unused-parameter -D_GNU_SOURCE -g -O2 -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -o fapolicyd daemon/fapolicyd-fapolicyd.o daemon/fapolicyd-mounts.o daemon/fapolicyd-notify.o  ./.libs/libfapolicyd.a -lpthread -llmdb -lseccomp -lcap-ng -lmagic -lcrypto -ludev -lrpmio -lrpm -pthread
daemon/fapolicyd-fapolicyd.o: In function `coredump_handler':
/__w/fapolicyd/fapolicyd/src/daemon/fapolicyd.c:213: undefined reference to `gettid'
collect2: error: ld returned 1 exit status
stevegrubb commented 6 months ago

Hmm...RHEL 8 man page says: Note: There is no glibc wrapper for this system call; see NOTES.

I guess we need to use syscall and add a configure test to detect if gettid is available and call it via syscall if not.

stevegrubb commented 6 months ago

I pushed commit 8567a53 that works around a missing gettid.

stevegrubb commented 6 months ago

OK, I understand the warning now. You have to compile with -Wpedantic to reproduce. The cause is a goto label with no statement afterwards. There are 2 fixes: 1) The code you have supplied. 2) goto rewind_out instead. Either way fixes it.