Skip to content

Commit c1211d9

Browse files
committed
fix: add noexecstack linker flag for security hardening
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
1 parent 79345f9 commit c1211d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ifeq ($(DEB_BUILD_ARCH),sw_64)
88
endif
99

1010
ifneq ($(DEB_BUILD_ARCH), mips64el)
11-
export GOBUILD_OPTIONS=-ldflags '-linkmode=external -extldflags "-Wl,-z,relro,-z,now,-pie"'
11+
export GOBUILD_OPTIONS=-ldflags '-linkmode=external -extldflags "-Wl,-z,relro,-z,now,-pie,-z,noexecstack"'
1212
endif
1313

1414
%:

0 commit comments

Comments
 (0)