public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel•org>
To: Kees Cook <keescook@chromium•org>
Cc: "Luis R. Rodriguez" <mcgrof@kernel•org>,
	Djalal Harouni <tixxdz@gmail•com>,
	Andy Lutomirski <luto@kernel•org>,
	Andrew Morton <akpm@linux-foundation•org>,
	James Morris <james.l.morris@oracle•com>,
	Ben Hutchings <ben.hutchings@codethink•co.uk>,
	Solar Designer <solar@openwall•com>,
	Serge Hallyn <serge@hallyn•com>, Jessica Yu <jeyu@kernel•org>,
	Rusty Russell <rusty@rustcorp•com.au>,
	LKML <linux-kernel@vger•kernel.org>,
	linux-security-module <linux-security-module@vger•kernel.org>,
	kernel-hardening@lists•openwall.com,
	Jonathan Corbet <corbet@lwn•net>, Ingo Molnar <mingo@kernel•org>,
	"David S. Miller" <davem@davemloft•net>,
	Network Development <netdev@vger•kernel.org>,
	Peter Zijlstra <peterz@infradead•org>,
	Linus Torvalds <torvalds@linux-foundation•org>
Subject: Re: [PATCH v5 next 1/5] modules:capabilities: add request_module_cap()
Date: Tue, 28 Nov 2017 23:48:49 +0100	[thread overview]
Message-ID: <20171128224849.GT729@wotan.suse.de> (raw)
In-Reply-To: <CAGXu5jKqMeBUB4iArqw9_iyKqm3NjpCrU_byy90kZrAHDb0c9w@mail.gmail.com>

On Tue, Nov 28, 2017 at 02:18:18PM -0800, Kees Cook wrote:
> On Tue, Nov 28, 2017 at 2:12 PM, Luis R. Rodriguez <mcgrof@kernel•org> wrote:
> > On Tue, Nov 28, 2017 at 01:39:58PM -0800, Kees Cook wrote:
> >> On Tue, Nov 28, 2017 at 1:16 PM, Luis R. Rodriguez <mcgrof@kernel•org> wrote:
> >> > And *all* auto-loading uses aliases? What's the difference between auto-loading
> >> > and direct-loading?
> >>
> >> The difference is the process privileges. Unprivilged autoloading
> >> (e.g. int n_hdlc = N_HDLC; ioctl(fd,
> >> TIOCSETD, &n_hdlc)), triggers a privileged call to finit_module()
> >> under CAP_SYS_MODULE.
> >
> > Ah, so system call implicated request_module() calls.
> 
> Yup. Unprivileged user does something that ultimately hits a
> request_module() in the kernel. Then the kernel calls out with the
> usermode helper (which has CAP_SYS_MODULE) and calls finit_module().

Thanks, using this terminology is much better to understand than auto-loading,
given it does make it clear an unprivileged call was one that initiated the
request_module() call, there are many uses of request_module() which *are*
privileged.

> > OK and since CAP_SYS_MODULE is much more restrictive one could argue, what's the
> > point here?
> 
> The goal is to block an unprivileged user from being able to trigger a
> module load without blocking root from loading modules directly.

I see now. Do we have an audit of all system calls which implicate a
request_module() call? Networking is a good example for sure to start
off with but I was curious if we have a grasp of how wide spread this
could be.

I'll go review the patches again now with all this in mind.

  Luis

  reply	other threads:[~2017-11-28 22:48 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 17:18 [PATCH v5 next 0/5] Improve Module autoloading infrastructure Djalal Harouni
2017-11-27 17:18 ` [PATCH v5 next 1/5] modules:capabilities: add request_module_cap() Djalal Harouni
2017-11-27 18:48   ` Randy Dunlap
2017-11-27 21:35     ` Djalal Harouni
2017-11-28 19:14   ` Luis R. Rodriguez
2017-11-28 20:11     ` Kees Cook
2017-11-28 21:16       ` Luis R. Rodriguez
2017-11-28 21:33         ` Djalal Harouni
2017-11-28 22:18           ` Luis R. Rodriguez
2017-11-28 22:52             ` Djalal Harouni
2017-11-28 21:39         ` Kees Cook
2017-11-28 22:12           ` Luis R. Rodriguez
2017-11-28 22:18             ` Kees Cook
2017-11-28 22:48               ` Luis R. Rodriguez [this message]
2017-11-29  7:49                 ` Michal Kubecek
2017-11-29 13:46           ` Alan Cox
2017-11-29 14:50             ` David Miller
2017-11-29 15:54               ` Theodore Ts'o
2017-11-29 15:58                 ` David Miller
2017-11-29 16:29                   ` Theodore Ts'o
2017-11-29 22:45                   ` Linus Torvalds
2017-11-30  0:06                     ` Kees Cook
2017-11-29 17:28                 ` Serge E. Hallyn
2017-11-30  0:35                   ` Theodore Ts'o
2017-11-30 17:17                     ` Serge E. Hallyn
2017-11-28 20:18     ` Djalal Harouni
2017-11-27 17:18 ` [PATCH v5 next 2/5] modules:capabilities: add cap_kernel_module_request() permission check Djalal Harouni
2017-11-30  2:05   ` Luis R. Rodriguez
2017-11-27 17:18 ` [PATCH v5 next 3/5] modules:capabilities: automatic module loading restriction Djalal Harouni
2017-11-30  1:23   ` Luis R. Rodriguez
2017-11-30 12:22     ` Djalal Harouni
2017-11-27 17:18 ` [PATCH v5 next 4/5] modules:capabilities: add a per-task modules auto-load mode Djalal Harouni
2017-11-27 17:18 ` [PATCH v5 next 5/5] net: modules: use request_module_cap() to load 'netdev-%s' modules Djalal Harouni
2017-11-27 18:44   ` Linus Torvalds
2017-11-27 21:41     ` Djalal Harouni
2017-11-27 22:04       ` Linus Torvalds
2017-11-27 22:59         ` Kees Cook
2017-11-27 23:14           ` Linus Torvalds
2017-11-27 23:19             ` Kees Cook
2017-11-27 23:35               ` Linus Torvalds
2017-11-28  1:23             ` Kees Cook
2017-11-27 18:41 ` [PATCH v5 next 0/5] Improve Module autoloading infrastructure Linus Torvalds
2017-11-27 19:02   ` Linus Torvalds
2017-11-27 19:12     ` Linus Torvalds
2017-11-27 21:31       ` Djalal Harouni
2017-11-27 19:14   ` David Miller
2017-11-27 22:31     ` James Morris
2017-11-27 23:04       ` Kees Cook
2017-11-27 23:44         ` James Morris

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=20171128224849.GT729@wotan.suse.de \
    --to=mcgrof@kernel$(echo .)org \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=ben.hutchings@codethink$(echo .)co.uk \
    --cc=corbet@lwn$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=james.l.morris@oracle$(echo .)com \
    --cc=jeyu@kernel$(echo .)org \
    --cc=keescook@chromium$(echo .)org \
    --cc=kernel-hardening@lists$(echo .)openwall.com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-security-module@vger$(echo .)kernel.org \
    --cc=luto@kernel$(echo .)org \
    --cc=mingo@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peterz@infradead$(echo .)org \
    --cc=rusty@rustcorp$(echo .)com.au \
    --cc=serge@hallyn$(echo .)com \
    --cc=solar@openwall$(echo .)com \
    --cc=tixxdz@gmail$(echo .)com \
    --cc=torvalds@linux-foundation$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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