Verify debug info for first-party release binaries
This commit is contained in:
3 files changed
+57
-12
No files matched your search
@@ -7,7 +7,7 @@ if [[ $# != 1 ]]; then
|
||||
fi
|
||||
|
||||
source_root=$(realpath -e -- "$1")
|
||||
for command_name in cmake ldd patchelf readelf python3; do
|
||||
for command_name in cmake ldd patchelf readelf python3 strip; do
|
||||
command -v "$command_name" >/dev/null || {
|
||||
echo "missing test command: $command_name" >&2
|
||||
exit 2
|
||||
@@ -93,7 +93,7 @@ for variant in preferred other; do
|
||||
preferred) variant_lib=$preferred_lib ;;
|
||||
other) variant_lib=$other_lib ;;
|
||||
esac
|
||||
"$c_compiler" -fPIC -shared "$temporary/dependency.c" \
|
||||
"$c_compiler" -g -fPIC -shared "$temporary/dependency.c" \
|
||||
'-DECHOION_VARIANT="'"$variant"'-runtime"' \
|
||||
-Wl,-soname,libechoion-dependency.so.1 \
|
||||
-o "$variant_lib/libechoion-dependency.so.1.2.3"
|
||||
@@ -121,7 +121,7 @@ for variant in seeded resolver; do
|
||||
"$variant_lib/libstdc++.so.6"
|
||||
done
|
||||
resolver_core="$resolver/Echoion.ts"
|
||||
"$c_compiler" -fPIC -shared "$temporary/core.c" \
|
||||
"$c_compiler" -g -fPIC -shared "$temporary/core.c" \
|
||||
-L"$preferred_lib" -lechoion-dependency \
|
||||
-Wl,-l:libstdc++.so.6 \
|
||||
-Wl,-soname,Echoion.ts \
|
||||
@@ -130,11 +130,11 @@ resolver_core="$resolver/Echoion.ts"
|
||||
install -m 0644 "$resolver_core" "$bundle/lib/Echoion.ts"
|
||||
patchelf --set-rpath "\$ORIGIN" "$bundle/lib/Echoion.ts"
|
||||
bundle_plugin="$bundle/share/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so"
|
||||
"$c_compiler" -fPIC -shared "$temporary/plugin.c" \
|
||||
"$c_compiler" -g -fPIC -shared "$temporary/plugin.c" \
|
||||
-L"$preferred_lib" -lechoion-dependency \
|
||||
-Wl,-rpath,"$preferred_lib" \
|
||||
-o "$bundle_plugin"
|
||||
"$c_compiler" "$temporary/main.c" -o "$bundle/bin/echoiond"
|
||||
"$c_compiler" -g "$temporary/main.c" -o "$bundle/bin/echoiond"
|
||||
install -m 0755 "$bundle/bin/echoiond" "$bundle/bin/echoion-updater"
|
||||
printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in"
|
||||
printf '%s\n' '<!doctype html><title>Echoion</title>' \
|
||||
@@ -176,6 +176,18 @@ assert module.is_system_dependency("libc.so.6")
|
||||
assert module.is_system_dependency("libm.so.6")
|
||||
assert not module.is_system_dependency("libc.so.evil")
|
||||
assert not module.is_system_dependency("libm.so.99")
|
||||
root = Path("/release")
|
||||
plugins = {
|
||||
root / "share/echoion/bootstrap-plugins/example/1.0.0/example.so"
|
||||
}
|
||||
assert module.is_first_party_payload(root / "bin/echoiond", root, plugins)
|
||||
assert module.is_first_party_payload(root / "lib/Echoion.ts", root, plugins)
|
||||
assert module.is_first_party_payload(root / "lib/libechoion-host.so.2.0.0", root, plugins)
|
||||
assert module.is_first_party_payload(root / "lib/libVoid_Plugin.so", root, plugins)
|
||||
assert module.is_first_party_payload(root / "lib/libVoidTeamspeak.so", root, plugins)
|
||||
assert module.is_first_party_payload(next(iter(plugins)), root, plugins)
|
||||
assert not module.is_first_party_payload(root / "lib/libacl.so.1.1.2301", root, plugins)
|
||||
assert not module.is_first_party_payload(root / "lib/libqjs.so.0.11.0", root, plugins)
|
||||
|
||||
unknown_abi = """
|
||||
Version needs section '.gnu.version_r' contains 1 entry:
|
||||
@@ -222,6 +234,16 @@ fi
|
||||
report="$temporary/dependencies.txt"
|
||||
python3 "$source_root/scripts/validate-release-elf.py" \
|
||||
--root "$bundle" --max-glibc 2.35 --report "$report"
|
||||
python3 "$source_root/scripts/validate-release-elf.py" \
|
||||
--root "$bundle" --require-first-party-debug-info >/dev/null
|
||||
cp "$bundle/lib/Echoion.ts" "$temporary/Echoion.ts.debug"
|
||||
strip --strip-debug "$bundle/lib/Echoion.ts"
|
||||
if python3 "$source_root/scripts/validate-release-elf.py" \
|
||||
--root "$bundle" --require-first-party-debug-info >/dev/null 2>&1; then
|
||||
echo "first-party ELF without debug information passed validation" >&2
|
||||
exit 1
|
||||
fi
|
||||
install -m 0644 "$temporary/Echoion.ts.debug" "$bundle/lib/Echoion.ts"
|
||||
if python3 "$source_root/scripts/validate-release-elf.py" \
|
||||
--root "$bundle" \
|
||||
--forbid-content-prefix /tmp/echoion-forbidden-build-path \
|
||||
|
||||
Reference in new issue
Block a user