fix(punkbuster): start PunkBuster on CoD2 and WaW with glibc 2.41 and newer (#5140)
* fix(punkbuster): start PunkBuster on CoD2 and WaW with glibc 2.41 and newer
The PunkBuster libraries have no PT_GNU_STACK header, so on i386 they
need an executable stack. The Call of Duty 2 and World at War server
binaries don't have one. Since glibc 2.41 the loader refuses to dlopen
such a library into a process without an executable stack, so
PunkBuster failed to start. Call of Duty 2 quietly reset sv_punkbuster
to 0, and World at War logged "Unable to initialize punkbuster".
Set GLIBC_TUNABLES=glibc.rtld.execstack=2 in fix_cod2.sh and a new
fix_codwaw.sh, which restores the old behaviour for the server process.
Older glibc versions ignore the setting.
* fix(wet): add sv_punkbuster 0 to the default start parameters
Every other Quake 3 engine server with PunkBuster has +set sv_punkbuster 0
in startparameters, so PunkBuster is turned on the same way everywhere.
* fix(core): allow executable stack libraries for sfc, ts, vs and ut on glibc 2.41 and newer
Glibc 2.41 and newer refuses to load a shared library that asks for an
executable stack, so these servers exit at start with "cannot enable
executable stack as shared object requires: Invalid argument".
- sfc: sfclassic/bin/server.so and server_srv.so have an RWE GNU_STACK.
- ts, vs: the GoldSrc mod libraries have no GNU_STACK header.
- ut: four UE4 server libraries have an RWE GNU_STACK.
Set glibc.rtld.execstack=2 in the pre-start fix for each, as for cod2 and
codwaw. ts and vs get new fix modules. ut joins the pre-start fixes, and
its chmod now only runs when the executable is not already executable.
* fix(ut): remove the chmod from the Unreal Tournament fix
The server binary is executable in both the original archive and the
rebuilt one, so the chmod never had anything to do. It also printed a raw
command instead of the usual fix messages. The fix now only sets the
execstack tunable, so ut no longer needs to run it after install.