Skip to content

ci: add libc++ hardening, libstdc++ assertions, and UBSan - #6310

Merged
rwgk merged 1 commit into
pybind:masterfrom
henryiii:ci/hardening-ubsan
Nov 27, 2026
Merged

rwgk merged 1 commit into
pybind:masterfrom
henryiii:ci/hardening-ubsan

Conversation

@henryiii

@henryiii henryiii commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Description

Adds standard library and undefined-behavior checks to existing CI jobs:

  • macOS 3.14 (C++14) and 3.14t (C++20): _LIBCPP_HARDENING_MODE_DEBUG.
  • GCC 13: _GLIBCXX_ASSERTIONS and -fsanitize=undefined -fno-sanitize-recover=all. UBSan is on GCC because GCC links the UBSan runtime into shared modules, so no preload is needed.

UBSan found two misaligned references:

I ran these configurations locally: libc++ hardening with Apple clang, UBSan with Apple clang, and the GCC 13 job in Docker with the same flags.

@henryiii
henryiii marked this pull request as ready for review November 25, 2026 05:05
Two macOS jobs use libc++ debug hardening. The GCC 13 job uses
_GLIBCXX_ASSERTIONS and UBSan.

Fix a test that bound a reference to a member of a packed struct.

Assisted-by: ClaudeCode:claude-opus-5-5

@rwgk rwgk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex: no findings

@rwgk
rwgk merged commit e85d6e4 into pybind:master Nov 27, 2026
94 checks passed
@rwgk
rwgk deleted the ci/hardening-ubsan branch November 27, 2026 07:29
@github-actions github-actions Bot added the needs changelog Possibly needs a changelog entry label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs changelog Possibly needs a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants