Skip to content

Commit 8dfa343

Browse files
committed
create glibc check override
1 parent f99ac4f commit 8dfa343

3 files changed

Lines changed: 36 additions & 4 deletions

File tree

.github/actions/verify-glibc-baseline/action.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: Shared library filename to verify
1010
required: false
1111
default: liblance_c.so
12+
workflow_type:
13+
description: Workflow type
14+
required: false
15+
default: dev
1216
runs:
1317
using: composite
1418
steps:
@@ -28,15 +32,25 @@ runs:
2832
echo "Verifying file: $target_so"
2933
3034
objdump_output=$(objdump -p "$target_so")
31-
printf '%s\n' "$objdump_output" | grep -A 10 "Version References:" || true
35+
printf '%s\n' "$objdump_output" | grep -A 10 "Version References: (truncated to first 10)" || true
3236
3337
version_gt() {
34-
[ "$(printf '%s\n%s\n' "$2" "$1" | sort -V | tail -n1)" = "$1" ] && [ "$1" != "$2" ]
38+
[ "$1" = "$2" ] && return 1
39+
[ "$(printf '%s\n%s\n' "$1" "$2" | sort -V | tail -n1)" = "$1" ]
3540
}
3641
3742
while IFS= read -r version; do
3843
if version_gt "$version" "$baseline"; then
39-
echo "::error::GLIBC Leak Detected! The binary contains symbols newer than GLIBC ${baseline}."
44+
{
45+
echo "## GLIBC baseline violation"
46+
echo "One or more symbols in \`$SEARCH_ROOT\` exceed the **$GLIBC_BASELINE** floor."
47+
echo "Run \`objdump -T <binary> | grep GLIBC_\` to identify the offending symbols."
48+
49+
if [ "${{ inputs.workflow_type }}" = "release" ]; then
50+
echo "To override in an emergency, re-dispatch with \`skip_glibc_check=true\`."
51+
fi
52+
} >> "$GITHUB_STEP_SUMMARY"
53+
echo "::error title=GLIBC baseline violated::See job summary for details."
4054
exit 1
4155
fi
4256
done < <(printf '%s\n' "$objdump_output" | grep -oE 'GLIBC_[0-9]+(\.[0-9]+)+' | sed 's/^GLIBC_//' | sort -Vu)

.github/workflows/release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
version:
99
description: "Version to build (without leading 'v')"
1010
required: true
11+
skip_glibc_check:
12+
description: "Emergency override: skip GLIBC baseline check (set to 'true' only if intentional)"
13+
required: false
14+
default: 'false'
1115

1216
permissions:
1317
contents: write # needed for softprops/action-gh-release
@@ -87,10 +91,17 @@ jobs:
8791
- name: Install to staging prefix
8892
run: cmake --install build --prefix stage
8993
- name: Verify GLIBC Baseline
90-
if: matrix.os_label == 'linux'
94+
if: matrix.os_label == 'linux' && inputs.skip_glibc_check != 'true'
9195
uses: ./.github/actions/verify-glibc-baseline
9296
with:
9397
search_root: ${{ github.workspace }}/stage
98+
workflow_type: release
99+
- name: Annotate skipped GLIBC check
100+
if: matrix.os_label == 'linux' && inputs.skip_glibc_check == 'true'
101+
run: |
102+
echo "::warning title=GLIBC check skipped::skip_glibc_check=true was set — this release may exceed the GLIBC_BASELINE (${{ env.GLIBC_BASELINE }}) floor. Audit the artifact before distributing."
103+
echo "## ⚠️ GLIBC baseline check was skipped" >> "$GITHUB_STEP_SUMMARY"
104+
echo "skip_glibc_check=true was set on this run. The artifact may link symbols above **${{ env.GLIBC_BASELINE }}**." >> "$GITHUB_STEP_SUMMARY"
94105
- name: Tar
95106
id: pack
96107
run: |

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ project(LanceC
2121
LANGUAGES C CXX
2222
)
2323

24+
if(NOT DEFINED CMAKE_C_STANDARD OR CMAKE_C_STANDARD LESS 11)
25+
set(CMAKE_C_STANDARD 11)
26+
endif()
27+
set(CMAKE_C_STANDARD_REQUIRED ON)
28+
set(CMAKE_C_EXTENSIONS OFF)
29+
2430
if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 20)
2531
set(CMAKE_CXX_STANDARD 20)
2632
endif()
2733
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2834
set(CMAKE_CXX_EXTENSIONS OFF)
35+
2936
set(CMAKE_C_VISIBILITY_PRESET hidden)
3037
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
3138
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

0 commit comments

Comments
 (0)