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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 8 Jun 2011 09:09:31 -0700
From:	Greg KH <greg@...ah.com>
To:	Németh Márton <nm127@...email.hu>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	Matt Mooney <mfm@...eddisk.com>,
	Kulikov Vasiliy <segooon@...il.com>,
	Endre Kollar <taxy443@...il.com>,
	Arjan Mels <arjan.mels@....net>,
	Ilia Mirkin <imirkin@...m.mit.edu>,
	David Chang <dchang@...ell.com>,
	Himanshu Chauhan <hschauhan@...ltrace.org>,
	Max Vozeler <max@...eler.com>, Arnd Bergmann <arnd@...db.de>,
	usbip-devel@...ts.sourceforge.net, devel@...verdev.osuosl.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usbip: handle length at sysfs show() functions

On Wed, Jun 08, 2011 at 07:26:58AM +0200, Németh Márton wrote:
> Greg KH wrote:
> > On Wed, Jun 01, 2011 at 07:14:07AM +0200, Németh Márton wrote:
> >> The sysfs show() functions shall return the actual content length of
> >> the result buffer. According to Documentation/filesystems/sysfs.txt:215
> >> the scnprintf() function is preferred.
> >>
> >> See also the article titled "snprintf() confusion" at
> >> http://lwn.net/Articles/69419/ .
> >
> > [...]
> >
> > Here we are doing lots of work to try to put more than one value in the
> > sysfs file, and return the proper data to the kernel about how big the
> > buffer we used.
> > 
> > That's wrong, and violates the "one value per file" sysfs rule, so that
> > should be fixed instead of trying to change the sprintf() call.
> 
> As I understand there is a need to change the design here. Currently I
> get the following content when vhci-hcd is loaded but not yet used:
> 
> $ cat /sys/devices/platform/vhci_hcd/status
> prt sta spd bus dev socket           local_busid
> 000 004 000 000 000 0000000000000000 0-0
> 001 004 000 000 000 0000000000000000 0-0
> 002 004 000 000 000 0000000000000000 0-0
> 003 004 000 000 000 0000000000000000 0-0
> 004 004 000 000 000 0000000000000000 0-0
> 005 004 000 000 000 0000000000000000 0-0
> 006 004 000 000 000 0000000000000000 0-0
> 007 004 000 000 000 0000000000000000 0-0
> 
> The fields are: port, status, speed, device ID, socket pointer and
> local busid name. This is too complex for sysfs. Maybe we could extend
> the devices file of usbfs with some new rows?

Ick, I doubt it as there are lots of tools that parse that file already.

But yes, you are correct, this should not be in sysfs at all.

What's the use for this file?  Who uses it?  Is it just debugging
output?  Information for people to gaze at if they feel like it?
Something else?

Once we figure that out, then we can determine where it should go
(debugfs, sysfs in a different file format, usbfs, etc.)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