* [PROCFS] [NETNS] issue with /proc/net entries
@ 2008-01-10 17:24 Benjamin Thery
2008-01-10 19:55 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Thery @ 2008-01-10 17:24 UTC (permalink / raw)
To: ebiederm; +Cc: netdev, linux-kernel
Hi Eric,
While testing the current network namespace stuff merged in net-2.6.25,
I bumped into the following problem with the /proc/net/ entries.
It doesn't always display the actual data of the current namespace,
but sometime displays data from other namespaces.
I bisected the problem to the commit:
"proc: remove/Fix proc generic d_revalidate"
3790ee4bd86396558eedd86faac1052cb782e4e1
The problem: If a process in a particular network namespace changes
current directory to /proc/net, then processes in other network
namespaces trying to look at /proc/net entries will see data from the
first namespace (the one with CWD /proc/net). (See test case below).
As you comments in the commit suggest, you seem to be aware of some
issues when CONFIG_NET_NS=y. Is it one of these corner cases you
identified? Any idea on how we can fix it?
Thanks.
Benjamin
Test case:
----------
(1) Shell 1, in init namespace:
$ cat /proc/net/dev
lo ...
eth0 ...
(2) Shell 2, in another network namespace
$ cat /proc/net/dev
lo ...
(3) Shell 1
$ cd /proc/net
$ cat dev
lo ...
eth0 ...
(4) Shell 2
$ cat /proc/net/dev
lo ...
eth0 ...
Argh, lo + eth0 in child namespace.... the device list of init netns
is displayed in /proc/net/dev of child namespace :-(
(5) Shell 1
$ cd /
(6) Shell 2
$ cat /proc/net/dev
lo ...
Back to normality.
--
B e n j a m i n T h e r y - BULL/DT/Open Software R&D
http://www.bull.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PROCFS] [NETNS] issue with /proc/net entries
2008-01-10 17:24 [PROCFS] [NETNS] issue with /proc/net entries Benjamin Thery
@ 2008-01-10 19:55 ` Eric W. Biederman
2008-01-11 16:00 ` Benjamin Thery
0 siblings, 1 reply; 3+ messages in thread
From: Eric W. Biederman @ 2008-01-10 19:55 UTC (permalink / raw)
To: Benjamin Thery; +Cc: netdev, linux-kernel
Benjamin Thery <benjamin.thery@bull.net> writes:
> Hi Eric,
>
> While testing the current network namespace stuff merged in net-2.6.25,
> I bumped into the following problem with the /proc/net/ entries.
> It doesn't always display the actual data of the current namespace,
> but sometime displays data from other namespaces.
>
> I bisected the problem to the commit:
> "proc: remove/Fix proc generic d_revalidate"
> 3790ee4bd86396558eedd86faac1052cb782e4e1
>
> The problem: If a process in a particular network namespace changes
> current directory to /proc/net, then processes in other network
> namespaces trying to look at /proc/net entries will see data from the
> first namespace (the one with CWD /proc/net). (See test case below).
>
> As you comments in the commit suggest, you seem to be aware of some
> issues when CONFIG_NET_NS=y. Is it one of these corner cases you
> identified? Any idea on how we can fix it?
Yes. It isn't especially hard. I have most of it in my queue
I just need to get the silly patches out of there.
Essentially we need to fix the caching of proc_generic entries,
So that we can have a proper d_revalidate implementation.
To get d_revalidate and the caching correct for /proc/net will take
just a bit more work. We need to make /proc/net a symlink
to something like /proc/self/net so that we don't get excess
revalidates when switching between different processes.
Or else we can't properly implement the case you have described.
Where being in the directory causes the wrong version of /proc/net
to show up. Changing the contents of the dentry for /proc/net
should only happen during unshare. Not when we switch between
processes or else we get into the d_revalidate leaks mount points
problem again.
We also need the check to see if something is mounted on top of
us before we call drop the dentry. But if we don't even try until
we know the dentry is invalid it should not be too bad.
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PROCFS] [NETNS] issue with /proc/net entries
2008-01-10 19:55 ` Eric W. Biederman
@ 2008-01-11 16:00 ` Benjamin Thery
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Thery @ 2008-01-11 16:00 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: netdev, linux-kernel
Eric W. Biederman wrote:
> Benjamin Thery <benjamin.thery@bull.net> writes:
>
>> Hi Eric,
>>
>> While testing the current network namespace stuff merged in net-2.6.25,
>> I bumped into the following problem with the /proc/net/ entries.
>> It doesn't always display the actual data of the current namespace,
>> but sometime displays data from other namespaces.
>>
>> I bisected the problem to the commit:
>> "proc: remove/Fix proc generic d_revalidate"
>> 3790ee4bd86396558eedd86faac1052cb782e4e1
>>
>> The problem: If a process in a particular network namespace changes
>> current directory to /proc/net, then processes in other network
>> namespaces trying to look at /proc/net entries will see data from the
>> first namespace (the one with CWD /proc/net). (See test case below).
>>
>> As you comments in the commit suggest, you seem to be aware of some
>> issues when CONFIG_NET_NS=y. Is it one of these corner cases you
>> identified? Any idea on how we can fix it?
>
> Yes. It isn't especially hard. I have most of it in my queue
> I just need to get the silly patches out of there.
>
> Essentially we need to fix the caching of proc_generic entries,
> So that we can have a proper d_revalidate implementation.
>
> To get d_revalidate and the caching correct for /proc/net will take
> just a bit more work. We need to make /proc/net a symlink
> to something like /proc/self/net so that we don't get excess
> revalidates when switching between different processes.
>
> Or else we can't properly implement the case you have described.
> Where being in the directory causes the wrong version of /proc/net
> to show up. Changing the contents of the dentry for /proc/net
> should only happen during unshare. Not when we switch between
> processes or else we get into the d_revalidate leaks mount points
> problem again.
>
> We also need the check to see if something is mounted on top of
> us before we call drop the dentry. But if we don't even try until
> we know the dentry is invalid it should not be too bad.
Thanks for all the details.
I'll put this issue on my "netns current limitations" list until
it's solved.
Benjamin
>
> Eric
>
--
B e n j a m i n T h e r y - BULL/DT/Open Software R&D
http://www.bull.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-11 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-10 17:24 [PROCFS] [NETNS] issue with /proc/net entries Benjamin Thery
2008-01-10 19:55 ` Eric W. Biederman
2008-01-11 16:00 ` Benjamin Thery
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).