From: David Herrmann <dh.herrmann@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: James Morris <jmorris@namei.org>,
Paul Moore <paul@paul-moore.com>,
teg@jklm.no, Stephen Smalley <sds@tycho.nsa.gov>,
selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org,
Eric Paris <eparis@parisplace.org>,
serge@hallyn.com, Casey Schaufler <casey@schaufler-ca.com>,
davem@davemloft.net, netdev@vger.kernel.org,
David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH v2 2/4] net: hook socketpair() into LSM
Date: Fri, 4 May 2018 16:28:20 +0200 [thread overview]
Message-ID: <20180504142822.15233-3-dh.herrmann@gmail.com> (raw)
In-Reply-To: <20180504142822.15233-1-dh.herrmann@gmail.com>
Use the newly created LSM-hook for socketpair(). The default hook
return-value is 0, so behavior stays the same unless LSMs start using
this hook.
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
net/socket.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/socket.c b/net/socket.c
index f10f1d947c78..667a7b397134 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1420,6 +1420,13 @@ int __sys_socketpair(int family, int type, int protocol, int __user *usockvec)
goto out;
}
+ err = security_socket_socketpair(sock1, sock2);
+ if (unlikely(err)) {
+ sock_release(sock2);
+ sock_release(sock1);
+ goto out;
+ }
+
err = sock1->ops->socketpair(sock1, sock2);
if (unlikely(err < 0)) {
sock_release(sock2);
--
2.17.0
next prev parent reply other threads:[~2018-05-04 14:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 14:28 [PATCH v2 0/4] Introduce LSM-hook for socketpair(2) David Herrmann
2018-05-04 14:28 ` [PATCH v2 1/4] security: add hook for socketpair() David Herrmann
2018-05-04 14:28 ` David Herrmann [this message]
2018-05-04 17:31 ` [PATCH v2 2/4] net: hook socketpair() into LSM David Miller
2018-05-04 14:28 ` [PATCH v2 3/4] selinux: provide socketpair callback David Herrmann
2018-05-04 14:28 ` [PATCH v2 4/4] smack: " David Herrmann
2018-05-04 22:01 ` Casey Schaufler
2018-05-04 19:51 ` [PATCH v2 0/4] Introduce LSM-hook for socketpair(2) 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=20180504142822.15233-3-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=casey@schaufler-ca.com \
--cc=davem@davemloft.net \
--cc=eparis@parisplace.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=serge@hallyn.com \
--cc=teg@jklm.no \
/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