DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Robin Jarry <rjarry@redhat.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] usertools/pmdinfo: remove dependency to ldd
Date: Tue, 18 Oct 2022 09:40:00 +0200	[thread overview]
Message-ID: <Y05YUDx5oKRqrc1p@platinum> (raw)
In-Reply-To: <Y0lr2AkJjJxFezlQ@platinum>

On Fri, Oct 14, 2022 at 04:02:02PM +0200, Olivier Matz wrote:
> Hi Robin,
> 
> On Thu, Oct 13, 2022 at 03:41:25PM +0200, Robin Jarry wrote:
> > Some environments (buildroot) do not have the ldd utility installed by
> > default. However, ldd is often only a wrapper shell script that actually
> > checks that the arguments are valid ELF files and executes them with
> > the LD_TRACE_LOADED_OBJECTS=1 variable set in the environment.
> > 
> > Since ld.so is the actual ELF interpreter which is loaded first when
> > executing a program, executing any dynamic ELF program/library with that
> > variable set will cause all dependent dynamic libraries to be printed
> > and ld.so will exit before even running main.
> > 
> > Excerpt from ld.so(7) man page:
> > 
> >   LD_TRACE_LOADED_OBJECTS
> >     If set (to any value), causes the program to list its dynamic
> >     dependencies, as if run by ldd(1), instead of running normally.
> > 
> > Change dpdk-pmdinfo.py to actually "execute" the files provided on the
> > command line with LD_TRACE_LOADED_OBJECTS=1 set. Ensure that the files
> > are valid dynamically executable ELF programs to avoid obscure and
> > confusing errors.
> > 
> > Reported-by: Olivier Matz <olivier.matz@6wind.com>
> > Signed-off-by: Robin Jarry <rjarry@redhat.com>
> 
> Tested on buildroot without ldd.
> 
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

After some more tests, it appears that it only works for an executable
binary, but it does not work for .so PMDs:

# LD_TRACE_LOADED_OBJECTS=1 /usr/lib/x86_64-linux-gnu/dpdk/pmds-22.0/librte_net_ixgbe.so
Segmentation fault (core dumped)

So it is maybe better to keep the original code using ldd.

Thank you Robin anyway.

      reply	other threads:[~2022-10-18  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 13:41 Robin Jarry
2022-10-14 14:02 ` Olivier Matz
2022-10-18  7:40   ` Olivier Matz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y05YUDx5oKRqrc1p@platinum \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=rjarry@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).