public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: elfutils-devel@sourceware.org, amerey@redhat.com
Subject: Re: patch 1/2 debuginfod client
Date: Mon, 18 Nov 2019 17:17:00 -0000	[thread overview]
Message-ID: <356e88e4937ddb97a3e7cc93dbdfe29239ff960e.camel@klomp.org> (raw)
In-Reply-To: <20191116185256.GB19543@redhat.com>

Hi,

On Sat, 2019-11-16 at 13:52 -0500, Frank Ch. Eigler wrote:
> Yeah, maybe a different automake version made it work after my earlier
> failing tests.  (dead horse PS.  It remains my opinion that we should
> commit auto* generated files into git.)
> 
> > > Possible, but since these bits are just getting transcribed straight
> > > to a debuginfod URL, an insane unclean hex will just get rejected at
> > > that time.  There is no lost-error case there.
> > 
> > But since the user won't see the URL generated they might not notice
> > what is really going on. They will just see that something wasn't
> > found, won't they?
> 
> Yes, so the only benefit would be the generation of a different error
> message for impossible buildids.

But if there are multiple server URLs it might not be clear which/where
the error came from. Since all this is done through a very simple web
api I think it is useful for the user to get informed about what the
actual request URL was that failed. Then they could debug what exactly
went wrong. Maybe my use case is not a common one. But I assume that
people who use debuginfod-find directly/by hand are doing it already
because they are interested what is really going on.

If we go with the client connection context idea for the API we could
add an extra function that would tell you the last URL tried maybe?

> > > Yeah ... if a user were to set DEBUGINFOD_CACHE_DIR to $HOME, she
> > > will
> > > get a good thorough cleaning, or a root user were to set it to /.
> > > PEBCAK IMHO; don't see easy ways of protecting themselves against it.
> > 
> > It might be unlikely the user accidentally set the environment
> > variables to something odd, 
> > but they might be tricked into running it on a debug file that was
> > doctored. Which might produce lookups for odd source files. It might
> > even just be a buggy compiler that created a few ../.. too many. It
> > would be bad if that would cause havoc.
> 
> Source file names do not survive into the client side cache - you 
> already found the "#" escaping bits.

Yes, you are right, this works on a different level than I assumed.
At the client request level it seems fine.

I still am concerned about the indexing level though. There a buggy
../.. in some debug file line table might cause the indexer to include
files which aren't really sources at all.

> > That doesn't make me very happy.
> > It looks like using libcurl from another library is not really very
> > safe if the program or another library it links against are also
> > libcurl users.
> > 
> > Do you know how other libraries that use libcurl deal with this?
> 
> I looked over some other libcurl users in fedora.  Some don't worry
> about the issue at all, relying on implicit initialization, which is
> only safe if single-threaded.  Others (libvirtd) do an explicitly
> invoked initialization function, which is also only safe if invoked
> from a single-threaded context.
> 
> I think actually our way here, running the init function from the
> shared library constructor, is about the best possible.  As long as
> the ld.so process is done as normal, it should be fine.  Programs that
> use the elfutils trick of manual dlopen'ing libdebuginfod.so should do
> so only if they are single-threaded.

But they cannot really control that... Since they might not know (and
really shouldn't care) that libdw lazily tries to dlopen
libdebuginfod.so which then pulls in libcurl and calls that global init
function...

Could we do try to do the dlopen and global curl initialization from
libdw _init, or a ctor, to make sure it is done as early as possible? 

> > > > I assume libcurl handles tls certificates for https? Does that need any
> > > > mention here?
> > > 
> > > Dunno if it's worth discussing ... the client side of https usually
> > > does not deal with configurable certificates.
> > 
> > But the client side might or might not verify the server side ssl
> > certificate. Does it do that? And if so, which trusted roots does it
> > use? And can that be disabled or changed?
> 
> Whatever the compiled-in defaults are, /etc paths etc.  IMHO we
> shouldn't worry about them.

I think it is fine to just mention in the docs that resolving and
authenticating https URLs is done according to whatever the defaults
are. But I think it should be documented what those are.

> > > I suppose that wouldn't make any sense.  Anything will take a nonzero
> > > amount of time. :-) Maybe it could be a floating point number or
> > > something; worth it?
> > 
> > I was more thinking zero == infinity (no timeout).
> 
> An unset environment variable should do that.

Are you sure? If DEBUGINFOD_TIMEOUT isn't set, then it seems it
defaults to 5 seconds:

/* Timeout for debuginfods, in seconds.
   This env var must be set for debuginfod-client to run.  */
static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR;
static int server_timeout = 5;

[...]

  if (getenv(server_timeout_envvar))
    server_timeout = atoi (getenv(server_timeout_envvar));

Cheers,

