public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: maximilian attems <max@stro.at>
To: Mike Waychison <mikew@google.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	"Andrew G. Morgan" <agm@google.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Eric Northup <digitaleric@google.com>,
	Eric Paris <eparis@parisplace.org>,
	klibc@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] kinit: Add drop_capabilities support.
Date: Mon, 22 Aug 2011 22:31:02 +0200	[thread overview]
Message-ID: <20110822203102.GA22687@stro.at> (raw)
In-Reply-To: <20110803163046.29085.89618.stgit@mike2.sea.corp.google.com>

On Wed, 03 Aug 2011, Mike Waychison wrote:

> This patch adds the ability to kinit to allow the dropping of POSIX
> capabilities.
> 
> kinit is modified by this change, such that it understands the new
> kernel command line "drop_capabilities=" that specifies a comma
> separated list of capability names that should be dropped before
> switching over to the next init in the boot strap (typically on the root
> disk).
> 
> Dropping of capabilities happens in three parts.  We explicitly drop the
> capability from init's inherited masks.  We also drop the capability
> from the bounding set using PR_CAPBSET_DROP so that later setuid execs
> are bounded.  Lastly, we drop the capabilities from the bset and
> inherited masks exposed at /proc/sys/kernel/usermodehelper if available
> (introduced in Linux v3.0.0).
> 
> In all paths, we treat errors as fatal, as we do not want to continue to
> boot if there was a problem dropping capabilities.  We fail because the
> new drop_capabilities= option on the command line mandates enforcement
> of a security policy, and we should err on the side of caution if we
> ever fail to satisfy the administrator's intention.
> 
> Signed-off-by: Mike Waychison <mikew@google.com>
> ---
> v3
>     - Removed special handling of dropping CAP_SETPCAP now that we are
>       only dropping the capability from the inherited mask as suggested
>       by Andrew Morgan.
> v2
>     - Only drop from the inherited capabilities mask.  Only this mask
>       was required as per Andrew Morgan.  This also allows us to
>       continue having capabilities to call run-init later on, allowing
>       the following:
>     - Moved dropping of capabilities out of run-init and into kinit.
>       This was required to ensure access to the proc filesystem, which
>       is required for manipulating the masks the kernel uses when
>       spawning new tasks on the kernel's behalf via the
>       call_usermodehelper() routine.
>     - Fixed paths to the usermodehelper settings files.
>     - Fixed sscanf to allow for a newline character when reading the
>       usermodehelper capability mask settings.
>     - Fixed the return check of the write to the usermodehelper files.
>       These proc files return 0 on successful write(2).
>     - Added a format atttribute to the fail() wrapper for better
>       compiler warnings.
>     - Removed kernel version check.  The boot will now always fail if we
>       could not manipulate the usermodehelper settings.
>     - Sent as a single patch as capset/capget are now in klibc master.
> ---

Should appear shortly on:
http://git.kernel.org/?p=libs/klibc/klibc.git;a=summary
Applied and pushed. Thank you!

-- 
maks

      reply	other threads:[~2011-08-22 20:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03  1:16 [PATCH v2] kinit: Add drop_capabilities support Mike Waychison
2011-08-03  2:44 ` Andrew G. Morgan
2011-08-03 16:30   ` [PATCH v3] " Mike Waychison
2011-08-22 20:31     ` maximilian attems [this message]

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=20110822203102.GA22687@stro.at \
    --to=max@stro.at \
    --cc=agm@google.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=digitaleric@google.com \
    --cc=eparis@parisplace.org \
    --cc=hpa@zytor.com \
    --cc=klibc@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikew@google.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