Skip to content

debian/rules: add full OpenSSF compiler hardening baseline#40

Open
xq9mend wants to merge 1 commit into
sonic-net:masterfrom
xq9mend:fix/gcc-hardening-openssf
Open

debian/rules: add full OpenSSF compiler hardening baseline#40
xq9mend wants to merge 1 commit into
sonic-net:masterfrom
xq9mend:fix/gcc-hardening-openssf

Conversation

@xq9mend

@xq9mend xq9mend commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Enable compiler and linker hardening flags aligned with the OpenSSF Compiler Options Hardening Guide for C and C++.

Work item tracking
  • Microsoft ADO:

How I did it

Add to debian/rules:

  • hardening=+all,+bindnow: full RELRO, stack-protector-strong, format checks, PIE
  • FORTIFY_SOURCE=3: upgraded from dpkg default of 2
  • _GLIBCXX_ASSERTIONS: C++ stdlib bounds checking
  • -fstack-clash-protection: stack clash mitigation
  • -fcf-protection=full (amd64) / -mbranch-protection=standard (arm64): CFI
  • Production safety flags: -fno-delete-null-pointer-checks, -fno-strict-overflow, -fno-strict-aliasing, -ftrivial-auto-var-init=zero (GCC >= 12 only)
  • Linker: -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,--as-needed

How to verify it

CI build passes. Verify with objdump -d or checksec on produced binaries.

Description for the changelog

enable OpenSSF compiler hardening baseline

Link to config_db schema for YANG changes

N/A

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@xq9mend

xq9mend commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

cc @FengPan-Frank — requesting your review on this OpenSSF compiler hardening change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants