Author: pfg
Date: Thu Jul  3 17:36:59 2014
New Revision: 268224
URL: http://svnweb.freebsd.org/changeset/base/268224

Log:
  Merge from OpenSolaris (20-Apr-2008):
  
  6822482 DOF validation needs to handle loadable sections flagged as unloadable
  
  MFC after:    1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c        Thu Jul 
 3 17:35:01 2014        (r268223)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c        Thu Jul 
 3 17:36:59 2014        (r268224)
@@ -9774,7 +9774,7 @@ dtrace_difo_validate(dtrace_difo_t *dp, 
                        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_
                        }
                }
 
+               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 */
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Thu Jul  3 
17:35:01 2014        (r268223)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Thu Jul  3 
17:36:59 2014        (r268224)
@@ -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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to