From: Greg KH <gregkh@suse.de>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: netdev@vger.kernel.org
Subject: Re: Converting network devices from class devices causes namespace pollution
Date: Sun, 18 Feb 2007 19:01:14 -0800 [thread overview]
Message-ID: <20070219030114.GA13666@suse.de> (raw)
In-Reply-To: <m1bqjr84fe.fsf@ebiederm.dsl.xmission.com>
On Sun, Feb 18, 2007 at 03:52:05PM -0700, Eric W. Biederman wrote:
> Greg KH <gregkh@suse.de> writes:
>
> > On Sun, Feb 18, 2007 at 08:55:20AM -0700, Eric W. Biederman wrote:
> >> User space is allowed to rename network devices to anything any name
> >> not currently taken by another network device.
> >>
> >> However when I now do something like:
> >>
> >> ip link set eth0 name irq
> >>
> >> The rename half happens (because it is legal), but sysfs can't support
> >> it because of the ridiculous directory eth0 is in. After that
> >> point things go hideously wrong.
> >
> > What goes wrong? What is not renamed properly?
>
> It gets half renamed.
Ick :(
> > Oh, you can't rename it to something like "irq". Well that's pretty
> > foolish on your behalf :)
>
> No it is pretty foolish on your behalf to add this extra restriction.
> Currently this is a worse set of restrictions than DOS had with
> it's magic character devices.
Hey, don't be mean here...
> >> The current situation is hideous namespace pollution, and breaks user
> >> space, and is only likely only a matter of time before we have a
> >> reasonable instead of an strained conflict of names.
> >
> > Do we really have a problem here?
>
> Yes.
Actually, you are right, I fixed this problem over a year ago, and then
introduced it recently again :(
We need our own namespace for these devices, and we have it today
already. Look if you enable CONFIG_SYSFS_DEPRECATED, or on a pre-2.6.19
machine at what shows up in the pci device directories:
$ ls -l /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/
total 0
lrwxrwxrwx 1 root root 0 2007-02-18 18:56 bus -> ../../../../bus/pci
-r--r--r-- 1 root root 4096 2007-02-18 18:56 class
-rw-r--r-- 1 root root 4096 2007-02-18 18:56 config
-r--r--r-- 1 root root 4096 2007-02-18 13:06 device
lrwxrwxrwx 1 root root 0 2007-02-18 18:56 driver -> ../../../../bus/pci/drivers/tg3
-r--r--r-- 1 root root 4096 2007-02-18 18:56 irq
-r--r--r-- 1 root root 4096 2007-02-18 18:56 local_cpus
-r--r--r-- 1 root root 4096 2007-02-18 18:56 modalias
lrwxrwxrwx 1 root root 0 2007-02-18 18:56 net:eth0 -> ../../../../class/net/eth0
drwxr-xr-x 2 root root 0 2007-02-12 08:06 power
-r--r--r-- 1 root root 4096 2007-02-18 18:56 resource
-rw------- 1 root root 65536 2007-02-18 18:56 resource0
-r--r--r-- 1 root root 4096 2007-02-18 13:06 subsystem_device
-r--r--r-- 1 root root 4096 2007-02-18 13:06 subsystem_vendor
--w------- 1 root root 4096 2007-02-18 18:56 uevent
-r--r--r-- 1 root root 4096 2007-02-18 13:06 vendor
So, all we need to do is rename these devices back to the "net:eth0"
name, and everything will be fine. I'll work on fixing that tomorrow as
it will take a bit of hacking on the kobject symlink function and the
driver core code (but it gets us rid of a symlink in "compatiblity
mode", which is always a nice win...)
And thanks for your calm and reasoned statements in pointing out this
bug, it wasn't deliberate by any means :)
thanks,
greg k-h
next prev parent reply other threads:[~2007-02-19 3:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-18 15:55 Converting network devices from class devices causes namespace pollution Eric W. Biederman
2007-02-18 19:46 ` Greg KH
2007-02-18 22:52 ` Eric W. Biederman
2007-02-19 3:01 ` Greg KH [this message]
2007-02-19 8:19 ` 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=20070219030114.GA13666@suse.de \
--to=gregkh@suse.de \
--cc=ebiederm@xmission.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 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).