Skip to content

Commit 1d21858

Browse files
committed
linuxkm/module_hooks.c: in wolfssl_init() DEBUG_LINUXKM_PIE_SUPPORT hash_span() loops, reset cur_reloc_index before each loop (Fenrir review).
1 parent 559b207 commit 1d21858

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

linuxkm/module_hooks.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ static int wolfssl_init(void)
712712
unsigned int text_hash = hash_span((const u8 *)__wc_text_start, (const u8 *)__wc_text_end, 1);
713713
unsigned int rodata_hash = hash_span((const u8 *)__wc_rodata_start, (const u8 *)__wc_rodata_end, 1);
714714
u8 *canon_buf = malloc(WOLFSSL_SEGMENT_CANONICALIZER_BUFSIZ);
715-
ssize_t cur_reloc_index = -1;
715+
ssize_t cur_reloc_index;
716716
const u8 *text_p = (const u8 *)__wc_text_start;
717717
const u8 *rodata_p = (const u8 *)__wc_rodata_start;
718718
unsigned int stabilized_text_hash = 1;
@@ -726,6 +726,7 @@ static int wolfssl_init(void)
726726
reloc_counts.text = reloc_counts.rodata = reloc_counts.rwdata = reloc_counts.bss =
727727
reloc_counts.other = 0;
728728

729+
cur_reloc_index = -1;
729730
while (text_p < (const u8 *)__wc_text_end) {
730731
size_t text_in_out_len = min(WOLFSSL_SEGMENT_CANONICALIZER_BUFSIZ,
731732
(size_t)((const u8 *)__wc_text_end - text_p));
@@ -748,6 +749,7 @@ static int wolfssl_init(void)
748749
}
749750

750751
/* note verifyCore is hashed along with the rest of .rodata_wolfcrypt. */
752+
cur_reloc_index = -1;
751753
while (rodata_p < (const u8 *)__wc_rodata_end) {
752754
size_t rodata_in_out_len = min(WOLFSSL_SEGMENT_CANONICALIZER_BUFSIZ,
753755
(size_t)((const u8 *)__wc_rodata_end - rodata_p));

0 commit comments

Comments
 (0)