[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <336cc947-1f70-0286-6506-6df3d1d23a1d@linux.vnet.ibm.com>
Date: Fri, 17 Jul 2020 14:56:46 -0400
From: Nayna <nayna@...ux.vnet.ibm.com>
To: Tyler Hicks <tyhicks@...ux.microsoft.com>
Cc: Mimi Zohar <zohar@...ux.ibm.com>,
Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
James Morris <jmorris@...ei.org>,
"Serge E . Hallyn" <serge@...lyn.com>,
Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>,
Prakhar Srivastava <prsriva02@...il.com>,
linux-kernel@...r.kernel.org, linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH v3 06/12] ima: Fail rule parsing when the KEY_CHECK hook
is combined with an invalid cond
On 7/9/20 2:19 AM, Tyler Hicks wrote:
> The KEY_CHECK function only supports the uid, pcr, and keyrings
> conditionals. Make this clear at policy load so that IMA policy authors
> don't assume that other conditionals are supported.
>
> Fixes: 5808611cccb2 ("IMA: Add KEY_CHECK func to measure keys")
> Signed-off-by: Tyler Hicks <tyhicks@...ux.microsoft.com>
> Reviewed-by: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
> ---
>
> * v3
> - Added Lakshmi's Reviewed-by
> - Adjust for the indentation change introduced in patch #4
> * v2
> - No change
>
> security/integrity/ima/ima_policy.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 1c64bd6f1728..81da02071d41 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -1023,6 +1023,13 @@ static bool ima_validate_rule(struct ima_rule_entry *entry)
> if (entry->action & ~(MEASURE | DONT_MEASURE))
> return false;
>
> + if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR |
> + IMA_KEYRINGS))
> + return false;
> +
> + if (ima_rule_contains_lsm_cond(entry))
> + return false;
> +
> break;
> default:
> return false;
Should there be a check for IMA_MEASURE_ASYMMETRIC_KEYS in Opt_keyrings
in ima_parse_rule() to return immediately if not enabled ?
Thanks & Regards,
- Nayna
Powered by blists - more mailing lists