linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huawei.com>,
	dmitry.kasatkin@huawei.com, mjg59@google.com
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 3/3] ima: show rules with IMA_INMASK correctly
Date: Thu, 30 May 2019 07:53:51 -0400	[thread overview]
Message-ID: <1559217231.4008.4.camel@linux.ibm.com> (raw)
In-Reply-To: <20190529133035.28724-4-roberto.sassu@huawei.com>

On Wed, 2019-05-29 at 15:30 +0200, Roberto Sassu wrote:
> Show the '^' character when a policy rule has flag IMA_INMASK.
> 
> Fixes: 80eae209d63ac ("IMA: allow reading back the current IMA policy")
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Cc: stable@vger.kernel.org

Thanks, queued.

> ---
>  security/integrity/ima/ima_policy.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index e0cc323f948f..ae4034f041c4 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -1146,10 +1146,10 @@ enum {
>  };
>  
>  static const char *const mask_tokens[] = {
> -	"MAY_EXEC",
> -	"MAY_WRITE",
> -	"MAY_READ",
> -	"MAY_APPEND"
> +	"^MAY_EXEC",
> +	"^MAY_WRITE",
> +	"^MAY_READ",
> +	"^MAY_APPEND"
>  };
>  
>  #define __ima_hook_stringify(str)	(#str),
> @@ -1209,6 +1209,7 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	struct ima_rule_entry *entry = v;
>  	int i;
>  	char tbuf[64] = {0,};
> +	int offset = 0;
>  
>  	rcu_read_lock();
>  
> @@ -1232,15 +1233,17 @@ int ima_policy_show(struct seq_file *m, void *v)
>  	if (entry->flags & IMA_FUNC)
>  		policy_func_show(m, entry->func);
>  
> -	if (entry->flags & IMA_MASK) {
> +	if ((entry->flags & IMA_MASK) || (entry->flags & IMA_INMASK)) {
> +		if (entry->flags & IMA_MASK)
> +			offset = 1;
>  		if (entry->mask & MAY_EXEC)
> -			seq_printf(m, pt(Opt_mask), mt(mask_exec));
> +			seq_printf(m, pt(Opt_mask), mt(mask_exec) + offset);
>  		if (entry->mask & MAY_WRITE)
> -			seq_printf(m, pt(Opt_mask), mt(mask_write));
> +			seq_printf(m, pt(Opt_mask), mt(mask_write) + offset);
>  		if (entry->mask & MAY_READ)
> -			seq_printf(m, pt(Opt_mask), mt(mask_read));
> +			seq_printf(m, pt(Opt_mask), mt(mask_read) + offset);
>  		if (entry->mask & MAY_APPEND)
> -			seq_printf(m, pt(Opt_mask), mt(mask_append));
> +			seq_printf(m, pt(Opt_mask), mt(mask_append) + offset);
>  		seq_puts(m, " ");
>  	}
>  


      reply	other threads:[~2019-05-30 11:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 13:30 [PATCH v2 0/3] ima/evm fixes for v5.2 Roberto Sassu
2019-05-29 13:30 ` [PATCH v2 1/3] evm: check hash algorithm passed to init_desc() Roberto Sassu
2019-05-30 11:53   ` Mimi Zohar
2019-05-29 13:30 ` [PATCH v2 2/3] ima: don't ignore INTEGRITY_UNKNOWN EVM status Roberto Sassu
2019-05-30 12:00   ` Mimi Zohar
2019-06-03  9:25     ` Roberto Sassu
2019-06-03 12:48       ` Mimi Zohar
2019-06-03 13:43       ` James Bottomley
2019-06-03 14:24         ` Chuck Lever
2019-06-03 14:29         ` Roberto Sassu
2019-06-03 14:31           ` James Bottomley
2019-06-03 14:44             ` Roberto Sassu
2019-06-04  8:57               ` James Bottomley
2019-05-29 13:30 ` [PATCH v2 3/3] ima: show rules with IMA_INMASK correctly Roberto Sassu
2019-05-30 11:53   ` Mimi Zohar [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=1559217231.4008.4.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@huawei.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=roberto.sassu@huawei.com \
    --cc=silviu.vlasceanu@huawei.com \
    --cc=stable@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).