public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Binary sysfs blobs
@ 2006-04-11 18:08 Pete Zaitcev
  2006-04-11 18:57 ` Jesse Barnes
  2006-04-11 20:42 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Pete Zaitcev @ 2006-04-11 18:08 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel, zaitcev

Hi, Greg:

I was reviewing some patches here and noticed (yes, only now noticed) that
we have operations on binary blobs in fs/sysfs/bin.c. I thought it wasn't
part of the deal for sysfs, with one value per file and so on. I suppose
it's too late to debate now, but I have a couple of questions:

 - Do you know of any conventions which allow to determine which file
   is binary? Maybe the name starting with an underscore or something?

 - Is there a standing policy that reading from a sysfs file is not
   altering a state of the corresponding hardware? This is not related
   to blobs directly, but with people passing structs now, it's tempting
   to implement some extended protocols. I am concerned of stealing
   network packets by accident or something.

Greetings,
-- Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Binary sysfs blobs
  2006-04-11 18:08 Binary sysfs blobs Pete Zaitcev
@ 2006-04-11 18:57 ` Jesse Barnes
  2006-04-11 20:42 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2006-04-11 18:57 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: greg, linux-kernel

On Tuesday, April 11, 2006 11:08 am, Pete Zaitcev wrote:
> Hi, Greg:
>
> I was reviewing some patches here and noticed (yes, only now noticed)
> that we have operations on binary blobs in fs/sysfs/bin.c. I thought
> it wasn't part of the deal for sysfs, with one value per file and so
> on. I suppose it's too late to debate now, but I have a couple of
> questions:
>
>  - Do you know of any conventions which allow to determine which file
>    is binary? Maybe the name starting with an underscore or something?

AFAIK there isn't any convention.  The PCI related files 
(/sys/bus/pci/devices/...) don't have a particular naming scheme for 
example.

>  - Is there a standing policy that reading from a sysfs file is not
>    altering a state of the corresponding hardware? This is not related
>    to blobs directly, but with people passing structs now, it's
> tempting to implement some extended protocols. I am concerned of
> stealing network packets by accident or something.

Nope, again if you access the PCI files you may end up programming the 
hardware in some way.  There may be other examples of this elsewhere, 
but I haven't looked.

Jesse

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Binary sysfs blobs
  2006-04-11 18:08 Binary sysfs blobs Pete Zaitcev
  2006-04-11 18:57 ` Jesse Barnes
@ 2006-04-11 20:42 ` Greg KH
  2006-04-12 10:34   ` Pete Zaitcev
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2006-04-11 20:42 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: linux-kernel

On Tue, Apr 11, 2006 at 11:08:41AM -0700, Pete Zaitcev wrote:
> Hi, Greg:
> 
> I was reviewing some patches here and noticed (yes, only now noticed) that
> we have operations on binary blobs in fs/sysfs/bin.c. I thought it wasn't
> part of the deal for sysfs, with one value per file and so on. I suppose
> it's too late to debate now, but I have a couple of questions:
> 
>  - Do you know of any conventions which allow to determine which file
>    is binary? Maybe the name starting with an underscore or something?

Hm, no, no convention right now, sorry.

>  - Is there a standing policy that reading from a sysfs file is not
>    altering a state of the corresponding hardware? This is not related
>    to blobs directly, but with people passing structs now, it's tempting
>    to implement some extended protocols. I am concerned of stealing
>    network packets by accident or something.

No.  Binary sysfs files are for "pass-through" mode only.  You are ONLY
allowed to use them if you want to read from, or write to, some bit of
hardware and not manipulate the data at all.  Examples of this is the
raw PCI config space, firmware binary blobs and BIOS upgrades.

You should NEVER pass a raw structure through sysfs by using a binary
file.  If anyone sees anywhere in the current kernel that does this,
please let me know and I'll go hit them with a big stick...

And yes, I know the documentation on the conventions for this is
seriously lacking.  Fixing that is slowly moving up my TODO list...

Hope this helps,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Binary sysfs blobs
  2006-04-11 20:42 ` Greg KH
@ 2006-04-12 10:34   ` Pete Zaitcev
  0 siblings, 0 replies; 4+ messages in thread
From: Pete Zaitcev @ 2006-04-12 10:34 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, zaitcev

On Tue, 11 Apr 2006 13:42:03 -0700, Greg KH <greg@kroah.com> wrote:

> No.  Binary sysfs files are for "pass-through" mode only.  You are ONLY
> allowed to use them if you want to read from, or write to, some bit of
> hardware and not manipulate the data at all.  Examples of this is the
> raw PCI config space, firmware binary blobs and BIOS upgrades.

I see. Kind of the opposite of what I thought they were, but it
makes sense. Thanks.

> You should NEVER pass a raw structure through sysfs by using a binary
> file.  If anyone sees anywhere in the current kernel that does this,
> please let me know and I'll go hit them with a big stick...

I dunno how raw this is, but chp_measurement_copy_block and
chp_measurement_read (in drivers/s390/cio/chsc.c) sure look like
passing structures, in 2.6.17-rc1. However, the code does not interpret
the structures, so maybe it's raw enough.

-- Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-12 10:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-11 18:08 Binary sysfs blobs Pete Zaitcev
2006-04-11 18:57 ` Jesse Barnes
2006-04-11 20:42 ` Greg KH
2006-04-12 10:34   ` Pete Zaitcev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox