Skip to content

Conversation

@mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Dec 18, 2025

  1. Modified GOBUILD_OPTIONS in debian/rules to include additional security hardening flags
  2. Changed from "-pie" only to "-Wl,-z,relro,-z,now,-pie" for comprehensive security
  3. This change applies to all architectures except mips64el
  4. The new flags enable full RELRO (Relocation Read-Only) and BIND_NOW for immediate binding

Log: Improved binary security with additional hardening flags

Influence:

  1. Test that the package builds successfully on all supported architectures except mips64el
  2. Verify that the resulting binaries have proper security hardening enabled
  3. Check that the application functionality remains unchanged with the new linker flags
  4. Test on architectures where the change applies (non-mips64el) to ensure no regressions
  5. Verify that mips64el builds continue to use the original flags without changes

fix: 更新链接器标志以增强安全加固

  1. 修改 debian/rules 中的 GOBUILD_OPTIONS 以包含额外的安全加固标志
  2. 从仅使用 "-pie" 改为 "-Wl,-z,relro,-z,now,-pie" 以实现全面的安全保护
  3. 此更改适用于除 mips64el 之外的所有架构
  4. 新标志启用完整的 RELRO(重定位只读)和 BIND_NOW 以实现立即绑定

Log: 通过额外的加固标志提高了二进制文件的安全性

Influence:

  1. 测试软件包在除 mips64el 之外的所有支持架构上是否成功构建
  2. 验证生成的二进制文件是否启用了适当的安全加固
  3. 检查应用程序功能在使用新链接器标志后是否保持不变
  4. 在应用更改的架构(非 mips64el)上进行测试,确保没有回归问题
  5. 验证 mips64el 架构的构建是否继续使用原始标志而不受影响

PMS: BUG-339571

Summary by Sourcery

Build:

  • Adjust GOBUILD_OPTIONS in debian/rules to use hardened linker flags enabling RELRO and immediate binding on supported architectures other than mips64el.

1. Modified GOBUILD_OPTIONS in debian/rules to include additional
security hardening flags
2. Changed from "-pie" only to "-Wl,-z,relro,-z,now,-pie" for
comprehensive security
3. This change applies to all architectures except mips64el
4. The new flags enable full RELRO (Relocation Read-Only) and BIND_NOW
for immediate binding

Log: Improved binary security with additional hardening flags

Influence:
1. Test that the package builds successfully on all supported
architectures except mips64el
2. Verify that the resulting binaries have proper security hardening
enabled
3. Check that the application functionality remains unchanged with the
new linker flags
4. Test on architectures where the change applies (non-mips64el) to
ensure no regressions
5. Verify that mips64el builds continue to use the original flags
without changes

fix: 更新链接器标志以增强安全加固

1. 修改 debian/rules 中的 GOBUILD_OPTIONS 以包含额外的安全加固标志
2. 从仅使用 "-pie" 改为 "-Wl,-z,relro,-z,now,-pie" 以实现全面的安全保护
3. 此更改适用于除 mips64el 之外的所有架构
4. 新标志启用完整的 RELRO(重定位只读)和 BIND_NOW 以实现立即绑定

Log: 通过额外的加固标志提高了二进制文件的安全性

Influence:
1. 测试软件包在除 mips64el 之外的所有支持架构上是否成功构建
2. 验证生成的二进制文件是否启用了适当的安全加固
3. 检查应用程序功能在使用新链接器标志后是否保持不变
4. 在应用更改的架构(非 mips64el)上进行测试,确保没有回归问题
5. 验证 mips64el 架构的构建是否继续使用原始标志而不受影响

PMS: BUG-339571
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 18, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates Debian packaging build rules to strengthen linker security hardening for Go binaries by expanding the default PIE linker flags on all architectures except mips64el.

File-Level Changes

Change Details Files
Strengthen Go binary linker hardening flags in Debian build rules, with a conditional exception for mips64el.
  • Extend GOBUILD_OPTIONS to replace the simple -pie linker flag with -Wl,-z,relro,-z,now,-pie so built binaries use full RELRO and immediate binding.
  • Introduce or update architecture-conditional logic so that the new hardened linker flags are applied on all supported architectures except mips64el.
  • Preserve the original -pie-only linker behavior for mips64el builds to avoid compatibility or toolchain issues on that architecture.
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

@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个 git diff 进行详细的代码审查:

  1. 语法逻辑分析:
  • 修改的语法是正确的,符合 debian/rules 文件的格式要求
  • 条件判断逻辑 ifneq ($(DEB_BUILD_ARCH), mips64el) 保持不变,只是修改了导出变量的值
  1. 代码质量改进:
  • 新的 GOBUILD_OPTIONS 配置更加完整和规范
  • 使用了 -Wl, 前缀明确指定链接器选项,这是更标准的做法
  • 添加了额外的安全标志 -z,relro-z,now
  1. 代码性能影响:
  • 这些编译选项主要是安全相关的,对性能影响很小
  • -z,relro-z,now 可能会带来微小的启动时间开销,但安全性收益远大于性能损失
  1. 代码安全改进:
  • -z,relro:设置部分重定位只读,有助于防止某些类型的内存损坏攻击
  • -z,now:启用立即绑定,防止 GOT/PLT 劫持攻击
  • -pie:生成位置无关可执行文件,启用 ASLR(地址空间布局随机化)

建议:

  1. 这个改动是积极的,显著提升了二进制文件的安全性
  2. 建议添加注释说明这些编译选项的作用,便于后续维护
  3. 考虑是否需要为其他架构也添加类似的安全编译选项
  4. 建议在构建后验证这些安全选项是否正确应用(例如使用 readelf 或 checksec 工具)

总的来说,这是一个很好的安全增强改动,符合现代软件安全最佳实践。

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

[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 d7270a5 into linuxdeepin:master Dec 18, 2025
17 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