Skip to content

Systemtap on linux does not properly apply hardening CFLAGS when compiling using --with-dtrace #131865

Closed
@stratakis

Description

@stratakis

Bug report

Bug description:

When compiling using --with-dtrace, Linux uses the systemtap script which utilizes a common default CFLAGS set to provide the object file. When extra hardening flags are passed during the compilation through the build environment, dtrace is not capturing them, resulting in the final binary or shared library missing some protections.

This behavior was documented recently

Discovered when testing the -mbranch-protection=standard on aarch64 where pydtrace.o was missing the proper gnu property and the relevant hardware protections.

See https://bugzilla.redhat.com/show_bug.cgi?id=2350935

In order to fix that, adding the CFLAGS variable to the Makefile before the dtrace invocation resolves the issue.

On systems that use the original dtrace, changing the CFLAGS there should have no effects.

php dealt with a similar issue before, see:

php/php-src@717b367
php/php-src@475fd29
php/php-src@02b3fb1

CPython versions tested on:

CPython main branch, 3.14, 3.13, 3.12, 3.11, 3.10, 3.9

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions