On Mon, Sep 14, 2020 at 03:42:55PM +0900, Namhyung Kim wrote:
> On Mon, Sep 14, 2020 at 6:05 AM Jiri Olsa <[email protected]> wrote:
> >
> > Adding buildid-list --store option to populate
> > .debug data with build id files.
> 
> Hmm.. isn't it better to add it to the buildid-cache command?
> > +        *   - store binary to build id database
> > +        */
> > +       is_kallsyms = !strcmp(machine->mmap_name, dso->short_name);
> > +       build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
> > +
> > +       if (is_kallsyms) {
> > +               /*
> > +                * Find out if we are on the same kernel as perf.data
> > +                * and keel kallsyms in that case.
> > +                */
> > +               path = strdup(dso->long_name);
> > +               if (!path)
> > +                       goto out_err;
> > +
> > +               err = sysfs__read_build_id("/sys/kernel/notes", &bid, 
> > sizeof(bid));
> > +               if (err < 0)
> > +                       goto out_err;
> > +       } else {
> > +               struct stat st;
> > +
> > +               /*
> > +                * Does the file exists in the first place, if it does,
> > +                * resolve path and read the build id.
> > +                */
> > +               if (stat(dso->long_name, &st)) {
> > +                       zfree(&path);
> > +                       goto try_download;
> > +               }
> > +
> > +               path = nsinfo__realpath(dso->long_name, dso->nsinfo);
> > +               if (!path)
> > +                       goto out_err;
> > +
> > +               err = filename__read_build_id(path, &bid, sizeof(bid));
> 
> Is it ok to read the file out of the namespace?

right, I need to enclose the whole part into nsinfo__mountns_* 

thanks,
jirka

Reply via email to