ROCm / clr

MIT License
85 stars 35 forks source link

Consider marking the stack non-executable in assembly files #22

Closed AngryLoki closed 2 months ago

AngryLoki commented 8 months ago

Hi,

with GNU Binutils >=2.39 new warning were added into ld, indicating that hardware stack protection is disabled in some object files of hipamd.

Example warning is:

/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: warning: hipamd/src/hiprtc/hip_rtc_gen/hipRTC_header.o: missing .note.GNU-stack section implies executable stack
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Following https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart, please, consider adding .section .note.GNU-stack,"",%progbits to fix affected files:

!WX --- ---  ./clr-rocm-5.7.1_build/hipamd/src/hiprtc/hip_rtc_gen/hipRTC_header.o
RWX --- ---  ./clr-rocm-5.7.1_build/hipamd/lib/libhiprtc-builtins.so.5.7.31921
RWX --- ---  ./clr-rocm-5.7.1_build/hipamd/lib/libamdhip64.so.5.7.31921
RWX --- ---  ./clr-rocm-5.7.1_build/hipamd/lib/libhiprtc.so.5.7.31921
!WX --- ---  ./clr-rocm-5.7.1_build/hip_pch.o

Patch for Gentoo: https://github.com/gentoo/gentoo/blob/d3ef88d985b6656ddf42c3b202ada11a16e91e6c/dev-util/hip/files/hip-5.7.1-exec-stack.patch

cjatin commented 6 months ago

PR made it to develop https://github.com/ROCm/clr/commit/14cbd8d24cfcff724b82f78413e1c1440f356d4e

AngryLoki commented 2 months ago

Good, I see this in rocm-6.1.0 release, so I can close it.