Re: [PATCH bpf-next 10/13] selftests/bpf: Add uprobe/usdt optimized test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 13, 2024 at 01:58:38PM -0800, Andrii Nakryiko wrote:

SNIP

> > +static int find_uprobes_trampoline(void **start, void **end)
> > +{
> > +       char line[128];
> > +       int ret = -1;
> > +       FILE *maps;
> > +
> > +       maps = fopen("/proc/self/maps", "r");
> > +       if (!maps) {
> > +               fprintf(stderr, "cannot open maps\n");
> > +               return -1;
> > +       }
> > +
> > +       while (fgets(line, sizeof(line), maps)) {
> > +               int m = -1;
> > +
> > +               /* We care only about private r-x mappings. */
> > +               if (sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n", start, end, &m) != 2)
> > +                       continue;
> > +               if (m < 0)
> > +                       continue;
> > +               if (!strncmp(&line[m], TRAMP, sizeof(TRAMP)-1)) {
> > +                       ret = 0;
> > +                       break;
> > +               }
> > +       }
> 
> you could have used PROCMAP_QUERY ;)

true ;-) will check on that in new version

thanks,
jirka

> 
> > +
> > +       fclose(maps);
> > +       return ret;
> > +}
> > +
> 
> [...]




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux