Skip to contentSkip to conversation

2.6.18-rc2-mm1 build kills /dev/null!?

WARNING -mm Andreas Mohr 3 participants 6 messages Jul 27, 2006

lore
Share & tools
lore
#0 lore raw

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

A simple

# make bzImage modules modules_install
managed to reduce my

crw-rw-rw- 1 root root 1, 3 27. Jul 12:04 null

into the charred remains equivalent of

-rw-r--r-- 1 root root 0 27. Jul 12:02 null

, *twice* (I tried it the first time and had that issue, then rebuilt the device and rebooted, same problem once build started).

Any idea why this might happen?

This did not happen with a 2.6.18-rc1-mm2 build.

A simple

rm /dev/null
mknod /dev/null c 1 3
chmod 666 /dev/null

corrects the problem, BTW.

Thanks,

Andreas Mohr

#1 lore raw

Hi,

Quoted 3 lines · Andreas Mohr

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

Replying to myself, this could easily be due to:

--- linux-2.6.18-rc2/scripts/Kbuild.include 2006-07-15 21:41:08.000000000 -
0700
+++ devel/scripts/Kbuild.include 2006-07-27 01:15:54.000000000 -0700
@@ -8,9 +8,13 @@ empty :=
space := $(empty) $(empty)

###
+# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o +dot-target = $(dir $@).$(notdir $@)
+
+###
# The temporary file to save gcc -MD generated dependencies must not

 # contain a comma
-depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
+depfile = $(subst $(comma),_,$(dot-target).d)

###

 # filename of target with directory and extension stripped
@@ -59,6 +63,12 @@ as-option = $(shell if $(CC) $(CFLAGS) $
             -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
             else echo "$(2)"; fi ;)

+# as-instr
+# Usage: cflags-y += $(call as-instr, instr, option1, option2) +
+as-instr = $(shell if echo -e "$(1)" | $(AS) -Z -o /dev/null \
+ 2>&1 >/dev/null ; then echo "$(2)"; else echo "$(3)"; fi;)
+

 # cc-option
 # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)

@@ -77,14 +87,19 @@ cc-option-align = $(subst -functions=0,,

 # cc-version
 # Usage gcc-ver := $(call cc-version, $(CC))
-cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
-              $(if $(1), $(1), $(CC)))
+cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
 # cc-ifversion
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
                        echo $(3); fi;)

+# ld-option
+# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) +ld-option = $(shell if $(CC) $(1) \
+ -nostdlib -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+

Possibly an older binutils doesn't have a "if *output* file /dev/null, then kill output instead of overwriting file" check builtin as IIRC newer utils often have?

# which ld
/usr/bin/ld
# rpm -qf /usr/bin/ld
binutils-2.15.92.0.2-5

Andreas Mohr

#2 lore raw
Quoted 8 lines · Andreas Mohr

Hi,

Quoted 3 lines · Andreas Mohr

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

Replying to myself, this could easily be due to:

Yup, seems it is, see newly posted:

"Re: [PATCH] vDSO hash-style fix"
http://lkml.org/lkml/2006/7/27/83

| > +# ld-option
| > +# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
| > +ld-option = $(shell if $(CC) $(1) \
| > +			     -nostdlib -o /dev/null -xc /dev/null \
| > +             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
| 
| This is not good. When I introduced something similar for lxdialog I
| received lots of reports about /dev/null becoming a regular file.
| ld does something strange with the output file when it fails.
| 
| When re-done ld-option shall be accompanied by documentation in
| Documentation/makefiles.txt like cc-option.

Could we have a -mm hot-fix here?

Andreas Mohr

#3 lore raw
In reply to Andreas Mohr
Quoted 5 lines · Andreas Mohr

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

A simple

Quoted 8 lines
# make bzImage modules modules_install
managed to reduce my

crw-rw-rw- 1 root root 1, 3 27. Jul 12:04 null

into the charred remains equivalent of

-rw-r--r-- 1 root root 0 27. Jul 12:02 null

Don't build as root.

While something's broke in kernel build scripts and probably should be fixed, it's not a reason for anyone to get their whole filesystem rm -rf'ed.

/mjt

#4 lore raw
Quoted 13 lines · Michael Tokarev
Quoted 12 lines · Andreas Mohr

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

A simple

# make bzImage modules modules_install
managed to reduce my

crw-rw-rw- 1 root root 1, 3 27. Jul 12:04 null

into the charred remains equivalent of

Quoted 7 lines
Quoted 1 line

-rw-r--r-- 1 root root 0 27. Jul 12:02 null

Don't build as root.

While something's broke in kernel build scripts and probably should be fixed, it's not a reason for anyone to get their whole filesystem rm -rf'ed.

and it does not matter if you're using udev:

$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 2006-07-27 11:42 /dev/null
#5 lore raw
Quoted 18 lines · On 7/27/06, gmu 2k6 <[email protected]> wrote:
Quoted 17 lines · Michael Tokarev
Quoted 5 lines · Andreas Mohr

Hello all,

for some reason a 2.6.18-rc2-mm1 build seems to kill my /dev/null device!

A simple

Quoted 8 lines
# make bzImage modules modules_install
managed to reduce my

crw-rw-rw- 1 root root 1, 3 27. Jul 12:04 null

into the charred remains equivalent of

-rw-r--r-- 1 root root 0 27. Jul 12:02 null

Don't build as root.

Quoted 7 lines
Quoted 3 lines

While something's broke in kernel build scripts and probably should be fixed, it's not a reason for anyone to get their whole filesystem rm -rf'ed.

and it does not matter if you're using udev:

$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 2006-07-27 11:42 /dev/null

actually this is so obvious I should not have posted that reply. sorry guys.