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: [PATCH] PR28204, debuginfod IMA
Date: Tue, 31 Oct 2023 11:46:37 -0400	[thread overview]
Message-ID: <20231031154637.GA25062@redhat.com> (raw)
In-Reply-To: <2148d29762c2046d5d7ce88df51ef91eb2113046.camel@klomp.org>

Hi, Mark -


> > Considering how easily the trybots can process the actual code - and
> > have done so before posting the patch for review - we can consider
> > some CI well done already.  After approval but before merge, it would
> > undergo another round of trybotting.  With such workflow, patchwork
> > does not need to concern itself with additional pre-commit CI/CD.
> 
> My point is really that posting with git format-patch or send-email
> makes it possible for someone to simply use git am, b4 or git pw to try
> out a patch. If the patch doesn't apply then that will be the first
> review issue.

I see what you mean, but maybe that puts the cart ahead of the horse.
What's desirable is easy access to a runnable version of the patch,
not the choice of command line tooling to do that.  A published git
branch containing the same patch is even simpler than using git
am/b4/pw.  git is the most convenient transport protocol for patches.


> I think my issue is really that it is unclear what "reassurances" we
> are making. What is the threat-model? Permissive says to me that
> although checks are done, they don't block receiving files. [...]

In the current version of the users/fche/try-bz28204 branch, this
has been renamed "optimistic", and the man page blurb now says:

   \fIima:optimistic\fP Every downloaded file with a known-invalid
   signature is rejected, protecting against some types of corruption.


> > They already make the decision whom they download debuginfo from.
> > That's literally what setting $DEBUGINFOD_URLS is.  The scenario
> > you're describing would be trusting a server enough to supply content,
> > trusting our code to fetch & check that content, but not trusting us
> > to redistribute public certificates for the servers.
> 
> The user shouldn't trust a middle-person. Unless we are signing those
> files we shouldn't distribute the certificates are being trustable
> imho.

We sign our elfutils releases, and packagers often sign their builds
of our releases, which users can verify.


> So you propose we setup a curating process to decide which certificates
> to include? 

Sure.  We already curate a set of debuginfod servers.

> If we do then I would suggest we create a separate package for that
> (or just a separate tar ball or repository). [...]

Another compromise possibility is to keep shipping these certificates,
but not include them in the default $DEBUGINFOD_IMA_CERT_PATH.  A user
wishing to trust our curation can add /etc/debuginfod/ima-certs.


> > > I do understand hex2dec, but I don't understand what extract_skid
> > > does. Maybe add an explanation what a certificates subject key id is
> > > and why we need it.

It's a brief fingerprint/hash of the key, convenient for
identification in diagnostics.


> > > [...]
> > > > Not sure, but this is how libimaevm.c similar code does it.  I assume
> > > > the first byte of the signature is something else.
> > > > (https://git.code.sf.net/p/linux-ima/ima-evm-utils)
> > > 
> > > ewww. Does this pass ubsan (--enable-sanitize-undefined)?  
> > 
> > Haven't tried but it passes valgrind.
> 
> valgrind doesn't check for undefined behavior or type alignment
> requirements.

An elfutils build with --enable-sanitize-undefined had no complaints.


> > OK, will take a look at that.  What other global-state conflicting
> > things did you notice?
> 
> A quick look at the code shows that various functions can read/write a
> static public_keys variable linked list, including (indirectly)
> ima_verify_signature. So that can cause data-races. [...]

OK, added a mutex around the entire function.


> One other issue I noticed is that it seems to be distributed under
> GPLv2-only. Which seems to mean that anything based on it should also
> be distributed under GPLv2-only, which would include libdebuginfod. Is
> there code we can rely on that is GPLv2+ and LGPLv3+ compatible?

Ugh.  I don't know of an alternative.  There isn't an equivalent
command line wrapping of the library either (with respect to
certificate searching) that we could fork out to.  (OTOH, GPLv2 is
compatible with GPLv2+.)


> > openssl's initialization is fine & thread-safe in practice, despite
> > the documentation's warnings.
> 
> OK. But even if it is thread-safe, you also need to make sure it inits
> the same. [...]

Interesting issue.  One openssl initialization call is deep inside
libcurl, another one in libimaevm's solib ctor.  Neither is
parametrized such that we could influence them.  However, things are
working(tm).


- FChE


  reply	other threads:[~2023-10-31 15:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 12:55 Frank Ch. Eigler
2023-10-23 19:33 ` Mark Wielaard
2023-10-24 13:27   ` Frank Ch. Eigler
2023-10-24 21:03     ` Mark Wielaard
2023-10-27 19:15       ` Frank Ch. Eigler
2023-10-31 13:20         ` Mark Wielaard
2023-10-31 15:46           ` Frank Ch. Eigler [this message]
2023-11-01 14:59             ` Mark Wielaard
2023-11-14 16:45               ` Frank Ch. Eigler
2023-11-15 16:00                 ` Mark Wielaard
2023-10-24 15:25 ` 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=20231031154637.GA25062@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).