2001-11-26 16:11:06

by Maciej W. Rozycki

[permalink] [raw]
Subject: [patch] 2.4.16: 802.1Q VLAN non-modular

Hi,

It appears the 802.1Q VLAN support didn't receive even basic testing,
sigh... It doesn't compile non-modular, due to vlan_proc_cleanup() being
discarded, yet needed in vlan_proc_init(). Following is a fix.

Maciej

--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: [email protected], PGP key available +

patch-mips-2.4.14-20011123-vlan-0
diff -up --recursive --new-file linux-mips-2.4.14-20011123.macro/net/8021q/vlanproc.c linux-mips-2.4.14-20011123/net/8021q/vlanproc.c
--- linux-mips-2.4.14-20011123.macro/net/8021q/vlanproc.c Tue Nov 6 07:56:16 2001
+++ linux-mips-2.4.14-20011123/net/8021q/vlanproc.c Sun Nov 25 02:28:24 2001
@@ -116,7 +116,7 @@ static char conf_hdr[] = "VLAN Dev name
* Clean up /proc/net/vlan entries
*/

-void __exit vlan_proc_cleanup(void)
+void vlan_proc_cleanup(void)
{
if (proc_vlan_conf)
remove_proc_entry(name_conf, proc_vlan_dir);
@@ -462,7 +462,7 @@ int __init vlan_proc_init (void)
return 0;
}

-void __exit vlan_proc_cleanup(void)
+void vlan_proc_cleanup(void)
{
return;
}


2001-11-26 16:36:20

by Rik van Riel

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

On Mon, 26 Nov 2001, Maciej W. Rozycki wrote:

> It appears the 802.1Q VLAN support didn't receive even basic testing,
> sigh... It doesn't compile non-modular, due to vlan_proc_cleanup() being
> discarded, yet needed in vlan_proc_init(). Following is a fix.

OK, does anybody have good scripts for automatically compiling
the kernel with many random configurations so we can discover
bugs like this automagically ?

Rik
--
DMCA, SSSCA, W3C? Who cares? http://thefreeworld.net/

http://www.surriel.com/ http://distro.conectiva.com/

2001-11-27 01:58:27

by Ben Greear

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

Hrm, not sure how this got through...but I'll sync down a clean 2.4.16
and test both types of compiles...

Thanks for the patch,
Ben

Maciej W. Rozycki wrote:

> Hi,
>
> It appears the 802.1Q VLAN support didn't receive even basic testing,
> sigh... It doesn't compile non-modular, due to vlan_proc_cleanup() being
> discarded, yet needed in vlan_proc_init(). Following is a fix.
>
> Maciej
>
>


--
Ben Greear <[email protected]> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear


2001-11-27 02:25:21

by Keith Owens

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

On Mon, 26 Nov 2001 14:35:55 -0200 (BRST),
Rik van Riel <[email protected]> wrote:
>On Mon, 26 Nov 2001, Maciej W. Rozycki wrote:
>
>> It appears the 802.1Q VLAN support didn't receive even basic testing,
>> sigh... It doesn't compile non-modular, due to vlan_proc_cleanup() being
>> discarded, yet needed in vlan_proc_init(). Following is a fix.
>
>OK, does anybody have good scripts for automatically compiling
>the kernel with many random configurations so we can discover
>bugs like this automagically ?

Ghozlane Toumi's random configurator for CML1 plus documentation. I
use it to stress test kbuild 2.5. make allyes, allno, allmod, random
(but valid according to CML1).

Add a .force_default file to constrain the config as required. Due to
bugs in CML1 you have to force proc_fs on or off, otherwise you get
inconsistent results. If you do not have the sound firmware files then
you have to force the relevant sound cards off.

.force_default (kbuild 2.4)

# Need _MODULE for a full test
CONFIG_MODULES=y
CONFIG_MODVERSIONS=n

# CML1 has problems with _PROC_FS, with forward references that get
# confused if it changes in mid flight.
CONFIG_PROC_FS=y

