chore: Update compiler flags for security enhancements#192
chore: Update compiler flags for security enhancements#192deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
Conversation
As title Log: Update compiler flags for security enhancements Bug: https://pms.uniontech.com/bug-view-342665.html
As title. Log: update version to 6.5.32
|
TAG Bot TAG: 6.5.32 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds hardened compiler/linker flags for Release builds and bumps the application package version across all architecture-specific metadata files. Flow diagram for enabling hardening flags in Release buildsflowchart TD
A[CMake configure] --> B{CMAKE_BUILD_TYPE}
B -->|Release| C[Enable build hardening]
B -->|Other| F[Use default flags]
C --> D[Set CMAKE_VERBOSE_MAKEFILE ON]
C --> E[Append hardened C and CXX flags]
C --> G[Append hardened linker flags]
E --> H[Compile with -Wdate-time, -D_FORTIFY_SOURCE=2, -g, -O2, -ffile-prefix-map, -fstack-protector-strong, -fstack-clash-protection, -Wformat, -Werror=format-security, -fcf-protection]
G --> I[Link with -Wl,-z,relro and -Wl,-z,now]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
CMAKE_BUILD_TYPE STREQUAL "Release"guard won’t work as expected for multi-config generators (e.g., Ninja Multi-Config, Visual Studio); consider using generator expressions or config-specific flags instead of relying onCMAKE_BUILD_TYPE. - Enabling
-g,-O2, andCMAKE_VERBOSE_MAKEFILEfor Release builds may not be desirable for all consumers; consider making these debug/diagnostic options configurable via cache variables or limiting them to non-Release configurations. - Directly appending compiler/linker flags to
CMAKE_C_FLAGS/CMAKE_CXX_FLAGS/CMAKE_EXE_LINKER_FLAGSmakes them global and harder to override; consider usingadd_compile_options()/target_compile_options()andtarget_link_options()scoped to relevant targets instead.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `CMAKE_BUILD_TYPE STREQUAL "Release"` guard won’t work as expected for multi-config generators (e.g., Ninja Multi-Config, Visual Studio); consider using generator expressions or config-specific flags instead of relying on `CMAKE_BUILD_TYPE`.
- Enabling `-g`, `-O2`, and `CMAKE_VERBOSE_MAKEFILE` for Release builds may not be desirable for all consumers; consider making these debug/diagnostic options configurable via cache variables or limiting them to non-Release configurations.
- Directly appending compiler/linker flags to `CMAKE_C_FLAGS`/`CMAKE_CXX_FLAGS`/`CMAKE_EXE_LINKER_FLAGS` makes them global and harder to override; consider using `add_compile_options()`/`target_compile_options()` and `target_link_options()` scoped to relevant targets instead.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这份代码 diff 主要展示了在 1. 语法与逻辑审查
2. 代码质量审查
3. 代码性能审查
4. 代码安全审查这是本次更改的核心部分,引入的标志极大地增强了二进制文件的安全性:
5. 改进建议总结
总体而言,这是一个非常高质量的安全加固补丁,引入的编译选项符合现代 Linux 安全标准(如 Debian 的安全编译规范)。只需在 CMake 代码的健壮性和跨平台性上稍作微调即可。 |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
|
TAG Bot ✅ Tag created successfully 📋 Tag Details
|
Summary by Sourcery
Enable additional hardening flags for release builds and bump the package version across architecture-specific metadata files.
Build:
Deployment: