Skip to content

Conversation

@mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Dec 31, 2025

The change adds the -z,noexecstack flag to the linker options in the Debian build rules. This flag marks the stack as non- executable, providing additional security hardening against stack- based buffer overflow attacks. The flag is added conditionally for all architectures except mips64el, maintaining the existing security flags (-z,relro,-z,now,-pie) while enhancing protection.

Influence:

  1. Verify the binary is built with the new linker flags by checking the ELF program headers (e.g., using readelf -l)
  2. Ensure the stack is marked as non-executable in the built executable
  3. Test that the application functions correctly with the new security hardening
  4. Confirm the build process completes successfully for all supported architectures except mips64el

fix: 为安全加固添加 noexecstack 链接器标志

此更改在 Debian 构建规则中向链接器选项添加了 -z,noexecstack 标志。该
标志将堆栈标记为不可执行,针对基于堆栈的缓冲区溢出攻击提供了额外的安全
加固。该标志有条件地添加到除 mips64el 外的所有架构,在保持现有安全标志
(-z,relro,-z,now,-pie)的同时增强了保护。

Influence:

  1. 通过检查 ELF 程序头(例如使用 readelf -l)验证二进制文件是否使用新 的链接器标志构建
  2. 确保构建的可执行文件中堆栈被标记为不可执行
  3. 测试应用程序在新的安全加固下功能正常
  4. 确认除 mips64el 外所有支持的架构的构建过程成功完成

PMS: BUG-339571

Summary by Sourcery

Build:

  • Add the -z,noexecstack linker flag to Debian build rules while preserving existing security-related linker options and excluding mips64el where necessary.

The change adds the `-z,noexecstack` flag to the linker options
in the Debian build rules. This flag marks the stack as non-
executable, providing additional security hardening against stack-
based buffer overflow attacks. The flag is added conditionally for all
architectures except mips64el, maintaining the existing security flags
(-z,relro,-z,now,-pie) while enhancing protection.

Influence:
1. Verify the binary is built with the new linker flags by checking the
ELF program headers (e.g., using `readelf -l`)
2. Ensure the stack is marked as non-executable in the built executable
3. Test that the application functions correctly with the new security
hardening
4. Confirm the build process completes successfully for all supported
architectures except mips64el

fix: 为安全加固添加 noexecstack 链接器标志

此更改在 Debian 构建规则中向链接器选项添加了 `-z,noexecstack` 标志。该
标志将堆栈标记为不可执行,针对基于堆栈的缓冲区溢出攻击提供了额外的安全
加固。该标志有条件地添加到除 mips64el 外的所有架构,在保持现有安全标志
(-z,relro,-z,now,-pie)的同时增强了保护。

Influence:
1. 通过检查 ELF 程序头(例如使用 `readelf -l`)验证二进制文件是否使用新
的链接器标志构建
2. 确保构建的可执行文件中堆栈被标记为不可执行
3. 测试应用程序在新的安全加固下功能正常
4. 确认除 mips64el 外所有支持的架构的构建过程成功完成

PMS: BUG-339571
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 31, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds the -z,noexecstack linker flag to the Debian build rules to mark the stack as non-executable for all architectures except mips64el, while preserving existing hardening flags.

File-Level Changes

Change Details Files
Introduce conditional -z,noexecstack linker flag in Debian packaging build rules for security hardening.
  • Extend linker options to include -z,noexecstack alongside existing -z,relro,-z,now,-pie flags
  • Gate use of -z,noexecstack so it is applied on all supported architectures except mips64el
  • Ensure resulting binaries can be validated via ELF program headers to confirm non-executable stack
debian/rules

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mhduiy mhduiy merged commit c1211d9 into linuxdeepin:master Jan 5, 2026
13 checks passed
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.

3 participants