lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=S7eNeR9OPNh9Ox3Oa8fOHGy5vaF4ooc5CpTw7@mail.gmail.com>
Date:	Sat, 15 Jan 2011 13:09:43 +0200
From:	Lucian Adrian Grijincu <lucian.grijincu@...il.com>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Alexey Kuznetsov <kuznet@....inr.ac.ru>,
	"Pekka Savola (ipv6)" <pekkas@...core.fi>,
	James Morris <jmorris@...ei.org>,
	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
	Patrick McHardy <kaber@...sh.net>,
	Nick Piggin <npiggin@...nel.dk>,
	Al Viro <viro@...iv.linux.org.uk>,
	Christoph Hellwig <hch@....de>,
	Dave Chinner <dchinner@...hat.com>,
	Neil Horman <nhorman@...driver.com>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Octavian Purdila <opurdila@...acom.com>,
	Vlad Dogaru <ddvlad@...edu.org>
Subject: Re: [PATCH] RFC: ipv4: share sysctl net/ipv4/conf/DEVNAME/ tables

On Sat, Jan 15, 2011 at 12:41 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
> On Sat, Jan 15, 2011 at 04:46:11AM +0200, Lucian Adrian Grijincu wrote:
>> To gain access to the name of the directory above a file, sysctl
>> handlers are passed an extra argument: the 'struct file*'
>> corresponding to the file. From the file we walk up one level to find
>> the name of the device. None of the other handlers were changed to
>> receive this extra parameter, but due to C's calling convention they
>> shouldn't care.
>
> We don't do creepy stuff like that.


I did this this way to not waste time changing all the handlers in the
tree and then get this patch struck down as uninterested, ugly-hack or
being suggested another more sensible, yet completely different
approach.


> I wonder where interactions with device renaming are handled.


I took two things taken into consideration:
* the .procname of the device directory has it's own copy of the device name
  This was inherited from the previous version

* when looking for a "struct net_device*" we might not find any:

+		/* the device could have been renamed (SIOCSIFADDR) or
+		 * deleted since we started accessing it's proc sysctl */
+		dev = dev_get_by_name(net, dev_name);
+		if (dev == NULL)
+			return -ENOENT;


I'm not sure (will look into it later) whether
   filp->f_path.dentry->d_parent->d_name.name;
is still valid if a rename is running concurrently.


On device rename we run this

net/ipv4/devinet.c:
static int inetdev_event(struct notifier_block *this, unsigned long event,
			 void *ptr)
....
	case NETDEV_CHANGENAME:
		/* Do not notify about label change, this event is
		 * not interesting to applications using netlink.
		 */
		inetdev_changename(dev, in_dev);

		devinet_sysctl_unregister(in_dev);
		devinet_sysctl_register(in_dev);


I'm not sure whether this code can run in parallel with the
proc_handlers and if it can if it will invalidate
   filp->f_path.dentry->d_parent->d_name.name;


but I'll look into it.

Is there anything else that I should check regarding net device renaming?

-- 
 .
..: Lucian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