[pacman-dev] [PATCH] Check for all return values of _alpm_key_in_keychain

David Phillips david at sighup.nz
Mon Apr 24 02:35:54 UTC 2017


Hi,

It now looks like this problem's root cause was a keyring that got corrupted
while I was debugging some problems with refreshing pacman's keyring. That
is to say, it looks like I do not have a genuine "in the wild" key collision.
It looks like my own public key became copied to both me and one of the TUs
in the keyring.

With that said though, I suppose it's still not impossible for long key IDs
to genuinely collide.

On Mon, Apr 24, 2017 at 11:06:05AM +1000, Allan McRae wrote:
> Can you tell me what happens both before and after this patch with
> ambiguous key IDs.

Please find attached two log files before and after. As you can see, pacman
used to blindly run ahead, trying to check the signature even though it could
not get the key from the keychain. A quick look at a backtrace (not attached)
shows this to be a segmentation fault after control is passed to libgpgme.

> Also, what happens if you only have one of the keys
> in the keyring and want to match the other?

I cannot test this, since it turns out to be a corrupt keyring where the key
in question looks to be attached to two people and is exactly the same.

> Perhaps we also need to look at matching the whole key fingerprint...

If the issue with collisions comes up again and doesn't end up being put down
to a corrupt keyring, this would be a good idea. For now, it seems like seeing
this in the wild too narrow a possibility, but there is still a clear hiccup
with tht way pacman behaves before this patch.

Thanks
David
-------------- next part --------------
debug: pacman v5.0.1 - libalpm v10.0.1
debug: config: attempting to read file /home/david/pacman-root/etc/pacman.conf
debug: config: new section 'options'
debug: config: HoldPkg: pacman
debug: config: HoldPkg: glibc
debug: config: arch: x86_64
debug: config: finished parsing /home/david/pacman-root/etc/pacman.conf
debug: setup_libalpm called
debug: option 'logfile' = /home/david/pacman-root/var/log/pacman.log
debug: option 'gpgdir' = /home/david/pacman-root/etc/pacman.d/gnupg/
debug: option 'hookdir' = /home/david/pacman-root/etc/pacman.d/hooks/
debug: option 'cachedir' = /home/david/pacman-root/var/cache/pacman/pkg/
debug: GPGME version: 1.9.0
debug: GPGME engine info: file=/usr/bin/gpg2, home=/home/david/pacman-root/etc/pacman.d/gnupg/
debug: looking up key 4BCADD9BD3246795 locally
debug: gpg error: Ambiguous name
debug: sig data: <from .sig>
debug: checking signature for /var/cache/pacman/pkg/metservice-1-1-any.pkg.tar.xz

error: segmentation fault
Please submit a full bug report with --debug if appropriate.
-------------- next part --------------
debug: pacman v5.0.1 - libalpm v10.0.1
debug: config: attempting to read file /home/david/pacman-root/etc/pacman.conf
debug: config: new section 'options'
debug: config: HoldPkg: pacman
debug: config: HoldPkg: glibc
debug: config: arch: x86_64
debug: config: finished parsing /home/david/pacman-root/etc/pacman.conf
debug: setup_libalpm called
debug: option 'logfile' = /home/david/pacman-root/var/log/pacman.log
debug: option 'gpgdir' = /home/david/pacman-root/etc/pacman.d/gnupg/
debug: option 'hookdir' = /home/david/pacman-root/etc/pacman.d/hooks/
debug: option 'cachedir' = /home/david/pacman-root/var/cache/pacman/pkg/
debug: GPGME version: 1.9.0
debug: GPGME engine info: file=/usr/bin/gpg2, home=/home/david/pacman-root/etc/pacman.d/gnupg/
debug: looking up key 4BCADD9BD3246795 locally
debug: gpg error: Ambiguous name
error: required key missing from keyring
error: '/var/cache/pacman/pkg/metservice-1-1-any.pkg.tar.xz': unexpected error
debug: unregistering database 'local'
loading packages...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20170424/ac61ab02/attachment.asc>


More information about the pacman-dev mailing list