Print this page
1730 DTrace should ignore type information from modules with cth_parlabel mismatches
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>


1640                 struct modctl *mp = &modules;
1641                 struct modctl *mod = NULL;
1642 
1643                 /*
1644                  * We must iterate over all modules to find the module that
1645                  * is our parent.
1646                  */
1647                 do {
1648                         if (strcmp(mp->mod_modname, parent) == 0) {
1649                                 mod = mp;
1650                                 break;
1651                         }
1652                 } while ((mp = mp->mod_next) != &modules);
1653 
1654                 if (mod == NULL)
1655                         goto err;
1656 
1657                 if ((pfp = ctf_modopen(mod->mod_mp, &error)) == NULL)
1658                         goto err;
1659 










1660                 if (ctf_import(fp, pfp) != 0) {
1661                         ctf_close(pfp);
1662                         goto err;
1663                 }
1664 
1665                 ctf_close(pfp);
1666         }
1667 
1668         if (ctf_func_info(fp, fbt->fbtp_symndx, &f) == CTF_ERR)
1669                 goto err;
1670 
1671         if (fbt->fbtp_return) {
1672                 if (desc->dtargd_ndx > 1)
1673                         goto err;
1674 
1675                 ASSERT(desc->dtargd_ndx == 1);
1676                 type = f.ctc_return;
1677         } else {
1678                 if (desc->dtargd_ndx + 1 > f.ctc_argc)
1679                         goto err;




1640                 struct modctl *mp = &modules;
1641                 struct modctl *mod = NULL;
1642 
1643                 /*
1644                  * We must iterate over all modules to find the module that
1645                  * is our parent.
1646                  */
1647                 do {
1648                         if (strcmp(mp->mod_modname, parent) == 0) {
1649                                 mod = mp;
1650                                 break;
1651                         }
1652                 } while ((mp = mp->mod_next) != &modules);
1653 
1654                 if (mod == NULL)
1655                         goto err;
1656 
1657                 if ((pfp = ctf_modopen(mod->mod_mp, &error)) == NULL)
1658                         goto err;
1659 
1660                 /*
1661                  * If the parent module does not have the label we expect,
1662                  * ignore it and fail to avoid presenting non-sensical data.
1663                  */
1664                 if (ctf_label_info(pfp, ctf_parent_label(fp),
1665                     NULL) == CTF_ERR) {
1666                         ctf_close(pfp);
1667                         goto err;
1668                 }
1669 
1670                 if (ctf_import(fp, pfp) != 0) {
1671                         ctf_close(pfp);
1672                         goto err;
1673                 }
1674 
1675                 ctf_close(pfp);
1676         }
1677 
1678         if (ctf_func_info(fp, fbt->fbtp_symndx, &f) == CTF_ERR)
1679                 goto err;
1680 
1681         if (fbt->fbtp_return) {
1682                 if (desc->dtargd_ndx > 1)
1683                         goto err;
1684 
1685                 ASSERT(desc->dtargd_ndx == 1);
1686                 type = f.ctc_return;
1687         } else {
1688                 if (desc->dtargd_ndx + 1 > f.ctc_argc)
1689                         goto err;