Home GnuPG

core: Expect (and verify) a uid on "owner" option.

Description

core: Expect (and verify) a uid on "owner" option.

* pinentry/pinentry.h (struct pinentry): Add field 'owner_uid'.
* pinentry/pinentry.c (pinentry_reset): Handle this new field.
(get_pid_name_for_uid): New. Atomic check for the base process name
contingent on process ownership.
(pinentry_get_title): Only scan for full commandline if the process
actually belongs to the claimed uid.
(option_handler): Option "owner" now expects "pid/uid hostname".

This requires an update to gpg's use of the "owner" option to emit the
uid (which will follow shortly). It is not as atomic as it should be.
In particular, there's a race condition between reading from
/proc/PID/status and reading from /proc/PID/cmdline, but it's a much
smaller race than there was previously.

Werner suggested using a / between pid/uid instead of whitespace.

  • Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

Details

Provenance
dkgAuthored on Feb 5 2017, 6:44 AM
Parents
rP1f5b35153120: core: Only scan for the command line if probably on the same host.
Branches
Unknown
Tags
Unknown