Thread (7 messages) flat view 7 messages, 5 authors, 2017-11-06

Re: [PATCH 20/21] phonet: exit_net cleanup check added

From: Vasily Averin <hidden>
Date: 2017-11-05 10:52:29

On 2017-11-05 13:17, Rémi Denis-Courmont wrote:
Le 5 novembre 2017 12:02:34 GMT+02:00, Vasily Averin [off-list ref] a écrit :
quoted
Be sure that pndevs.list initialized in net_init hook was return
to initial state.

Signed-off-by: Vasily Averin <redacted>
---
net/phonet/pn_dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2cb4c5d..1024851 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -332,6 +332,8 @@ static int __net_init phonet_init_net(struct net
*net)
static void __net_exit phonet_exit_net(struct net *net)
{
	remove_proc_entry("phonet", net->proc_net);
+	WARN(!list_empty(&pnn->pndevs.list),
+	     "net %p exit: phonet pndevs.list is not empty\n", net);
}

static struct pernet_operations phonet_net_ops = {
Hello,

TBH, I am not clear what the benefit of this is supposed to be... also, does this not leak a pointer to userspace, breaking ASLR?
Dear Rémi,
I assume that elements added into per-netns list should not live longer then netns.
Such check allows to be sure that driver works with list correctly and lost no entries.
Many drivers does it already, and my current patch sent just makes this praxis global.

I doubt that pointer to freed net have value for someone except developers,
on the other hand it helps to speed up the problem investigation.

Thank you,
	Vasily Averin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help