Bug 16140

Summary: /proc contains regular files of infinite length.
Product: Base System Reporter: Ross N. Williams <ross>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: newton
Priority: Normal    
Version: 3.3-RELEASE   
Hardware: Any   
OS: Any   

Description Ross N. Williams 2000-01-16 04:20:01 UTC
 
 In Unix, regular files are supposed to be regular. If you write a
 program that (say) backs up the file system, it's supposed to be
 able to tell which files are unreadable by their type
 directories/devices/pipes/etc rather than their location.
 
 My product Veracity http://www.veracity.com/ pays attention to file
 type and is careful not to attempt to read anything but directory
 files and regular files.
 
 However, on FreeBSD, there are regular files of infinite length.
 There are lots of them lurking in /proc. For example /proc/1/fpregs
 which apparently provides a snapshot of the floating point registers.
 
 You might say "so what? Just ignore them", but such files break the
 promise of the properties of regular files, forcing tools such as
 Veracity to block out files by NAME, and this doesn't always work.
 For example, a random user could softlink an entry in one of their
 directories to /proc/1/fpregs and if Veracity was being told to follow
 symlinks (as it can be told, but does not do by default) then it
 would get stuck. It's far far better to simply provide a guarantee
 that all regular files will be readable and of finite length.
 
 So I propose that the FreeBSD developers change these unusual
 files to a type that is not regular.

Fix: 

I am configuring my product http://www.veracity.com/ to ignore /proc
 
 Ross.
 
 Dr Ross N. Williams (ross@rocksoft.com), +61 8 8232-6262 (fax-6264).
 Director, Rocksoft Pty Ltd, Adelaide, Australia: http://www.rocksoft.com/ 
 Protect your files with Veracity data integrity: http://www.veracity.com/
How-To-Repeat:  
  Do it again.
Comment 1 Poul-Henning Kamp 2000-01-16 08:30:30 UTC
I belive we have reduced the size of files in /proc to be zero length
in -current.

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!
Comment 2 Ross N. Williams 2000-01-16 11:30:05 UTC
At 9:30 AM +0100 16/1/2000, Poul-Henning Kamp wrote:
>I belive we have reduced the size of files in /proc to be zero length
>in -current.

That's good, but how are they useful then?

What's stopping you from eliminating them?

/proc/fpregs seems to provide the floating point registers
over and over when you read it. If it's zero length, how can
the file be useful at all? From my unknowledgeable point of
view, it just looks as if they should be left as they are,
but reclassified as devices.


Ross.

Dr Ross N. Williams (ross@rocksoft.com), +61 8 8232-6262 (fax-6264).
Director, Rocksoft Pty Ltd, Adelaide, Australia: http://www.rocksoft.com/ 
Protect your files with Veracity data integrity: http://www.veracity.com/
Comment 3 Poul-Henning Kamp 2000-01-16 12:50:12 UTC
In message <v04220801b4a75ba05365@[203.16.208.220]>, "Ross N. Williams" writes:
>At 9:30 AM +0100 16/1/2000, Poul-Henning Kamp wrote:
>>I belive we have reduced the size of files in /proc to be zero length
>>in -current.
>
>That's good, but how are they useful then?

They still have their contents, but stat(2) will return zero if we can't
predict the size without rendering the entire file.

This at least kept dump(8) from complaining about them changing size.

>What's stopping you from eliminating them?

we need them :-)

>/proc/fpregs seems to provide the floating point registers
>over and over when you read it.

That sounds like a geniune bug to me.

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!
Comment 4 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2000-02-04 08:47:42 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled PR. 
Comment 5 Poul-Henning Kamp freebsd_committer freebsd_triage 2000-06-01 23:38:24 UTC
State Changed
From-To: open->closed

I think we're done with this one.