Skip to content

Commit 8ecb14c

Browse files
committed
8379454: SA still calculates end address with incorrect alignment
Reviewed-by: kevinw, cjplummer
1 parent 22831cb commit 8ecb14c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,14 @@ static bool fill_addr_info(lib_info* lib) {
182182
return false;
183183
}
184184

185+
long page_size = sysconf(_SC_PAGE_SIZE);
185186
lib->end = (uintptr_t)-1L;
186187
lib->exec_start = (uintptr_t)-1L;
187188
lib->exec_end = (uintptr_t)-1L;
188189
for (ph = phbuf, cnt = 0; cnt < ehdr.e_phnum; cnt++, ph++) {
189190
if (ph->p_type == PT_LOAD) {
190191
uintptr_t aligned_start = lib->base + align_down(ph->p_vaddr, ph->p_align);
191-
uintptr_t aligned_end = aligned_start + align_up(ph->p_memsz, ph->p_align);
192+
uintptr_t aligned_end = aligned_start + align_up(ph->p_memsz, page_size);
192193
if ((lib->end == (uintptr_t)-1L) || (lib->end < aligned_end)) {
193194
lib->end = aligned_end;
194195
}

0 commit comments

Comments
 (0)