qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: thuth@redhat.com, "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, vgoyal@redhat.com
Subject: Re: libcap vs libcap-ng mess
Date: Fri, 29 Nov 2019 18:20:21 +0000	[thread overview]
Message-ID: <20191129182021.GD2837@work-vm> (raw)
In-Reply-To: <1e59f880-1a62-3230-c56a-533f2b797525@redhat.com>

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> On 29/11/19 19:01, Dr. David Alan Gilbert wrote:
> >> It's not entirely trivial because fsdev-proxy-helper wants to keep the
> >> effective set and clear the permitted set; in libcap-ng you can only
>                      ^^^^^
> 
> (Wrong, this is "modify" the permitted set.  The permitted set is
> already cleared by setresuid/setresgid).
> 
> >> apply both sets at once, and you cannot choose only one of them in
> >> capng_clear/capng_get_caps_process.  But it's doable, I'll take a look.
> > I'm having some difficulties making the same conversion for virtiofsd;
> > all it wants to do is drop (and later recover) CAP_FSETID
> > from it's effective set;  so I'm calling capng_get_caps_process
> > (it used to be cap_get_proc).  While libcap survives just using the
> > capget syscall, libcap-ng wants to read /proc/<TID>/status - and
> > that's a problem because we're in a sandbox without /proc mounted
> > at that point.
> 
> The state of libcap-ng persists after capng_apply.  So you can just call
> capng_update({CAP_ADD,CAP_DROP}) followed by capng_apply.

But the internal state needs initialising doesn't it? So that when you
capng_update it tweaks a set that was originally read from somewhere?
(and that's per-thread?)

> Does virtiofsd have to do uid/gid dances like virtfs-proxy-helper?

It looks like it; I can see setresuid calls to save and restore
euid/egid.

Dave

> Thanks,
> 
> Paolo
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 19:04 libcap vs libcap-ng mess Dr. David Alan Gilbert
2019-11-29  9:34 ` Daniel P. Berrangé
2019-11-29 10:46   ` Paolo Bonzini
2019-11-29 10:51     ` Dr. David Alan Gilbert
2019-11-29 18:01     ` Dr. David Alan Gilbert
2019-11-29 18:12       ` Paolo Bonzini
2019-11-29 18:20         ` Dr. David Alan Gilbert [this message]
2019-11-29 18:27           ` Paolo Bonzini
2019-11-29 18:54             ` Dr. David Alan Gilbert
2019-11-29 23:19               ` Paolo Bonzini
2019-12-02 10:07                 ` Dr. David Alan Gilbert
2019-12-02 10:33                   ` Paolo Bonzini

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=20191129182021.GD2837@work-vm \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=vgoyal@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 NNTP newsgroup(s).