Bug 139014 - [null] /dev/null must be immunable to delete/unlink
Summary: [null] /dev/null must be immunable to delete/unlink
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-21 15:00 UTC by Dima Panov
Modified: 2023-11-18 17:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dima Panov freebsd_committer freebsd_triage 2009-09-21 15:00:04 UTC

/dev/null affected by unlink process, which is not good and leads to hiding null from devfs tree.

It must be immunable to unlinking

Fix: 

unknown :(
How-To-Repeat: 

please run this small script (part of one configure script)

------------------
#!/bis/sh
cat >conftest.cpp <<EOF
int main() { return 0; }
EOF
gcc -o /dev/null conftest.cpp
------------------

after gcc ends   node /dev/null will be absent and not autorecovered to
available state.
Comment 1 Rebecca Cran freebsd_committer freebsd_triage 2010-03-04 18:40:44 UTC
I can't replicate this on a recent 9-CURRENT installation: running 'g++ -o 
/dev/null conftest.cpp' (gcc gives an error) as a normal user does nothing, 
and as root it just updates the permissions to add execute permission.

-- 
Bruce Cran
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-03-04 19:17:56 UTC
State Changed
From-To: open->feedback

Note that feedback was requested.
Comment 3 Dima Panov freebsd_committer freebsd_triage 2010-03-05 02:33:23 UTC
On Friday 05 March 2010 04:40:44 Bruce Cran wrote:
Synopsis: [null] /dev/null must be immunable to delete/unlink

http://www.freebsd.org/cgi/query-pr.cgi?pr=139014

> I can't replicate this on a recent 9-CURRENT installation: running 'g++ -o
> /dev/null conftest.cpp' (gcc gives an error) as a normal user does nothing,
> and as root it just updates the permissions to add execute permission.


[fluffy@Fluffy] /tmp/1> cat conftest.cpp
int main() { return 0; }
[fluffy@Fluffy] /tmp/1> ll /dev/null
crw-rw-rw-  1 root  wheel    0,  29  5 Mar 10:34 /dev/null
[fluffy@Fluffy] /tmp/1> gcc -o /dev/null conftest.cpp
/var/tmp//ccFieWqh.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
[fluffy@Fluffy] /tmp/1> ll /dev/null
crw-rw-rw-  1 root  wheel    0,  29  5 Mar 10:34 /dev/null
[fluffy@Fluffy] /tmp/1> sudo gcc -o /dev/null conftest.cpp
/var/tmp//ccQGuy8l.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
[fluffy@Fluffy] /tmp/1> ll /dev/null
ls: /dev/null: No such file or directory
[fluffy@Fluffy] /tmp/1>

FreeBSD Fluffy.Khv.RU 9.0-900009-CURRENT FreeBSD 9.0-900009-CURRENT #1 r203791M: Fri Feb 
12 23:12:30 VLAT 2010     fluffy@Fluffy.Khv.RU:/usr/obj/usr/src/sys/Spot  amd64

-- 
Dima "Red Fox" Panov @ Home | C73E 2B72 1FFD 61BD E206 1234 A626 76ED 93E3 B018
Khabarovsk, Russia          | 2D30 2CCB 9984 130C 6F87 BAFC FB8B A09D D539 8F29
KDE@FreeBSD Team | FreeBSD committer since 10.08.2009 | FreeBSD since Sept 1995
Twitter.com:fluffy_khv | Skype:dima.panov | Jabber.org:fluffy.khv | ICQ:1745024
Comment 4 Bruce Cran freebsd_committer freebsd_triage 2010-03-05 07:19:45 UTC
State Changed
From-To: feedback->open

Feedback received. 
A simpler way to replicate the problem is to run "rm /dev/null" as root.
Comment 5 robert.lorentz 2011-04-26 03:19:47 UTC
I've just started poking around the PR's to try to learn and help out, =
and this one looked like a good first try..

Sure enough, as root on 9.0 -CURRENT I can "rm /dev/null" and it does =
unlink and is missing.  However, I just recreate it with mknod /dev/null =
c 0 6 ..  the behavior is identical on 8.2-RELEASE.

Am I missing something here?  Is there some kind of new default behavior =
that should be implemented here?=20=
Comment 6 Bryan Drewery freebsd_committer freebsd_triage 2013-09-25 12:47:31 UTC
This is still present as of 10.0 r255865 on head.
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:42:51 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 8 Henrich Hartzer 2023-11-18 17:27:57 UTC
Is this still a thing? I'm seeing /dev/null chmod 644 on FreeBSD 13.2, which breaks some software.