# Uncomment if you do not have the required sound firmware files
# CONFIG_SOUND_MSNDCLAS=n
# CONFIG_SOUND_MSNDPIN=n
# CONFIG_PSS_HAVE_BOOT=n
# CONFIG_MAUI_HAVE_BOOT=n

# Broken code, duplicate zlib symbols
CONFIG_JFFS2_FS=n


Patch against 2.4.16.

Index: 16.1/scripts/Configure
--- 16.1/scripts/Configure Tue, 03 Jul 2001 11:11:12 +1000 kaos (linux-2.4/38_Configure 1.1.2.1 644)
+++ 16.1(w)/scripts/Configure Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/38_Configure 1.1.2.1 644)
@@ -48,6 +48,10 @@
#
# 24 January 1999, Michael Elizabeth Chastain, <[email protected]>
# - Improve the exit message (Jeff Ronne).
+#
+# 7 October 2000, Ghozlane Toumi, <[email protected]>
+# added switches for "random" , "all yes" and "all modules"
+#

#
# Make sure we're really running bash.
@@ -76,6 +80,43 @@ function endmenu () {
}

#
+# returns a random number between 1 and $1
+#
+function rnd () {
+ rnd=$[ $RANDOM % $1 + 1 ]
+}
+
+#
+# randomly chose a number in a config list (LIST_CONFIG_NAME)
+# or in a range ( MIN_CONFIG_NAME MAX_CONFIG_NAME )
+# ONLY if there is no forced default (and we are in an "auto" mode)
+# we are limited by the range of values taken by "$RANDOM"
+#
+# rndval CONFIG_NAME
+#
+
+function rndval () {
+ [ "$AUTO" != "yes" -o -n "$old" ] && return
+ def_list=$(eval echo "\${LIST_$1}")
+ def_min=$(eval echo "\${MIN_$1}")
+ def_max=$(eval echo "\${MAX_$1}")
+
+ if [ -n "$def_list" ]; then
+ set -- $(echo $def_list | sed 's/,/ /g')
+ rnd $#
+ while [ $rnd -le $# ] ; do
+ def=$1
+ shift
+ done
+ return
+ fi
+ if [ -n "$def_min" -a -n "$def_max" ]; then
+ rnd $[ $def_max - $def_min ]
+ def=$[ $def_min + $rnd ]
+ fi
+}
+
+#
# help prints the corresponding help text from Configure.help to stdout
#
# help variable
@@ -116,7 +157,11 @@ ${var}:\\
# readln prompt default oldval
#
function readln () {
- if [ "$DEFAULT" = "-d" -a -n "$3" ]; then
+ if [ "$AUTO" = "yes" ]; then
+ echo -n "$1"
+ ans=$2
+ echo $ans
+ elif [ "$DEFAULT" = "-d" -a -n "$3" ]; then
echo "$1"
ans=$2
else
@@ -176,6 +221,17 @@ function define_tristate () {
function bool () {
old=$(eval echo "\${$2}")
def=${old:-'n'}
+ if [ "$AUTO" = "yes" -a -z "$old" ]; then
+ if [ "$RND" = "-r" ]; then
+ rnd 2
+ case $rnd in
+ "1") def="y" ;;
+ "2") def="n" ;;
+ esac
+ else
+ def=$DEF_ANS;
+ fi
+ fi
case "$def" in
"y" | "m") defprompt="Y/n/?"
def="y"
@@ -207,6 +263,18 @@ function tristate () {
else
old=$(eval echo "\${$2}")
def=${old:-'n'}
+ if [ "$AUTO" = "yes" -a -z "$old" ]; then
+ if [ "$RND" = "-r" ]; then
+ rnd 3
+ case $rnd in
+ "1") def="y" ;;
+ "2") def="n" ;;
+ "3") def="m" ;;
+ esac
+ else
+ def=$DEF_ANS
+ fi
+ fi
case "$def" in
"y") defprompt="Y/m/n/?"
;;
@@ -263,6 +331,17 @@ function dep_tristate () {

if [ $need_module = 1 ]; then
if [ "$CONFIG_MODULES" = "y" ]; then
+ if [ "$AUTO" = "yes" -a -z "$old" ]; then
+ if [ "$RND" = "-r" ]; then
+ rnd 2
+ case $rnd in
+ "1") def="m" ;;
+ "2") def="n" ;;
+ esac
+ else
+ def=$DEF_ANS
+ fi
+ fi
case "$def" in
"y" | "m") defprompt="M/n/?"
def="m"
@@ -358,6 +437,7 @@ function int () {
else
max=10000000 # !!
fi
+ rndval $2
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
if expr \( \( $ans + 0 \) \>= $min \) \& \( $ans \<= $max \) >/dev/null 2>&1 ; then
@@ -389,6 +469,7 @@ function hex () {
old=$(eval echo "\${$2}")
def=${old:-$3}
def=${def#*[x,X]}
+ rndval $2
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
ans=${ans#*[x,X]}
@@ -471,6 +552,15 @@ function choice () {
shift; shift
done

+ if [ "$RND" = "-r" -a -z "$old" ] ; then
+ set -- $choices
+ rnd $#
+ while [ $rnd -le $# ] ; do
+ def=$1
+ shift ; shift
+ done
+ fi
+
val=""
while [ -z "$val" ]; do
ambg=n
@@ -519,6 +609,7 @@ function choice () {

CONFIG=.tmpconfig
CONFIG_H=.tmpconfig.h
+FORCE_DEFAULT=.force_default
trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2

#
@@ -539,6 +630,16 @@ if [ "$1" = "-d" ] ; then
shift
fi

+RND=""
+DEF_ANS=""
+AUTO=""
+case "$1" in
+ -r) RND="-r" ; AUTO="yes" ; shift ;;
+ -y) DEF_ANS="y" ; AUTO="yes" ; shift ;;
+ -m) DEF_ANS="m" ; AUTO="yes" ; shift ;;
+ -n) DEF_ANS="n" ; AUTO="yes" ; shift ;;
+esac
+
CONFIG_IN=./config.in
if [ "$1" != "" ] ; then
CONFIG_IN=$1
@@ -549,18 +650,37 @@ if [ -f .config ]; then
DEFAULTS=.config
fi

-if [ -f $DEFAULTS ]; then
- echo "#"
- echo "# Using defaults found in" $DEFAULTS
- echo "#"
- . $DEFAULTS
- sed -e 's/# \(CONFIG_[^ ]*\) is not.*/\1=n/' <$DEFAULTS >.config-is-not.$$
- . .config-is-not.$$
- rm .config-is-not.$$
+if [ "$AUTO" != "yes" ]; then
+ if [ -f $DEFAULTS ]; then
+ echo "#"
+ echo "# Using defaults found in" $DEFAULTS
+ echo "#"
+ . $DEFAULTS
+ sed -e 's/# \(CONFIG_[^ ]*\) is not.*/\1=n/' <$DEFAULTS >.config-is-not.$$
+ . .config-is-not.$$
+ rm .config-is-not.$$
+ else
+ echo "#"
+ echo "# No defaults found"
+ echo "#"
+ fi
else
- echo "#"
- echo "# No defaults found"
- echo "#"
+ if [ -f $FORCE_DEFAULT ]; then
+ echo "#"
+ echo "# Forcing defaults found in $FORCE_DEFAULT"
+ echo "#"
+ sed -e '
+s/# \(CONFIG_[^ ]*\) is not.*/\1=n/;
+s/# range \(CONFIG_[^ ]*\) \([^ ][^ ]*\) \([^ ][^ ]*\)/MIN_\1=\2; MAX_\1=\3/;
+s/# list \(CONFIG_[^ ]*\) \([^ ][^ ]*\)/LIST_\1=\2/
+' <$FORCE_DEFAULT >.default_val.$$
+ . .default_val.$$
+ rm .default_val.$$
+ else
+ echo "#"
+ echo "# No defaults found"
+ echo "#"
+ fi
fi

. $CONFIG_IN
Index: 16.1/Makefile
--- 16.1/Makefile Tue, 27 Nov 2001 11:15:00 +1100 kaos (linux-2.4/T/c/50_Makefile 1.1.2.15.1.2.2.25.2.2.1.17.1.4.1.29.1.31 644)
+++ 16.1(w)/Makefile Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/T/c/50_Makefile 1.1.2.15.1.2.2.25.2.2.1.17.1.4.1.29.1.31 644)
@@ -289,6 +289,18 @@ menuconfig: include/linux/version.h syml
config: symlinks
$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in

+randconfig: symlinks
+ $(CONFIG_SHELL) scripts/Configure -r arch/$(ARCH)/config.in
+
+allyes: symlinks
+ $(CONFIG_SHELL) scripts/Configure -y arch/$(ARCH)/config.in
+
+allno: symlinks
+ $(CONFIG_SHELL) scripts/Configure -n arch/$(ARCH)/config.in
+
+allmod: symlinks
+ $(CONFIG_SHELL) scripts/Configure -m arch/$(ARCH)/config.in
+
include/config/MARKER: scripts/split-include include/linux/autoconf.h
scripts/split-include include/linux/autoconf.h include/config
@ touch include/config/MARKER
Index: 16.1/Documentation/kbuild/00-INDEX
--- 16.1/Documentation/kbuild/00-INDEX Fri, 05 Jan 2001 13:42:29 +1100 kaos (linux-2.4/V/c/50_00-INDEX 1.1 644)
+++ 16.1(w)/Documentation/kbuild/00-INDEX Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/V/c/50_00-INDEX 1.1 644)
@@ -8,3 +8,5 @@ config-language.txt
- specification of Config Language, the language in Config.in files
makefiles.txt
- developer information for linux kernel makefiles
+random.txt
+ - automatically generate random configurations for stress testing
Index: 16.1/Documentation/kbuild/random.txt
--- 16.1/Documentation/kbuild/random.txt Tue, 27 Nov 2001 13:16:56 +1100 kaos ()
+++ 16.1(w)/Documentation/kbuild/random.txt Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/K/f/22_random.txt 644)
@@ -0,0 +1,47 @@
+Code by Ghozlane Toumi <[email protected]>, documentation by
+Keith Owens <[email protected]>
+
+In addition to the normal config targets you can make
+
+ randconfig random configuration.
+
+ allyes reply 'y' to all options, maximal kernel.
+
+ allno reply 'n' to all options, minimal kernel.
+
+ allmod build everything as modules where possible.
+
+
+All random configurations will satisfy the config rules, that is, all
+configurations should be valid. Any build errors indicate bugs in the
+config dependency rules or in the Makefiles.
+
+You can constrain the random configuration, e.g. you may want to force
+the use of modules or the absence of /proc or cramfs must be a module.
+If file .force_default exists then it is read to preset selected
+values, all other values will be randomly selected, subject to the
+config rules. The syntax of .force_default is:
+
+CONFIG_foo=value
+ Force this value, for example CONFIG_MODULES=y, CONFIG_PROC_FS=n,
+ CONFIG_RAMFS=m.
+
+# CONFIG_foo is not set
+ Equivalent to CONFIG_foo=n, supported because this is the format used
+ in .config. NOTE: The leading '#' is required.
+
+# list CONFIG_foo val1,val2,val3
+ Pick a value for CONFIG_foo from the list. CONFIG_foo must be an int
+ or hex option. NOTE: The leading '#' is required.
+
+# range CONFIG_foo min max
+ Pick a value for CONFIG_foo in the range min <=> max. CONFIG_foo
+ must be an int option. NOTE: The leading '#' is required.
+
+If you have repeated settings of the same option in .force_default then
+values take precedence over lists which take precedence over range.
+Within each group the last setting for an option is used.
+
+Answers "randomised" are bool(), tristate(), dep_tristate() and
+choice(). Unless specified in .force_default, int, hex, and string
+options use the default values from config.in.

