13022 case DOF_SECT_PROVIDER:
13023 case DOF_SECT_PROBES:
13024 case DOF_SECT_PRARGS:
13025 case DOF_SECT_PROFFS:
13026 dtrace_dof_error(dof, "illegal sections "
13027 "for enabling");
13028 return (-1);
13029 }
13030 }
13031
13032 if (DOF_SEC_ISLOADABLE(sec->dofs_type) &&
13033 !(sec->dofs_flags & DOF_SECF_LOAD)) {
13034 dtrace_dof_error(dof, "loadable section with load "
13035 "flag unset");
13036 return (-1);
13037 }
13038
13039 if (!(sec->dofs_flags & DOF_SECF_LOAD))
13040 continue; /* just ignore non-loadable sections */
13041
13042 if (sec->dofs_align & (sec->dofs_align - 1)) {
13043 dtrace_dof_error(dof, "bad section alignment");
13044 return (-1);
13045 }
13046
13047 if (sec->dofs_offset & (sec->dofs_align - 1)) {
13048 dtrace_dof_error(dof, "misaligned section");
13049 return (-1);
13050 }
13051
13052 if (sec->dofs_offset > len || sec->dofs_size > len ||
13053 sec->dofs_offset + sec->dofs_size > len) {
13054 dtrace_dof_error(dof, "corrupt section header");
13055 return (-1);
13056 }
13057
13058 if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr +
13059 sec->dofs_offset + sec->dofs_size - 1) != '\0') {
13060 dtrace_dof_error(dof, "non-terminating string table");
13061 return (-1);
13062 }
|
13022 case DOF_SECT_PROVIDER:
13023 case DOF_SECT_PROBES:
13024 case DOF_SECT_PRARGS:
13025 case DOF_SECT_PROFFS:
13026 dtrace_dof_error(dof, "illegal sections "
13027 "for enabling");
13028 return (-1);
13029 }
13030 }
13031
13032 if (DOF_SEC_ISLOADABLE(sec->dofs_type) &&
13033 !(sec->dofs_flags & DOF_SECF_LOAD)) {
13034 dtrace_dof_error(dof, "loadable section with load "
13035 "flag unset");
13036 return (-1);
13037 }
13038
13039 if (!(sec->dofs_flags & DOF_SECF_LOAD))
13040 continue; /* just ignore non-loadable sections */
13041
13042 if (!ISP2(sec->dofs_align)) {
13043 dtrace_dof_error(dof, "bad section alignment");
13044 return (-1);
13045 }
13046
13047 if (sec->dofs_offset & (sec->dofs_align - 1)) {
13048 dtrace_dof_error(dof, "misaligned section");
13049 return (-1);
13050 }
13051
13052 if (sec->dofs_offset > len || sec->dofs_size > len ||
13053 sec->dofs_offset + sec->dofs_size > len) {
13054 dtrace_dof_error(dof, "corrupt section header");
13055 return (-1);
13056 }
13057
13058 if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr +
13059 sec->dofs_offset + sec->dofs_size - 1) != '\0') {
13060 dtrace_dof_error(dof, "non-terminating string table");
13061 return (-1);
13062 }
|