Sfoglia il codice sorgente

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.
Daniel Gibbs 3 giorni fa
parent
commit
b40200901f

+ 1 - 1
lgsm/config-default/config-lgsm/wetserver/_default.cfg

@@ -9,7 +9,7 @@
 #### Game Server Settings ####
 
 ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
-startparameters="+set net_strict 1 +set fs_homepath ${serverfiles} +exec ${servercfg}"
+startparameters="+set sv_punkbuster 0 +set net_strict 1 +set fs_homepath ${serverfiles} +exec ${servercfg}"
 
 ## Extra Parameters | https://docs.linuxgsm.com/configuration/start-parameters#extra-parameters
 # Added to the end of startparameters.

+ 15 - 0
lgsm/modules/core_modules.sh

@@ -428,6 +428,11 @@ fix_coduo.sh() {
 	fn_fetch_module
 }
 
+fix_codwaw.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_csgo.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module
@@ -568,6 +573,11 @@ fix_tf2.sh() {
 	fn_fetch_module
 }
 
+fix_ts.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_ts3.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module
@@ -598,6 +608,11 @@ fix_vh.sh() {
 	fn_fetch_module
 }
 
+fix_vs.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_wurm.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module

+ 2 - 2
lgsm/modules/fix.sh

@@ -53,8 +53,8 @@ fn_apply_fix() {
 	fi
 }
 
-apply_pre_start_fix=(arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts3 mcb mohaa mta unt vh wurm xnt zmr)
-apply_post_install_fix=(av kf kf2 nd ro ut2k4 ut ut3)
+apply_pre_start_fix=(arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo codwaw ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts ts3 mcb mohaa mta unt ut vh vs wurm xnt zmr)
+apply_post_install_fix=(av kf kf2 nd ro ut2k4 ut3)
 
 # validate registered fixes for safe development
 for fix in "${apply_pre_start_fix[@]}" "${apply_post_install_fix[@]}"; do

+ 1 - 0
lgsm/modules/fix_cod2.sh

@@ -9,6 +9,7 @@
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}"
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"
 
 if ldd "${executabledir}/cod2_lnxded" 2>&1 | grep -q "libstdc++\.so\.5 => not found"; then
 	# shellcheck disable=SC2034 # Used by fn_fix_msg_start_nl and fn_fix_msg_end.

+ 11 - 0
lgsm/modules/fix_codwaw.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_codwaw.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with Call of Duty: World at War.
+
+# shellcheck disable=SC2034 # Used by the module loader.
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"

+ 2 - 0
lgsm/modules/fix_sfc.sh

@@ -7,6 +7,8 @@
 
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"
+
 if [ ! -f "${serverfiles}/bin/datacache.so" ]; then
 	ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so"
 fi

+ 11 - 0
lgsm/modules/fix_ts.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_ts.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with The Specialists.
+
+# shellcheck disable=SC2034 # Used by the module loader.
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"

+ 2 - 4
lgsm/modules/fix_ut.sh

@@ -5,9 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Resolves issues with Unreal Tournament.
 
+# shellcheck disable=SC2034 # Used by the module loader.
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-#Set Binary Executable
-echo -e "chmod +x ${executabledir}/${executable}"
-chmod +x "${executabledir}/${executable}"
-fn_sleep_time
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"

+ 11 - 0
lgsm/modules/fix_vs.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_vs.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with Vampire Slayer.
+
+# shellcheck disable=SC2034 # Used by the module loader.
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"