Skip to content

Commit 3760ccb

Browse files
committed
Fix xxd command for compatibility with older RHEL versions in Copy Fail BPF include generation
1 parent 9270598 commit 3760ccb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/modules/complianceengine/src/lib/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ add_custom_command(
5151

5252
add_custom_command(
5353
OUTPUT ${COPYFAIL_BPF_OBJECT_INC}
54-
COMMAND /bin/sh -c "${XXD_EXECUTABLE} -i -n gCopyFailMitigationBpfObject ${COPYFAIL_BPF_OBJECT} > ${COPYFAIL_BPF_OBJECT_INC}"
54+
# RHEL's older xxd does not support `-n`, so generate the include with the
55+
# default path-derived symbols and rewrite only the declarations to stable names.
56+
COMMAND /bin/sh -c "\"${XXD_EXECUTABLE}\" -i \"${COPYFAIL_BPF_OBJECT}\" | sed -e 's/^unsigned char .*\\[\\] =/unsigned char gCopyFailMitigationBpfObject[] =/' -e 's/^unsigned int .*_len =/unsigned int gCopyFailMitigationBpfObject_len =/' > \"${COPYFAIL_BPF_OBJECT_INC}\""
5557
DEPENDS ${COPYFAIL_BPF_OBJECT}
5658
VERBATIM
5759
)

0 commit comments

Comments
 (0)