20260416-linuxkm-fips-rodata-canonify#10344
Conversation
…ke criteria for ifdef.
…when ge_tobytes_nct and ge_tobytes have identical definitions, map the former to the latter using a macro and omit the latter definition, to avoid problematic R_ARM_THM_JUMP11 tail call.
…ble_segments.text_reloc_tab.* (using the new struct wc_reloc_table_fenceposts and WC_RELOC_TABLE_FENCEPOSTS_INITIALIZER), and add wc_reloc_table_segments.rodata_reloc_tab (allocated but not yet implemented).
…nt in WC_SYM_RELOC_TABLES (FIPS) kernel module builds: linuxkm/Makefile: update the GENERATE_RELOC_TAB recipe to generate both wc_linuxkm_pie_text_reloc_tab[] and wc_linuxkm_pie_rodata_reloc_tab. linuxkm/linuxkm-fips-hash-wrapper.sh: add handling for wc_linuxkm_pie_rodata_reloc_tab. linuxkm/linuxkm-fips-hash.c: add handling for rodata_reloc_tab.*. linuxkm/linuxkm_memory.c: * refactor find_reloc_tab_offset() to be segment-agnostic and tolerate empty reloc tabs. * refactor wc_reloc_normalize_segment(): * to be segment-agnostic, * identify the src segment dynamically, * return BAD_FUNC_ARG where previously returning literal -1, * use seg_in_out_len arg to accommodate size skew between input and output (not currently used), and * rename working vars for better mnemonicitude. * update wc_fips_generate_hash() to * handle seg_map->rodata_reloc_tab, * use new calling convention for wc_reloc_normalize_segment(), and * add wc_reloc_normalize_segment() loop for .rodata_wolfcrypt. linuxkm/linuxkm_memory.h and linuxkm/linuxkm_wc_port.h: rename WOLFSSL_TEXT_SEGMENT_CANONICALIZER* to WOLFSSL_SEGMENT_CANONICALIZER*, with backward-compat provisions. linuxkm/module_hooks.c: * add wc_linuxkm_normalize_relocations_noresize() backward-compat wrapper. * wolfssl_init(): add .rodata_wolfcrypt relocation handling alongside existing .text_wolfcrypt handling, and update for new wc_reloc_normalize_segment() calling convention. * add seg_map.rodata_reloc_tab initialization. * update wc_linuxkm_normalize_relocations() to be segment-agnostic and use new wc_reloc_normalize_segment() calling convention.
…tialized in wc_lms_treehash_update().
…haracters in format args to pr_*(), for proper line flushing.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10344
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
…ash_span() loops, reset cur_reloc_index before each loop (Fenrir review).
|
Ran a skoll review and these caught my eye: HIGH-1: Text canonicalization error is silently masked by rodata loop
Description: while (text_p < (const byte *)seg_map->fips_text_end) { LOW-3: stabilized_rodata_hash is computed but never reported
Description: unsigned int stabilized_rodata_hash = 1; |
… failed hmac_update() in text segment loop; linuxkm/module_hooks.c: in wolfssl_init() DEBUG_LINUXKM_PIE_SUPPORT section, render stabilized_rodata_hash; in my_kallsyms_lookup_name(), gate kprobe failure messages behind WOLFSSL_LINUXKM_VERBOSE_DEBUG.
|
Both items noted by Skoll are now fixed here, and in wolfssl/fips#386, and in |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10344
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
|
Note because #10293 can't be merged yet. |
linuxkm/: implement support for stabilization of.rodata_wolfcryptsegment inWC_SYM_RELOC_TABLES(FIPS) kernel module builds:linuxkm/: refactorwc_reloc_table_segments.reloc_tab_*aswc_reloc_table_segments.text_reloc_tab.*(using the newstruct wc_reloc_table_fencepostsandWC_RELOC_TABLE_FENCEPOSTS_INITIALIZER), and addwc_reloc_table_segments.rodata_reloc_tab.linuxkm/Makefile: update theGENERATE_RELOC_TABrecipe to generate bothwc_linuxkm_pie_text_reloc_tab[]andwc_linuxkm_pie_rodata_reloc_tab[].linuxkm/linuxkm-fips-hash-wrapper.sh: add handling forwc_linuxkm_pie_rodata_reloc_tab.linuxkm/linuxkm-fips-hash.c: add handling forrodata_reloc_tab.*.linuxkm/linuxkm_memory.c:find_reloc_tab_offset()to be segment-agnostic and tolerate empty reloc tabs.wc_reloc_normalize_segment():BAD_FUNC_ARGwhere previously returning literal-1,seg_in_out_lenarg to accommodate size skew between input and output (not currently used), andwc_fips_generate_hash()toseg_map->rodata_reloc_tab,wc_reloc_normalize_segment(), andwc_reloc_normalize_segment()loop for.rodata_wolfcrypt.linuxkm/linuxkm_memory.handlinuxkm/linuxkm_wc_port.h: renameWOLFSSL_TEXT_SEGMENT_CANONICALIZER*toWOLFSSL_SEGMENT_CANONICALIZER*, with backward-compat provisions.linuxkm/module_hooks.c:wc_linuxkm_normalize_relocations_noresize()backward-compat wrapper.wolfssl_init(): add.rodata_wolfcryptrelocation handling alongside existing.text_wolfcrypthandling, and update for newwc_reloc_normalize_segment()calling convention.seg_map.rodata_reloc_tabinitialization.wc_linuxkm_normalize_relocations()to be segment-agnostic and use newwc_reloc_normalize_segment()calling convention.misc ARM32-kernel-specific fixes:
wolfcrypt/src/ge_operations.candwolfssl/wolfcrypt/ge_operations.h: whenge_tobytes_nctandge_tobyteshave identical definitions, map the former to the latter using a macro and omit the latter definition, to avoid problematicR_ARM_THM_JUMP11tail call.linuxkm/Kbuild: defineNO_PIE_FLAGto1, not empty, to satisfy gnu make criteria forifdef.misc kernel fixes:
wolfcrypt/src/wc_lms_impl.c: work around false-positive-Wmaybe-uninitializedinwc_lms_treehash_update().linuxkm/lkcapi_*.candlinuxkm/module_hooks.c: add missing linefeed characters in format args topr_*(), for proper line flushing.Note, on targets with no relocations in .rodata_wolfcrypt, the new code is backward-compatible (generates the same HMAC value) so interoperates with old fips_test.c.
tested with
Also tested on actual ARM32 hardware.