mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: hui yang <yanghui.def@gmail.com>
To: paul@paul-moore.com
Cc: sds@tycho.nsa.gov, eparis@parisplace.org,
	selinux@vger.kernel.org, linux-kernel@vger.kernel.org,
	YangHui <yanghui.def@gmail.com>
Subject: [PATCH] netnode.c : fix sel_netnode_hash be destroyed
Date: Fri, 20 Dec 2019 18:07:21 +0800	[thread overview]
Message-ID: <1576836441-4140-1-git-send-email-yanghui.def@gmail.com> (raw)

From: YangHui <yanghui.def@gmail.com>

we often find below error :
[   30.729718] Unable to handle kernel paging request at virtual address fffffffffffffffc
[   30.747478] Kernel BUG at sel_netnode_find+0x6c/0xf0 [verbose debug info unavailable]
[   30.818858] PC is at sel_netnode_find+0x6c/0xf0
[   30.824671] LR is at sel_netnode_sid+0x3c/0x248
[   30.829170] pc : [<ffffff8008428094>] lr : [<ffffff8008428154>] pstate: a0400145
[   30.833701] sp : ffffffc026f27c50
[   30.841319] x29: ffffffc026f27c50 x28: ffffffc026f27e40
[   30.849634] x27: ffffff8009132000 x26: 0000000000000000
[   30.854932] x25: ffffffc016f0aa80 x24: 0000000000000000
[   30.860224] x23: ffffffc026f27e38 x22: ffffffc026f27d34
[   30.865520] x21: 000000000000000a x20: ffffffc026f27e40
[   30.870818] x19: 000000000000000a x18: 0000007a13b48000
[   30.876118] x17: 0000007a16ca93c0 x16: ffffff8008e56b2c
[   30.881406] x15: 0000000000000020 x14: 002dc6bffa5d9e00
[   30.886701] x13: 203a644974654e4c x12: 00000000000017c1
[   30.891997] x11: 0000000000000000 x10: 0000000000000001
[   30.897292] x9 : 0000000000000002 x8 : ffffff8009933090
[   30.902588] x7 : ffffffc0725fd090 x6 : 0000000004fd9f2c
[   30.907881] x5 : 0000000000000000 x4 : 0000000000000000
[   30.913176] x3 : 00000001ffffffff x2 : 0000000000000000
[   30.918475] x1 : ffffff800a10ca80 x0 : ffffffffffffffe8
some sel_netnode_hash[idx].list==NULL,so happend this.
I add spin_lock_bh on sel_netnode_init.

Signed-off-by: YangHui <yanghui.def@gmail.com>
---
 security/selinux/netnode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/selinux/netnode.c b/security/selinux/netnode.c
index 9ab84ef..aa0eeb7 100644
--- a/security/selinux/netnode.c
+++ b/security/selinux/netnode.c
@@ -293,11 +293,12 @@ static __init int sel_netnode_init(void)
 
 	if (!selinux_enabled)
 		return 0;
-
+	spin_lock_bh(&sel_netnode_lock);
 	for (iter = 0; iter < SEL_NETNODE_HASH_SIZE; iter++) {
 		INIT_LIST_HEAD(&sel_netnode_hash[iter].list);
 		sel_netnode_hash[iter].size = 0;
 	}
+	spin_unlock_bh(&sel_netnode_lock);
 
 	return 0;
 }
-- 
2.7.4


             reply	other threads:[~2019-12-20 10:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 10:07 hui yang [this message]
2019-12-20 13:48 ` Paul Moore
2019-12-21  2:37   ` hui yang
2019-12-21 15:02     ` Paul Moore

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=1576836441-4140-1-git-send-email-yanghui.def@gmail.com \
    --to=yanghui.def@gmail.com \
    --cc=eparis@parisplace.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@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

Powered by JetHome