tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH v4 2/4] Fix alignment when reading core notes
Both desc and note header needs to be aligned. Therefore, we need
to realign after skipping past desc as well.
---
tests/lib/libc/sys/t_ptrace_wait.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/lib/libc/sys/t_ptrace_wait.c b/tests/lib/libc/sys/t_ptrace_wait.c
index 6fc43572e015..1097a351fd92 100644
--- a/tests/lib/libc/sys/t_ptrace_wait.c
+++ b/tests/lib/libc/sys/t_ptrace_wait.c
@@ -7603,6 +7603,9 @@ static ssize_t core_find_note(const char *core_path,
}
offset += note_hdr.n_descsz;
+ /* fix to alignment */
+ offset = ((offset + core_hdr.p_align - 1)
+ / core_hdr.p_align) * core_hdr.p_align;
}
}
--
2.24.1
Home |
Main Index |
Thread Index |
Old Index