unix: If setuid or setgid, don't use GTK

GTK explicitly doesn't support being used setuid or setgid, and if SDL
loads and initializes GTK, GTK will exit the process if it
detects a setgid executable. This is incompatible with the historical
practice of making game executables setgid in order to write out a
shared high-score table on multi-user systems (which is security theatre
at best, because typical game runtime libraries are not hardened against
an untrusted caller, but making it regress would be a user-observable
regression in sdl2-compat).

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie
2025-12-28 13:42:49 +00:00
committed by Sam Lantinga
parent 9e0b31b297
commit b6f4e10bf9
3 changed files with 60 additions and 0 deletions

View File

@@ -1161,6 +1161,8 @@ if(SDL_LIBC)
check_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
check_symbol_exists(gethostname "unistd.h" HAVE_GETHOSTNAME)
check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
check_symbol_exists(getresgid "unistd.h" HAVE_GETRESGID)
check_symbol_exists(getresuid "unistd.h" HAVE_GETRESUID)
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)