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>


 612                 struct modctl *mod = NULL;
 613 
 614                 /*
 615                  * We must iterate over all modules to find the module that
 616                  * is our parent.
 617                  */
 618                 do {
 619                         if (strcmp(mp->mod_modname, parent) == 0) {
 620                                 mod = mp;
 621                                 break;
 622                         }
 623                 } while ((mp = mp->mod_next) != &modules);
 624 
 625                 if (mod == NULL)
 626                         goto err;
 627 
 628                 if ((pfp = ctf_modopen(mod->mod_mp, &error)) == NULL) {
 629                         goto err;
 630                 }
 631 










 632                 if (ctf_import(fp, pfp) != 0) {
 633                         ctf_close(pfp);
 634                         goto err;
 635                 }
 636 
 637                 ctf_close(pfp);
 638         }
 639 
 640         if (ctf_func_info(fp, fbt->fbtp_symndx, &f) == CTF_ERR)
 641                 goto err;
 642 
 643         if (fbt->fbtp_roffset != 0) {
 644                 if (desc->dtargd_ndx > 1)
 645                         goto err;
 646 
 647                 ASSERT(desc->dtargd_ndx == 1);
 648                 type = f.ctc_return;
 649         } else {
 650                 if (desc->dtargd_ndx + 1 > f.ctc_argc)
 651                         goto err;




 612                 struct modctl *mod = NULL;
 613 
 614                 /*
 615                  * We must iterate over all modules to find the module that
 616                  * is our parent.
 617                  */
 618                 do {
 619                         if (strcmp(mp->mod_modname, parent) == 0) {
 620                                 mod = mp;
 621                                 break;
 622                         }
 623                 } while ((mp = mp->mod_next) != &modules);
 624 
 625                 if (mod == NULL)
 626                         goto err;
 627 
 628                 if ((pfp = ctf_modopen(mod->mod_mp, &error)) == NULL) {
 629                         goto err;
 630                 }
 631 
 632                 /*
 633                  * If the parent module does not have the label we expect,
 634                  * ignore it and fail to avoid presenting non-sensical data.
 635                  */
 636                 if (ctf_label_info(pfp, ctf_parent_label(fp),
 637                     NULL) == CTF_ERR) {
 638                         ctf_close(pfp);
 639                         goto err;
 640                 }
 641 
 642                 if (ctf_import(fp, pfp) != 0) {
 643                         ctf_close(pfp);
 644                         goto err;
 645                 }
 646 
 647                 ctf_close(pfp);
 648         }
 649 
 650         if (ctf_func_info(fp, fbt->fbtp_symndx, &f) == CTF_ERR)
 651                 goto err;
 652 
 653         if (fbt->fbtp_roffset != 0) {
 654                 if (desc->dtargd_ndx > 1)
 655                         goto err;
 656 
 657                 ASSERT(desc->dtargd_ndx == 1);
 658                 type = f.ctc_return;
 659         } else {
 660                 if (desc->dtargd_ndx + 1 > f.ctc_argc)
 661                         goto err;