From: Denis Obrezkov <denisobrezkov@gmail.com>
To: Casey Schaufler <casey@schaufler-ca.com>,
linux-security-module@vger.kernel.org
Subject: Re: Custom LSM: getting a null pointer dereference when trying to access a task security blob
Date: Sun, 23 Jan 2022 20:58:48 +0100 [thread overview]
Message-ID: <882d62bb-1cc2-0019-cc8c-cdacea31e8d3@gmail.com> (raw)
In-Reply-To: <028166ec-0921-977e-8990-4134b5920cad@schaufler-ca.com>
>
> There's nowhere near enough information here to identify what's
> going wrong here. Is the KeyLock code otherwise a copy of Smack?
> Have you registered KeyLock correctly with the infrastructure?
>
Yes, right now the only difference is that I don't have a single
repository for all labels. For each task/inode I store only a pointer to
a head of a list of its own labels. I want to store pointers in
creds->security and inode->i_security. So, basically each subject will
have its own repository of (its) labels.
Right now, I have only one security context which is defined in my .c file:
struct keylock_known keylock_known_system = {
.label = "system\n",
.kl_mask = 7,
};
First tasks receive the pointer to this structure and I can see that the
pointer value for them is non-zero. But later I can see that other tasks
in keylock_inode_alloc_security have zero pointers,
I have two hypotheses. First is that my keylock_known_system is not
visible to other tasks (though it is initialized in a global scope of my
.c file). Second is that I didn't implement some crucial hooks and a new
task is created without a label. I have implemented those hooks:
static struct security_hook_list keylock_hooks[] __lsm_ro_after_init = {
LSM_HOOK_INIT(inode_alloc_security, keylock_inode_alloc_security),
LSM_HOOK_INIT(inode_init_security, keylock_inode_init_security),
LSM_HOOK_INIT(task_to_inode, keylock_task_to_inode),
LSM_HOOK_INIT(cred_transfer, keylock_cred_transfer),
LSM_HOOK_INIT(cred_alloc_blank, keylock_cred_alloc_blank),
};
And I initialized my KeyLock LSM in a way similar to that of SMACK.
--
Regards, Denis Obrezkov
next prev parent reply other threads:[~2022-01-23 19:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-23 15:47 Custom LSM: getting a null pointer dereference when trying to access a task security blob Denis Obrezkov
2022-01-23 17:01 ` Casey Schaufler
2022-01-23 19:58 ` Denis Obrezkov [this message]
2022-01-24 9:56 ` Denis Obrezkov
2022-01-24 17:23 ` Casey Schaufler
2022-01-24 21:51 ` Denis Obrezkov
2022-01-26 17:36 ` Casey Schaufler
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=882d62bb-1cc2-0019-cc8c-cdacea31e8d3@gmail.com \
--to=denisobrezkov@gmail.com \
--cc=casey@schaufler-ca.com \
--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;
as well as URLs for NNTP newsgroup(s).