[prev in list] [next in list] [prev in thread] [next in thread]
List: netbsd-tech-kern
Subject: [PATCH 2/4] Fix alignment when reading core notes
From: Michał Górny <mgorny () gentoo ! org>
Date: 2019-07-04 20:42:53
Message-ID: 20190704204255.4634-3-mgorny () gentoo ! org
[Download RAW message or body]
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 32e007d5e054..5ded0c311b7f 100644
--- a/tests/lib/libc/sys/t_ptrace_wait.c
+++ b/tests/lib/libc/sys/t_ptrace_wait.c
@@ -7728,6 +7728,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.22.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic