Merge from OpenSolaris (20-Apr-2008):

6822482 DOF validation needs to handle loadable sections flagged as unloadable

MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni
2014-07-03 17:36:59 +00:00
parent 34b800be20
commit e099b3a948
2 changed files with 22 additions and 1 deletions
@@ -9774,7 +9774,7 @@ dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs,
break;
default:
err += efunc(dp->dtdo_len - 1, "bad return size");
err += efunc(dp->dtdo_len - 1, "bad return size\n");
}
}
@@ -13718,6 +13718,13 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr,
}
}
if (DOF_SEC_ISLOADABLE(sec->dofs_type) &&
!(sec->dofs_flags & DOF_SECF_LOAD)) {
dtrace_dof_error(dof, "loadable section with load "
"flag unset");
return (-1);
}
if (!(sec->dofs_flags & DOF_SECF_LOAD))
continue; /* just ignore non-loadable sections */
@@ -727,6 +727,20 @@ typedef struct dof_sec {
#define DOF_SECF_LOAD 1 /* section should be loaded */
#define DOF_SEC_ISLOADABLE(x) \
(((x) == DOF_SECT_ECBDESC) || ((x) == DOF_SECT_PROBEDESC) || \
((x) == DOF_SECT_ACTDESC) || ((x) == DOF_SECT_DIFOHDR) || \
((x) == DOF_SECT_DIF) || ((x) == DOF_SECT_STRTAB) || \
((x) == DOF_SECT_VARTAB) || ((x) == DOF_SECT_RELTAB) || \
((x) == DOF_SECT_TYPTAB) || ((x) == DOF_SECT_URELHDR) || \
((x) == DOF_SECT_KRELHDR) || ((x) == DOF_SECT_OPTDESC) || \
((x) == DOF_SECT_PROVIDER) || ((x) == DOF_SECT_PROBES) || \
((x) == DOF_SECT_PRARGS) || ((x) == DOF_SECT_PROFFS) || \
((x) == DOF_SECT_INTTAB) || ((x) == DOF_SECT_XLTAB) || \
((x) == DOF_SECT_XLMEMBERS) || ((x) == DOF_SECT_XLIMPORT) || \
((x) == DOF_SECT_XLIMPORT) || ((x) == DOF_SECT_XLEXPORT) || \
((x) == DOF_SECT_PREXPORT) || ((x) == DOF_SECT_PRENOFFS))
typedef struct dof_ecbdesc {
dof_secidx_t dofe_probes; /* link to DOF_SECT_PROBEDESC */
dof_secidx_t dofe_pred; /* link to DOF_SECT_DIFOHDR */