Skip to content

Conversation

@wangrong1069
Copy link
Contributor

@wangrong1069 wangrong1069 commented Nov 26, 2025

As title

Log: Update compiler flags for security enhancements
Bug: https://pms.uniontech.com/bug-view-337059.html

Summary by Sourcery

Build:

  • Adjust Debian build rules to apply strengthened compiler security flags.

As title

Log: Update compiler flags for security enhancements
Bug: https://pms.uniontech.com/bug-view-337059.html
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 26, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates Debian packaging build rules to adjust compiler flags for improved security hardening during builds.

File-Level Changes

Change Details Files
Adjust compiler and/or linker flags in Debian packaging rules to strengthen security hardening of produced binaries.
  • Modify the debian/rules build configuration to inject additional security-related compiler flags (e.g., stack protection, FORTIFY_SOURCE, RELRO/PIE) or tighten existing ones.
  • Ensure the updated flags are applied during package build steps driven by debian/rules so resulting binaries follow the new security policy.
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 there - 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

deepin pr auto review

我来对这个 diff 进行审查:

  1. 语法逻辑:
  • 语法是正确的,符合 debian/rules 文件的格式要求
  • export DEB_LDFLAGS_APPEND = -Wl,-z,now 的写法是正确的,用于设置链接器标志
  1. 代码质量:
  • 这个修改是合理的,增加了 -Wl,-z,now 标志
  • 修改位置恰当,放在了其他环境变量设置之后,%: 规则之前
  1. 代码性能:
  • -z,now 标志会使链接器在程序启动时就解析所有动态符号,而不是延迟解析
  • 这可能会略微增加程序启动时间,但可以提高运行时性能,因为不需要在运行时进行符号解析
  • 这是一个合理的权衡,特别是对于安全敏感的应用
  1. 代码安全:
  • 这个修改提高了安全性
  • -z,now 标志可以防止某些类型的攻击,如 GOT(Global Offset Table)覆写攻击
  • 它确保所有符号解析在程序启动时完成,而不是延迟到运行时,这可以减少某些安全漏洞的利用可能性

改进建议:

  1. 考虑添加 -Wl,-z,relro 标志,它与 -z,now 配合使用可以提供更好的保护:

    export DEB_LDFLAGS_APPEND = -Wl,-z,now -Wl,-z,relro
    

    -z,relro 会让链接器设置部分 GOT 为只读,进一步增加安全性。

  2. 如果这个包特别关注安全性,还可以考虑添加其他安全相关的链接器标志,如:

    export DEB_LDFLAGS_APPEND = -Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,nodlopen
    
  3. 建议在修改上方添加注释,说明为什么需要这些标志:

    # Security hardening flags
    export DEB_LDFLAGS_APPEND = -Wl,-z,now
    

总的来说,这是一个好的修改,提高了安全性,只需要考虑是否要添加更多的安全标志来进一步增强安全性。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, wangrong1069

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

@wangrong1069
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit d5ba82a into linuxdeepin:master Nov 26, 2025
18 checks passed
@wangrong1069 wangrong1069 deleted the pr1126 branch November 26, 2025 09:07
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