public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Frank Ch. Eigler" <fche@redhat.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: rfc/patch: debuginfod client $DEBUGINFOD_PROGRESS env var
Date: Thu, 12 Dec 2019 17:18:00 -0000	[thread overview]
Message-ID: <20191212171850.GE13089@redhat.com> (raw)
In-Reply-To: <34b18e36d5a94512a27d8e1f65c9230e4803dc7d.camel@klomp.org>

Hi -

> >     debuginfod: usability tweaks, incl. $DEBUGINFOD_PROGRESS client
> > support
> >     
> >     This facility allows a default progress-printing function
> >     to be installed if the given environment variable is set.
> 
> I like this idea but have a bit of a security concern about the ability
> to set it to any file. If someone manages to set it then they can
> overwrite anything a process using the library can write to. 

That's not that serious a category of concern.  Environment variables
are not under control of untrusted agents.  FWIW, $DEBUGINFOD_CACHE is
considerably more dangerous in that regard (cache cleaning!).

> I rather it would just use stderr always when set since it is only
> meant as a human debugging device.

That default makes sense.  Making it configurable gives a way for a
larger app to still capture output (by having the client direct it to
a pipe file descriptor or something), but I'll just hardcode for now
STDERR_FILENO if the env var is set.


> >     Some larger usage experience (systemtap/kernels) indicates
> >     the default timeout is too short, so bumped it to 30s.

> My first thought is that we might need two timeouts. The original 5s
> timeout is a good inactivity timeout [...] But for larger data we
> might want a timeout for the total download time, maybe 30 seconds
> is too low for that. Given how large kernel debuginfo is it might
> take several minutes.

OK, redrafting $DEBUGINFOD_TIMEOUT as a two-part variable:

$DEBUGINFOD_TIMEOUT=x,y
 x - connection timeout, default 5
 y - optional, overall timeout, default unlimited

> [...]
> This seems to mean that if there is an error then the progress function
> is never called, is that intended? Also for CURLM_CALL_MULTI_PERFORM we
> continue/skip the progress function.

If we have an error outcome, there is no more progress to report, so
that should be OK.


> > +  close (fd); /* before the rmdir, otherwise it'll fail */
> >    (void) rmdir (target_cache_dir); /* nop if not empty */
> >    free(data);
> > -  close (fd);
> 
> This looks good. Just surprising. I assumed unlinking the file was
> enough.

Yeah, I had to see that for myself to believe it.


> The \r \n trick is nice.
> Just always using stderr would simplify this a bit.

OK.

> Also note that you can use dprintf to printf to a file descriptor. 

OK.


- FChE

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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 21:10 Frank Ch. Eigler
2019-12-10 23:01 ` Mark Wielaard
2019-12-12 17:18   ` Frank Ch. Eigler [this message]
2019-12-13 16:57     ` Frank Ch. Eigler
2019-12-18 21:27       ` Mark Wielaard
2019-12-19  0:47         ` Frank Ch. Eigler
2019-12-23  0:36           ` Mark Wielaard
2019-12-23  1:39             ` Frank Ch. Eigler
2020-01-02 16:08               ` Mark Wielaard
2020-01-02 16:45                 ` Frank Ch. Eigler
2020-01-09 23:14                   ` Mark Wielaard
2019-12-18 21:12     ` Mark Wielaard
2019-12-19  0:44       ` Frank Ch. Eigler

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=20191212171850.GE13089@redhat.com \
    --to=fche@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /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).