2001-11-27 03:37:42

by Ben Greear

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

By the way, I just successfully compiled 2.4.16 (including VLAN
builtin) with no problems. It looks like Maciej is compiling
MIPS, so it may be a bug particular to that platform??


Keith Owens wrote:

> On Mon, 26 Nov 2001 14:35:55 -0200 (BRST),
> Rik van Riel <[email protected]> wrote:
>
>>On Mon, 26 Nov 2001, Maciej W. Rozycki wrote:
>>
>>
>>> It appears the 802.1Q VLAN support didn't receive even basic testing,
>>>sigh... It doesn't compile non-modular, due to vlan_proc_cleanup() being
>>>discarded, yet needed in vlan_proc_init(). Following is a fix.


--
Ben Greear <[email protected]> <Ben_Greear AT excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear


2001-11-27 07:56:06

by willy tarreau

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

> By the way, I just successfully compiled 2.4.16
(including
> VLAN builtin) with no problems. It looks like
Maciej is
> compiling MIPS, so it may be a bug particular to
that
> platform??

Ben, you remember the patch I sent to you a few weeks
ago ?
VLAN didn't link builtin on alpha because
vlan_proc_cleanup()
in section __exit was called from vlan_proc_init() in
section
__init, and it semt that the absolute offsets between
these
two functions were too big for the linker to put it on
a 16 bit
value (which was the space reserved for a relative
call, it
seems). So the linker complained and stopped. I had to
extract
the cleanup from __exit and put it into another
function which
worked.

