* [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant
@ 2018-05-22 14:06 Petko Manolov
2018-05-23 15:37 ` Mimi Zohar
0 siblings, 1 reply; 2+ messages in thread
From: Petko Manolov @ 2018-05-22 14:06 UTC (permalink / raw)
To: Mimi Zohar; +Cc: Linux Integrity
Hi Mimi,
Please review and consider this patch for mainlining if it looks OK to you.
I've tested it on v4.17.0-rc6 and seems to be working fine.
Petko
---
>From e5cb36d4470cf64af2087fba4615ee8539385c98 Mon Sep 17 00:00:00 2001
From: Petko Manolov <petko.manolov@konsulko.com>
Date: Fri, 18 May 2018 14:10:57 +0300
Subject: [PATCH] Replace the open coded version with
list_splice_tail_init_rcu()
Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
---
security/integrity/ima/ima_policy.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index d89bebf85421..722466f843ef 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -509,22 +509,9 @@ int ima_check_policy(void)
*/
void ima_update_policy(void)
{
- struct list_head *first, *last, *policy;
+ struct list_head *policy = &ima_policy_rules;
- /* append current policy with the new rules */
- first = (&ima_temp_rules)->next;
- last = (&ima_temp_rules)->prev;
- policy = &ima_policy_rules;
-
- synchronize_rcu();
-
- last->next = policy;
- rcu_assign_pointer(list_next_rcu(policy->prev), first);
- first->prev = policy->prev;
- policy->prev = last;
-
- /* prepare for the next policy rules addition */
- INIT_LIST_HEAD(&ima_temp_rules);
+ list_splice_tail_init_rcu(&ima_temp_rules, policy, synchronize_rcu);
if (ima_rules != policy) {
ima_policy_flag = 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant
2018-05-22 14:06 [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant Petko Manolov
@ 2018-05-23 15:37 ` Mimi Zohar
0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2018-05-23 15:37 UTC (permalink / raw)
To: Petko Manolov; +Cc: Linux Integrity
Hi Petko,
On Tue, 2018-05-22 at 17:06 +0300, Petko Manolov wrote:
The patch description is missing. Is the following ok?
Use list_splice_tail_init_rcu() to extend the existing custom IMA
policy with additional IMA policy rules.
Mimi
>
> Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
> ---
> security/integrity/ima/ima_policy.c | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index d89bebf85421..722466f843ef 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -509,22 +509,9 @@ int ima_check_policy(void)
> */
> void ima_update_policy(void)
> {
> - struct list_head *first, *last, *policy;
> + struct list_head *policy = &ima_policy_rules;
>
> - /* append current policy with the new rules */
> - first = (&ima_temp_rules)->next;
> - last = (&ima_temp_rules)->prev;
> - policy = &ima_policy_rules;
> -
> - synchronize_rcu();
> -
> - last->next = policy;
> - rcu_assign_pointer(list_next_rcu(policy->prev), first);
> - first->prev = policy->prev;
> - policy->prev = last;
> -
> - /* prepare for the next policy rules addition */
> - INIT_LIST_HEAD(&ima_temp_rules);
> + list_splice_tail_init_rcu(&ima_temp_rules, policy, synchronize_rcu);
>
> if (ima_rules != policy) {
> ima_policy_flag = 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-23 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22 14:06 [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant Petko Manolov
2018-05-23 15:37 ` Mimi Zohar
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).