From 003e64df933815479ea78ede810180d6b04ffafe Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 26 Dec 2014 18:53:29 +0000 Subject: [PATCH] DOF tables are aligned according to the DOF section's alignment constraint, so take this into account when iterating over DOF tables. PR: 195555 Submitted by: Fedor Indutny (original version) MFC after: 1 week --- cddl/contrib/opensolaris/lib/libdtrace/common/drti.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c index d7b34907e4b6..6f3c9c7d3de9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c @@ -127,6 +127,7 @@ dtrace_dof_init(void) int efd; char *s; size_t shstridx; + uint64_t aligned_filesz; #endif if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) @@ -183,7 +184,9 @@ dtrace_dof_init(void) } while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) { - dof_next = (void *) ((char *) dof + dof->dofh_filesz); + aligned_filesz = (shdr.sh_addralign == 0 ? dof->dofh_filesz : + roundup2(dof->dofh_filesz, shdr.sh_addralign)); + dof_next = (void *) ((char *) dof + aligned_filesz); #endif if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 ||