Re: [PATCH RFC v2 bpf-next 4/9] libbpf: Allow to resolve binary path in current directory

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

 



On Tue, Mar 07, 2023 at 05:19:00PM -0800, Andrii Nakryiko wrote:
> On Tue, Feb 28, 2023 at 1:33 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >
> > Try to resolve uprobe/usdt binary path also in current directory,
> > it's used in the test code in following changes.
> 
> nope, that's not what shell is doing, so let's not invent new rules
> here. If some tests need something like that, utilize LD_LIBRARY_PATH
> or even better just specify './library.so'

ok, that fixed that:

SEC("uprobe/./liburandom_read.so:urandlib_read_without_sema")

thanks,
jirka

> 
> >
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> >  tools/lib/bpf/libbpf.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index 05c4db355f28..f72115e8b7f9 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -10727,17 +10727,19 @@ static const char *arch_specific_lib_paths(void)
> >  /* Get full path to program/shared library. */
> >  static int resolve_full_path(const char *file, char *result, size_t result_sz)
> >  {
> > -       const char *search_paths[3] = {};
> > +       const char *search_paths[4] = {};
> >         int i, perm;
> >
> >         if (str_has_sfx(file, ".so") || strstr(file, ".so.")) {
> >                 search_paths[0] = getenv("LD_LIBRARY_PATH");
> >                 search_paths[1] = "/usr/lib64:/usr/lib";
> >                 search_paths[2] = arch_specific_lib_paths();
> > +               search_paths[3] = ".";
> >                 perm = R_OK;
> >         } else {
> >                 search_paths[0] = getenv("PATH");
> >                 search_paths[1] = "/usr/bin:/usr/sbin";
> > +               search_paths[2] = ".";
> >                 perm = R_OK | X_OK;
> >         }
> >
> > --
> > 2.39.2
> >



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux