Linux Security Modules development
 help / color / mirror / Atom feed
From: Denis Obrezkov <denisobrezkov@gmail.com>
To: Casey Schaufler <casey@schaufler-ca.com>,
	linux-security-module@vger.kernel.org
Subject: Re: SMACK: how are smack blobs getting into cred->security and inode->i_security?
Date: Sat, 1 Jan 2022 22:34:54 +0100	[thread overview]
Message-ID: <eedaa146-c4a6-6761-8e9c-56fd038a8b27@gmail.com> (raw)
In-Reply-To: <8cd68537-8ac4-625d-3416-3ce6eba938f1@schaufler-ca.com>

> The LSM infrastructure (security/security.c) allocates cred and inode
> security blobs. This allows multiple security modules to use them.
> 
>>   Also, when does it happen? (for a task and for a
>> file)
> 
> security_cred_alloc() and security_inode_alloc().
> 
I mean how is information from SMACK64EXEC and SMACK64 getting into
those blobs? Do I understand the sequence right:

First, both labels (SMACK64EXEC and SMACK64) are installed in
smack_inode_post_setxattr. Second, when we launch a program, there is a
hook smack_bprm_creds_for_exec that installs a security label from the
program file inode into the corresponding smack task structure. Third,
when the program tries to access a file, it is caught in the
smack_inode_permission.

I am also not sure what is happening in security_inode_alloc. Does it
just copy a pointer to a security structure of a current task?

I also can't find where security_cred_alloc is used. I found
security_cred_alloc_blank but it is called only from cred_alloc_blank
from cred.c (and I can't find from where the latter is called).

-- 
Regards, Denis Obrezkov

  reply	other threads:[~2022-01-01 21:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 13:08 SMACK: how are smack blobs getting into cred->security and inode->i_security? Denis Obrezkov
2021-12-31 17:25 ` Casey Schaufler
2022-01-01 21:34   ` Denis Obrezkov [this message]
2022-01-02 21:26     ` 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=eedaa146-c4a6-6761-8e9c-56fd038a8b27@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