Regards,
Willy


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran?ais !
Yahoo! Courrier : http://courrier.yahoo.fr

2001-11-27 08:34:09

by Giacomo A. Catenazzi

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular



Keith Owens wrote:

>
> .force_default (kbuild 2.4)
>


> Patch against 2.4.16.
>
> Index: 16.1/scripts/Configure
> --- 16.1/scripts/Configure Tue, 03 Jul 2001 11:11:12 +1000 kaos (linux-2.4/38_Configure 1.1.2.1 644)
> +++ 16.1(w)/scripts/Configure Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/38_Configure 1.1.2.1 644)


Could you upload this two files to

http://sourceforge.net/projects/kbuild/ ?

(maybe as docs)

giacomo

2001-11-27 09:00:25

by Keith Owens

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

On Tue, 27 Nov 2001 09:32:34 +0100,
Giacomo Catenazzi <[email protected]> wrote:
>Keith Owens wrote:
>> .force_default (kbuild 2.4)
>
>> Patch against 2.4.16.
>>
>> Index: 16.1/scripts/Configure
>> --- 16.1/scripts/Configure Tue, 03 Jul 2001 11:11:12 +1000 kaos (linux-2.4/38_Configure 1.1.2.1 644)
>> +++ 16.1(w)/scripts/Configure Tue, 27 Nov 2001 13:15:40 +1100 kaos (linux-2.4/38_Configure 1.1.2.1 644)
>
>
>Could you upload this two files to
>
>http://sourceforge.net/projects/kbuild/ ?
>
>(maybe as docs)

The Configure patch is already part of kbuild 2.5, just apply that
patch. Each user needs their own .force_default file.

2001-11-27 09:35:13

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

On Mon, Nov 26, 2001 at 02:35:55PM -0200, Rik van Riel wrote:

OK, does anybody have good scripts for automatically compiling
the kernel with many random configurations so we can discover
bugs like this automagically ?

cd ~/wk/linux/focus/
while true ; do
mconfig -m random
make dep clean bzImage
[...]

sort of thing.

mconfig is super fast and simple, and seems to work very reliably.
I'm not sure why more people don't use it.



--cw

2001-11-27 11:52:57

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [patch] 2.4.16: 802.1Q VLAN non-modular

On Mon, 26 Nov 2001, Ben Greear wrote:

> By the way, I just successfully compiled 2.4.16 (including VLAN
> builtin) with no problems. It looks like Maciej is compiling
> MIPS, so it may be a bug particular to that platform??

This might be because I'm using current binutils (i.e. 2.11.92 from the
CVS). I believe there was a bug in older versions where relocations
against symbols from discarded sections were still resolved, to a useless
value (zero, I think). Thus you may be lucky to get the kernel built, but
if the symbol ever gets referenced (the gets function called), bad things
will happen.

--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: [email protected], PGP key available +