Path: blob/main/sys/contrib/openzfs/scripts/paxcheck.sh
48261 views
#!/bin/sh12if ! command -v scanelf > /dev/null; then3echo "scanelf (from pax-utils) is required for these checks." >&24exit 35fi67RET=089# check for exec stacks10OUT=$(scanelf -qyRAF '%e %p' "$1")1112if [ x"${OUT}" != x ]; then13RET=214echo "The following files contain writable and executable sections"15echo " Files with such sections will not work properly (or at all!) on some"16echo " architectures/operating systems."17echo " For more information, see:"18echo " https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart"19echo20echo "${OUT}"21echo22fi232425# check for TEXTRELS26OUT=$(scanelf -qyRAF '%T %p' "$1")2728if [ x"${OUT}" != x ]; then29RET=230echo "The following files contain runtime text relocations"31echo " Text relocations force the dynamic linker to perform extra"32echo " work at startup, waste system resources, and may pose a security"33echo " risk. On some architectures, the code may not even function"34echo " properly, if at all."35echo " For more information, see:"36echo " https://wiki.gentoo.org/wiki/Hardened/HOWTO_locate_and_fix_textrels"37echo38echo "${OUT}"39echo40fi4142exit "$RET"434445