conditionally reschedule in hashtab_insert while loading selinux policy.
PATCH 2/2 conditionally reschedule in hashtab_insert while loading selinux policy.
After silencing the sleeping warning in mls_convert_context() I started seeing similar traces from hashtab_insert. Do a cond_resched there too.
Signed-off-by Dave Jones <[email protected]>
security/selinux/ss/hashtab.c +3 -0
@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/sched.h> #include "hashtab.h" struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
@@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)u32 hvalue;struct hashtab_node *prev, *cur, *newnode; +cond_resched (); +if (!h || h->nel ==HASHTAB_MAX_NODES )return -EINVAL ;
Signature · 1 line
1.9.0
Quoted 4 lines · Dave Jones
After silencing the sleeping warning in
mls_convert_context()I started seeing similar traces fromhashtab_insert. Do acond_reschedthere too.Signed-off-by Dave Jones <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Quoted 23 lines
security/selinux/ss/hashtab.c +3
-0@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/sched.h> #include "hashtab.h" struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),@@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)u32 hvalue;struct hashtab_node *prev, *cur, *newnode; +cond_resched (); +if (!h || h->nel ==HASHTAB_MAX_NODES )return -EINVAL ;
Paul Moore
AppliedQuoted 4 lines · Dave Jones
After silencing the sleeping warning in
mls_convert_context()I started seeing similar traces fromhashtab_insert. Do acond_reschedthere too.Signed-off-by Dave Jones <[email protected]>
Merged to the SELinux #next branch, thanks.
Quoted 20 lines
security/selinux/ss/hashtab.c +1
-0@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/sched.h> #include "hashtab.h" struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, constvoid *key), @@ -40,6 +41,8 @@ int
hashtab_insert(struct hashtab *h, void *key, void *datum)u32 hvalue;security/selinux/ss/hashtab.c +2
-0struct hashtab_node *prev, *cur, *newnode; +cond_resched (); +if (!h || h->nel ==HASHTAB_MAX_NODES )return -EINVAL ;
Signature · 2 lines
paul moore security and virtualization @ redhat