Linux Security Modules development
 help / color / mirror / Atom feed
From: sargun@sargun.me (Sargun Dhillon)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 0/2] Change LSM registration to work with persistent struct
Date: Thu, 17 May 2018 07:00:35 +0000	[thread overview]
Message-ID: <20180517070033.GA22143@ircssh-2.c.rugged-nimbus-611.internal> (raw)

This patchset breaks out the first patch from my patchset a while ago, which
started introducing external LSMs. One of the ideas was to make the management
of which LSMs are loaded a bit simpler. In the process, I discovered the
following bug:
root at ubuntu:~# dmesg |grep SELinux
[    0.044035] SELinux:  Initializing.
[    0.052063] SELinux:  Starting in permissive mode
[    3.625348] SELinux:  Registering netfilter hooks
root at ubuntu:~# cat /sys/kernel/security/lsm;echo
capability,yama,loadpin,selinux
root at ubuntu:~# echo 1 > /sys/fs/selinux/disable
root at ubuntu:~# dmesg |grep SELinux
[    0.044035] SELinux:  Initializing.
[    0.052063] SELinux:  Starting in permissive mode
[    3.625348] SELinux:  Registering netfilter hooks
[  189.230174] SELinux:  Disabled at runtime.
[  189.230398] SELinux:  Unregistering netfilter hooks
root at ubuntu:~# cat /sys/kernel/security/lsm;echo
capability,yama,loadpin,selinux

After this fix, it makes it so that it will be properly
removed, a la:
root at ubuntu:~# dmesg |grep SELinux
[    0.040169] SELinux:  Initializing.
[    0.048067] SELinux:  Starting in permissive mode
[    3.023873] SELinux:  Registering netfilter hooks
root at ubuntu:~# cat /sys/kernel/security/lsm;echo
capability,yama,loadpin,selinux
root at ubuntu:~# echo 1 > /sys/fs/selinux/disable
root at ubuntu:~# dmesg |grep SELinux
[    0.040169] SELinux:  Initializing.
[    0.048067] SELinux:  Starting in permissive mode
[    3.023873] SELinux:  Registering netfilter hooks
[  136.059277] SELinux:  Disabled at runtime.
[  136.059505] SELinux:  Unregistering netfilter hooks
root at ubuntu:~# cat /sys/kernel/security/lsm;echo
capability,yama,loadpin

This is pretty low-risk, but introduces two minor conflicts to:
[01/23] procfs: add smack subdir to attrs
[21/23] LSM: Multiple concurrent major security modules


Sargun Dhillon (2):
  security: Move LSM registration arguments to struct lsm_info
  security: Convert lsm list file to a seq_file based on lsm_info_head

 include/linux/lsm_hooks.h  | 47 +++++++++++--------------
 security/apparmor/lsm.c    |  5 +--
 security/commoncap.c       |  6 ++--
 security/inode.c           | 56 ++++++++++++++++++++++++++----
 security/loadpin/loadpin.c |  5 ++-
 security/security.c        | 85 +++++++++++++++++++++-------------------------
 security/security.h        | 10 ++++++
 security/selinux/hooks.c   |  7 ++--
 security/smack/smack_lsm.c |  4 ++-
 security/tomoyo/tomoyo.c   |  5 ++-
 security/yama/yama_lsm.c   |  5 ++-
 11 files changed, 146 insertions(+), 89 deletions(-)
 create mode 100644 security/security.h

-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2018-05-17  7:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180517070033.GA22143@ircssh-2.c.rugged-nimbus-611.internal \
    --to=sargun@sargun.me \
    --cc=linux-security-module@vger.kernel.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