From: Ondrej Kozina <okozina@redhat.com>
To: dm-devel@redhat.com
Cc: Ondrej Kozina <okozina@redhat.com>,
mgrac@redhat.com, kas@fi.muni.cz, mbroz@redhat.com
Subject: [RFC PATCH v2 3/3] Adds support for security checks in the crypt target
Date: Fri, 25 May 2012 15:22:28 +0200 [thread overview]
Message-ID: <1337952148-20888-4-git-send-email-okozina@redhat.com> (raw)
In-Reply-To: <1337952148-20888-1-git-send-email-okozina@redhat.com>
Just a security check implementation for the crypt target
---
drivers/md/dm-crypt.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 3f06df5..af6f319 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1867,9 +1867,24 @@ static int crypt_iterate_devices(struct dm_target *ti,
return fn(ti, cc->dev, cc->start, ti->len, data);
}
+static int crypt_security(struct dm_target *ti, unsigned int argc, char **argv)
+{
+ int r;
+
+ if (argc < 4) {
+ ti->error = "dm-crypt: Security check: invalid number of parameters";
+ return -EINVAL;
+ }
+ r = dm_check_backing_dev_permission(ti, argv[3]);
+ if (r)
+ ti->error = "dm-crypt: Security check failed";
+
+ return r;
+}
+
static struct target_type crypt_target = {
.name = "crypt",
- .version = {1, 11, 0},
+ .version = {1, 12, 0},
.module = THIS_MODULE,
.ctr = crypt_ctr,
.dtr = crypt_dtr,
@@ -1881,6 +1896,7 @@ static struct target_type crypt_target = {
.message = crypt_message,
.merge = crypt_merge,
.iterate_devices = crypt_iterate_devices,
+ .security = crypt_security
};
static int __init dm_crypt_init(void)
--
1.7.8.6
prev parent reply other threads:[~2012-05-25 13:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 19:13 [RFC PATCH 0/4] Allow user w/o CAP_SYS_ADMIN to submit ioctl commands into DM okozina
2012-05-02 19:13 ` [RFC PATCH 1/4] Adds support for user-submitted ioctl commands okozina
2012-05-02 19:13 ` [RFC PATCH 2/4] Adds support for the dentry lookup from path or major:minor couple during target security check okozina
2012-05-02 19:13 ` [RFC PATCH 3/4] Adds support for security checks in the linear target okozina
2012-05-02 19:13 ` [RFC PATCH 4/4] Adds support for security checks in the crypt target okozina
2012-05-25 13:22 ` [RFC PATCH v2 0/3] Allow user w/o CAP_SYS_ADMIN to submit ioctl commands into DM Ondrej Kozina
2012-05-25 13:22 ` [RFC PATCH v2 1/3] Adds support for user-submitted ioctl commands Ondrej Kozina
2012-05-25 13:22 ` [RFC PATCH v2 2/3] Adds support for security checks in the linear target Ondrej Kozina
2012-05-25 13:22 ` Ondrej Kozina [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=1337952148-20888-4-git-send-email-okozina@redhat.com \
--to=okozina@redhat.com \
--cc=dm-devel@redhat.com \
--cc=kas@fi.muni.cz \
--cc=mbroz@redhat.com \
--cc=mgrac@redhat.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;
as well as URLs for NNTP newsgroup(s).