lkml.org 
[lkml]   [2022]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 08/14] security: Move call_rcu() to call_rcu_lazy()
Date
This is required to prevent callbacks triggering RCU machinery too
quickly and too often, which adds more power to the system.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
security/security.c | 2 +-
security/selinux/avc.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/security.c b/security/security.c
index ea7163c20751..d76f4951b2bd 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1053,7 +1053,7 @@ void security_inode_free(struct inode *inode)
* The inode will be freed after the RCU grace period too.
*/
if (inode->i_security)
- call_rcu((struct rcu_head *)inode->i_security,
+ call_rcu_lazy((struct rcu_head *)inode->i_security,
inode_free_by_rcu);
}

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 9a43af0ebd7d..381f046d820f 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -442,7 +442,7 @@ static void avc_node_free(struct rcu_head *rhead)
static void avc_node_delete(struct selinux_avc *avc, struct avc_node *node)
{
hlist_del_rcu(&node->list);
- call_rcu(&node->rhead, avc_node_free);
+ call_rcu_lazy(&node->rhead, avc_node_free);
atomic_dec(&avc->avc_cache.active_nodes);
}

@@ -458,7 +458,7 @@ static void avc_node_replace(struct selinux_avc *avc,
struct avc_node *new, struct avc_node *old)
{
hlist_replace_rcu(&old->list, &new->list);
- call_rcu(&old->rhead, avc_node_free);
+ call_rcu_lazy(&old->rhead, avc_node_free);
atomic_dec(&avc->avc_cache.active_nodes);
}

--
2.37.2.609.g9ff673ca1a-goog
\
 
 \ /
  Last update: 2022-08-19 22:51    [W:0.096 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site