mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov,
	netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
	sds@tycho.nsa.gov, davem@davemloft.net,
	shemminger@linux-foundation.org, kees@ubuntu.com,
	morgan@kernel.org, casey@schaufler-ca.com, dwalsh@redhat.com
Subject: Re: [PATCH 3/3] SELinux: add selinux_kernel_module_request
Date: Thu, 13 Aug 2009 13:43:59 -0500	[thread overview]
Message-ID: <20090813184359.GB8391@us.ibm.com> (raw)
In-Reply-To: <20090813134502.29186.7938.stgit@paris.rdu.redhat.com>

Quoting Eric Paris (eparis@redhat.com):
> This patch adds a new selinux hook so SELinux can arbitrate if a given
> process should be allowed to trigger a request for the kernel to try to
> load a module.  This is a different operation than a process trying to load
> a module itself, which is already protected by CAP_SYS_MODULE.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
> 
>  security/selinux/hooks.c                     |    6 ++++++
>  security/selinux/include/av_perm_to_string.h |    1 +
>  security/selinux/include/av_permissions.h    |    1 +
>  3 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 38afca9..b0d72f1 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -3296,6 +3296,11 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode)
>  	return 0;
>  }
> 
> +static int selinux_kernel_module_request(void)
> +{
> +	return task_has_system(current, SYSTEM__MODULE_REQUEST);
> +}
> +
>  static int selinux_task_setpgid(struct task_struct *p, pid_t pgid)
>  {
>  	return current_has_perm(p, PROCESS__SETPGID);
> @@ -5457,6 +5462,7 @@ static struct security_operations selinux_ops = {
>  	.cred_prepare =			selinux_cred_prepare,
>  	.kernel_act_as =		selinux_kernel_act_as,
>  	.kernel_create_files_as =	selinux_kernel_create_files_as,
> +	.kernel_module_request =	selinux_kernel_module_request,
>  	.task_setpgid =			selinux_task_setpgid,
>  	.task_getpgid =			selinux_task_getpgid,
>  	.task_getsid =			selinux_task_getsid,
> diff --git a/security/selinux/include/av_perm_to_string.h b/security/selinux/include/av_perm_to_string.h
> index 31df1d7..2b683ad 100644
> --- a/security/selinux/include/av_perm_to_string.h
> +++ b/security/selinux/include/av_perm_to_string.h
> @@ -107,6 +107,7 @@
>     S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_READ, "syslog_read")
>     S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_MOD, "syslog_mod")
>     S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_CONSOLE, "syslog_console")
> +   S_(SECCLASS_SYSTEM, SYSTEM__MODULE_REQUEST, "module_request")
>     S_(SECCLASS_CAPABILITY, CAPABILITY__CHOWN, "chown")
>     S_(SECCLASS_CAPABILITY, CAPABILITY__DAC_OVERRIDE, "dac_override")
>     S_(SECCLASS_CAPABILITY, CAPABILITY__DAC_READ_SEARCH, "dac_read_search")
> diff --git a/security/selinux/include/av_permissions.h b/security/selinux/include/av_permissions.h
> index 0b41ad5..0546d61 100644
> --- a/security/selinux/include/av_permissions.h
> +++ b/security/selinux/include/av_permissions.h
> @@ -530,6 +530,7 @@
>  #define SYSTEM__SYSLOG_READ                       0x00000002UL
>  #define SYSTEM__SYSLOG_MOD                        0x00000004UL
>  #define SYSTEM__SYSLOG_CONSOLE                    0x00000008UL
> +#define SYSTEM__MODULE_REQUEST                    0x00000010UL
>  #define CAPABILITY__CHOWN                         0x00000001UL
>  #define CAPABILITY__DAC_OVERRIDE                  0x00000002UL
>  #define CAPABILITY__DAC_READ_SEARCH               0x00000004UL
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-08-13 18:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13 13:44 [PATCH 1/3] Networking: use CAP_NET_ADMIN when deciding to call request_module Eric Paris
2009-08-13 13:44 ` [PATCH 2/3] security: introducing security_request_module Eric Paris
2009-08-13 14:03   ` Serge E. Hallyn
2009-08-13 15:28     ` Eric Paris
2009-08-13 17:54       ` Serge E. Hallyn
2009-08-13 18:19         ` Eric Paris
2009-08-13 18:31           ` Serge E. Hallyn
2009-08-13 18:40   ` Serge E. Hallyn
2009-08-13 13:45 ` [PATCH 3/3] SELinux: add selinux_kernel_module_request Eric Paris
2009-08-13 18:43   ` Serge E. Hallyn [this message]
2009-08-13 14:01 ` [PATCH 1/3] Networking: use CAP_NET_ADMIN when deciding to call request_module Serge E. Hallyn
2009-08-13 18:45 ` Paul Moore
2009-08-13 22:55   ` James Morris
2009-08-13 23:14   ` David Miller
2009-08-14  1:56 ` 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=20090813184359.GB8391@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=casey@schaufler-ca.com \
    --cc=davem@davemloft.net \
    --cc=dwalsh@redhat.com \
    --cc=eparis@redhat.com \
    --cc=kees@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=shemminger@linux-foundation.org \
    /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

Powered by JetHome