All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] bonding: debugfs and network namespaces are incompatible
Date: Wed, 11 Jul 2012 17:18:00 -0700	[thread overview]
Message-ID: <877gu9omrr.fsf@xmission.com> (raw)
In-Reply-To: <16903.1341947581@death.nxdomain> (Jay Vosburgh's message of "Tue, 10 Jul 2012 12:13:01 -0700")

Jay Vosburgh <fubar@us.ibm.com> writes:

> Eric W. Biederman <ebiederm@xmission.com> wrote:

>>I haven't run across any of those network devices, but if they create a
>>debugfs entry that embeds the device name it will be a problem.
>
> 	A quick grep suggests that cxgb4, skge, sky2, stmmac, ipoib and
> half a dozen of the wireless drivers all create files in debugfs.  I did
> not check exhaustively, but at least some of them include the device
> name.

Yep.  It looks like imperfect habits are common.

>>Last I looked any custom user space interface from network devices was
>>rare and bonding using debugfs is the first instance of using debugfs
>>from networking devices I have seen.
>>
>>I think the problem will be a little less severe for physical network
>>devices as they all start in the initial network namespace and so start
>>with distinct names.
>>
>>With bonding I can do "ip link add type bond" in any network namespace
>>and get another bond0.  So name conflicts are very much expeted with all
>>virtual networking devices.
>
> 	Fair enough, although it is trivial to rename any network device
> such that a conflict would occur.

Actually for userspace and administrative reasons frequently it isn't
trivial to rename devices.

>>But if you know of any other networking devices using debugsfs that
>>code should probably get the same treatment as the bonding debugfs code.
>
> 	Is there no alternative than simply disabling debugfs whenever
> network namespaces are enabled?  The information bonding displays via
> debugfs is useful, and having it unavailable on all distro kernels seems
> a bit harsh.


I took a good hard look at debugfs while writing this reply and debufs
scares me.  It is the kind of code that just about wants to me to throw
in the towel seeing no hope of a good solid kernel. 

I can definitely open a /sys/kernel/debug/bonding/bond0/rlb_hash_table
and delete the bond and then read the file.  On a bad day that will oops
the kernel, as there is nothing holding a reference to the network
device.  I think only the BOND_MODE_ALB check makes keeps the kernel
from oopsing in my quick tests.

The fact that debugfs is enabled in distro kernels is actually apalling
to me.  debugfs makes it easy to oops the kernel.

There are lots of alternatives to debugfs on where to put information
and the bonding driver already uses most of them.

> 	Why is the logic already in the driver not sufficient?  If the
> attempt to create the debugfs directory with the interface name fails,
> then it merely prints a warning and continues without the debugfs for
> that interface.

All I know for certain is the existing logic will eventually cause
someone doing something reasonable to send me a bug report.

I can see where you are coming from in that the bonding driver debugfs
code really was built to gracefully fail and ignore problems of instead
of just hapharzardly and sloppily ignore problems.  At the same time
I can oops the kernel if I try with your debugfs in the bonding driver.

But it causes the code to fail and issue a warning.  So if I don't
disable the code now, I expect I will get a bug report, and who
knows how many sill files in bonding will have in debugfs by then.
what silly things bonding may be doing in debugfs by then.

Eric

  reply	other threads:[~2012-07-12  0:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 16:18 Network namespace and bonding WARNING at fs/proc/generic.c remove_proc_entry Dilip Daya
2012-06-28 16:18 ` Dilip Daya
     [not found] ` <1340900320.3441.88.camel-1RhL1yiVGhRuYUHNOcvv81aTQe2KTcn/@public.gmane.org>
2012-07-05 22:07   ` Serge E. Hallyn
2012-07-05 22:07     ` Serge E. Hallyn
     [not found]     ` <20120705220749.GA11255-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2012-07-06  0:41       ` Eric W. Biederman
2012-07-06  0:41     ` Eric W. Biederman
     [not found]       ` <87ehopu3e5.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-07-06 17:05         ` Serge E. Hallyn
2012-07-06 17:05           ` Serge E. Hallyn
     [not found]           ` <20120706170538.GA31679-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2012-07-06 18:01             ` Dilip Daya
2012-07-06 18:01               ` Dilip Daya
2012-07-06 18:57             ` Eric W. Biederman
2012-07-06 18:57               ` Eric W. Biederman
     [not found]               ` <87fw94g1kq.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-07-06 19:47                 ` Serge E. Hallyn
2012-07-06 19:47                   ` Serge E. Hallyn
     [not found]                   ` <20120706194741.GA22113-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2012-07-09 20:51                     ` [PATCH 1/2] bonding: Manage /proc/net/bonding/ entries from the netdev events Eric W. Biederman
2012-07-09 20:51                       ` Eric W. Biederman
     [not found]                       ` <87y5ms3bfi.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-07-09 20:52                         ` [PATCH 2/2] bonding: debugfs and network namespaces are incompatible Eric W. Biederman
2012-07-09 20:52                           ` Eric W. Biederman
     [not found]                           ` <87sjd03bdw.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-07-09 21:49                             ` David Miller
2012-07-09 21:49                               ` David Miller
2012-07-10 17:36                               ` Jay Vosburgh
     [not found]                                 ` <367b470c-c3f5-4555-be11-02223125b741@email.android.com>
2012-07-10 19:13                                   ` Jay Vosburgh
2012-07-12  0:18                                     ` Eric W. Biederman [this message]
2012-07-12  1:57                                       ` Jay Vosburgh
     [not found]                               ` <20120709.144932.243254122059983829.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-07-10 17:36                                 ` Jay Vosburgh
2012-07-09 21:49                         ` [PATCH 1/2] bonding: Manage /proc/net/bonding/ entries from the netdev events David Miller
2012-07-09 21:49                       ` David Miller
2012-07-06 18:01         ` Network namespace and bonding WARNING at fs/proc/generic.c remove_proc_entry Dilip Daya
2012-07-06 18:01           ` Dilip Daya
2012-07-06 18:40           ` Eric W. Biederman
     [not found]           ` <1341597680.2829.22.camel-1RhL1yiVGhRuYUHNOcvv81aTQe2KTcn/@public.gmane.org>
2012-07-06 18:40             ` Eric W. Biederman

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=877gu9omrr.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=fubar@us.ibm.com \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.