나는 실행 바이너리 _FORTIFY_SOURCE 및 스택 프로텍터와 같은 buildroot gcc 보안 빌드 옵션을 활성화하는 방법은 무엇입니까?
그래서 난 내 툴체인 GCC에 대한 구성을 구축 다음 활성화, https://github.com/slimm609/checksec.sh하여 검사를 통과해야하는 요구 사항을 충족 :_D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fstack-protector-all
하지만 출력 중에 경고 MSG를하지 않았다 내가 gcc 빌드를 사용할 때 경고 메시지를 적절하게 보여주었습니다.
[email protected]:~/tmp/test$ /opt/buildroot-gcc463/usr/bin/mipsel-buildroot-linux-uclibc-gcc -Wall -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now -fstack-protector-all -fpie -pie test.c -o testjason
더 경고 출력이 있었다 :
아래 내 빌드 로그했다.
는 빌드 툴체인을 위해, 난 단지 패키지/GCC/gcc.mk 파일에 libssp 활성화 :호스트 86 년 동안 GCC : 2 : 기능의 'memcpy가' '주'에서 인라인 파일에서 TEST.C에서 /usr/include/string.h:640:0, 에서 포함 test.c : 28 : 8 : /usr/include/x86_64-linux-gnu/bits/string3.h:51:3 : 경고 : 을 호출하십시오. __builtin___memcpy_chk는 항상 대상 버퍼를 오버플로합니다 [기본적으로 활성화 됨] return __builtin___memcpy_chk (__dest , __src, __len, __bos0 (__dest));^함수 'memset'에서 test.c의 'main'에서 인라인 된 : 35 : 8 : /usr/include/x86_64-linux-gnu/bits/string3.h:84:3 : 경고 : 으로 호출 __builtin___memset_chk will 항상 오버플로 대상 버퍼 [기본적으로 활성화 됨] return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
HOST_GCC_COMMON_CONF_OPT = \ --target = $ (GNU_TARGET_NAME) \ --with-SYSROOT = $ (STAGING_DIR) \ --disable -__ cxa_atexit \ --with-GNU-LD의 \ --enable-libssp \ --disable-multilib \ --with-gmp = $ (HOST_DIR)/usr \ --with-mpfr = $ (HOST_DIR)/usr –