Mark

  reply	other threads:[~2019-11-18 17:17 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 19:04 patch 0/2 debuginfod submission Frank Ch. Eigler
2019-10-28 19:06 ` patch 1/2 debuginfod client Frank Ch. Eigler
2019-10-28 19:09   ` patch 2/2 debuginfod server etc Frank Ch. Eigler
2019-11-04 21:48     ` patch 3/3 debuginfod client interruptability Frank Ch. Eigler
2019-11-07  9:07       ` patch 4 debuginfod: symlink following mode Frank Ch. Eigler
2019-11-07  9:08         ` patch 5 debuginfod: prometheus metrics Frank Ch. Eigler
2019-11-15 17:26           ` Mark Wielaard
2019-11-15 17:58             ` Frank Ch. Eigler
2019-11-18 16:20               ` Mark Wielaard
2019-11-18 16:48                 ` Frank Ch. Eigler
2019-11-19 16:13                   ` Mark Wielaard
2019-11-15 16:49         ` patch 4 debuginfod: symlink following mode Mark Wielaard
2019-11-15 18:31           ` Frank Ch. Eigler
2019-11-18 16:27             ` Mark Wielaard
2019-11-15 16:16       ` patch 3/3 debuginfod client interruptability Mark Wielaard
2019-11-15 17:03         ` Aaron Merey
2019-11-15 17:35           ` Mark Wielaard
2019-11-15 18:14             ` Pedro Alves
2019-11-17 23:44               ` Mark Wielaard
2019-11-18  2:50                 ` Frank Ch. Eigler
2019-11-18  9:24                   ` Pedro Alves
2019-11-19 12:58                   ` Mark Wielaard
2019-11-13 17:22     ` patch 2/2 debuginfod server etc Mark Wielaard
2019-11-14 11:54       ` Frank Ch. Eigler
2019-11-16  1:31         ` Mark Wielaard
2019-11-13 23:19     ` Mark Wielaard
2019-11-14 12:30       ` Frank Ch. Eigler
2019-11-18 14:17         ` Mark Wielaard
2019-11-18 18:41           ` Frank Ch. Eigler
2019-11-19 15:41             ` Mark Wielaard
2019-11-19 16:13               ` Frank Ch. Eigler
2019-11-19 20:11                 ` Mark Wielaard
2019-11-19 21:15                   ` Frank Ch. Eigler
2019-11-20 11:53                     ` Mark Wielaard
2019-11-20 12:29                       ` Frank Ch. Eigler
2019-11-21 14:16                       ` Mark Wielaard
2019-11-21 15:40                         ` Mark Wielaard
2019-11-21 16:01                           ` Frank Ch. Eigler
2019-11-21 15:58                         ` Frank Ch. Eigler
2019-11-21 16:37                           ` Mark Wielaard
2019-11-21 17:18                             ` Frank Ch. Eigler
2019-11-21 20:42                               ` Mark Wielaard
2019-11-22 12:08                                 ` Mark Wielaard
2019-11-14 20:45     ` Mark Wielaard
2019-11-15 11:03       ` Mark Wielaard
2019-11-15 21:00       ` Frank Ch. Eigler
2019-11-18 15:01         ` Mark Wielaard
2019-11-15 14:40     ` Mark Wielaard
2019-11-15 19:54       ` Frank Ch. Eigler
2019-11-18 15:31         ` Mark Wielaard
2019-11-18 15:49           ` Frank Ch. Eigler
2019-11-12 11:12   ` patch 1/2 debuginfod client Mark Wielaard
2019-11-12 15:14     ` Frank Ch. Eigler
2019-11-12 21:59       ` Mark Wielaard
2019-11-14  0:33         ` Frank Ch. Eigler
2019-11-15 21:33       ` Mark Wielaard
2019-11-12 21:25   ` Mark Wielaard
2019-11-13 23:25     ` Frank Ch. Eigler
2019-11-16  0:46       ` Mark Wielaard
2019-11-16 18:53         ` Frank Ch. Eigler
2019-11-18 17:17           ` Mark Wielaard [this message]
2019-11-18 20:33             ` Frank Ch. Eigler
2019-11-19 15:57               ` Mark Wielaard
2019-11-19 16:20                 ` Frank Ch. Eigler
2019-11-19 20:16                   ` Mark Wielaard
2019-11-19 21:22                     ` Frank Ch. Eigler
2019-11-20 12:50                       ` Mark Wielaard
2019-11-20 13:30                         ` Frank Ch. Eigler
2019-11-21 14:02                           ` Mark Wielaard
2019-11-13 13:57   ` Mark Wielaard
2019-11-14 11:24     ` Frank Ch. Eigler
2019-11-16  0:52       ` Mark Wielaard
2019-11-16  2:28         ` Frank Ch. Eigler
2019-10-30 11:04 ` patch 0/2 debuginfod submission Mark Wielaard
2019-10-30 13:40   ` Frank Ch. Eigler
2019-10-30 14:12     ` Mark Wielaard
2019-10-30 18:11       ` Frank Ch. Eigler
2019-10-31 11:18         ` Mark Wielaard

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=356e88e4937ddb97a3e7cc93dbdfe29239ff960e.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=amerey@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=fche@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 read-only IMAP folder(s) and NNTP newsgroup(s).