From: Casey Schaufler <casey@schaufler-ca.com>
To: Rafal Krypa <r.krypa@samsung.com>
Cc: linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org,
Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH] Smack: don't show empty rules when /smack/load or /smack/load2 is read
Date: Wed, 11 Jul 2012 08:20:32 -0700 [thread overview]
Message-ID: <4FFD99C0.5090200@schaufler-ca.com> (raw)
In-Reply-To: <1341855394-13359-1-git-send-email-r.krypa@samsung.com>
On 7/9/2012 10:36 AM, Rafal Krypa wrote:
> This patch removes empty rules (i.e. with access set to '-') from the
> rule list presented to user space.
>
> Smack by design never removes labels nor rules from its lists. Access
> for a rule may be set to '-' to effectively disable it. Such rules would
> show up in the listing generated when /smack/load or /smack/load2 is
> read. This may cause clutter if many rules were disabled.
>
> As a rule with access set to '-' is equivalent to no rule at all, they
> may be safely hidden from the listing.
>
> Targeted for git://git.gitorious.org/smack-next/kernel.git
Applied to git://git.gitorious.org/smack-next/kernel.git
>
> Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
> ---
> security/smack/smackfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
> index 29b760d..d31e6d9 100644
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -518,6 +518,9 @@ static void smk_rule_show(struct seq_file *s, struct smack_rule *srp, int max)
> if (strlen(srp->smk_subject) >= max || strlen(srp->smk_object) >= max)
> return;
>
> + if (srp->smk_access == 0)
> + return;
> +
> seq_printf(s, "%s %s", srp->smk_subject, srp->smk_object);
>
> seq_putc(s, ' ');
> @@ -532,8 +535,6 @@ static void smk_rule_show(struct seq_file *s, struct smack_rule *srp, int max)
> seq_putc(s, 'a');
> if (srp->smk_access & MAY_TRANSMUTE)
> seq_putc(s, 't');
> - if (srp->smk_access == 0)
> - seq_putc(s, '-');
>
> seq_putc(s, '\n');
> }
prev parent reply other threads:[~2012-07-11 15:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 17:36 [PATCH] Smack: don't show empty rules when /smack/load or /smack/load2 is read Rafal Krypa
2012-07-11 15:20 ` Casey Schaufler [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=4FFD99C0.5090200@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=r.krypa@samsung.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