Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 1998 20:52:36 -0700 (PDT)
From:      nick@taronga.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   misc/7124: MAKEDEV vty<xy> doesn't check if the number <xy> is valid
Message-ID:  <199806300352.UAA20244@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         7124
>Category:       misc
>Synopsis:       MAKEDEV vty<xy> doesn't check if the number <xy> is valid
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 29 21:00:01 PDT 1998
>Last-Modified:
>Originator:     Nick Manka
>Organization:
>Release:        2.2.5-6, 3.0-current
>Environment:
FreeBSD engylion.in.taronga.com 3.0-CURRENT FreeBSD 3.0-CURRENT #8: Sun Jun 28 06:52:55 CDT 1998     nick@engylion.in.taronga.com:/local/src/sys/compile/angelic  i386

>Description:
Supplying MAKEDEV with a vty number that is not a valid hexadecimal
number causes it to consume most of the processor time and all of
the memory on a machine.

I don't know if ever creates any devices, it never has for me before
consuming the entirety of 244 megabytes of memory and page space. When
run as a user not root, it waits for a few seconds and then says
"Out of space."

The bug appears to occur just below line 719 in MAKEDEV where

        units=`expr $i : 'vty\(.*\)'`
        eval `echo ${chr} ${units} | awk ' { c=$1; n=$2 } END {
                for (i = 0; i < n; i++)
                        printf("rm -f ttyv%01x; mknod ttyv%01x c %d %d; \  
                                chown root.wheel ttyv%01x;", \
                                i, i, c, i, i); }'`
        ln -fs ttyv0 vga        # XXX X still needs this pccons relic 
        ;;


splits off the number of devices to make and passes that to awk. I'm
not to keen with awk, but I'm under the impression that it can't deal
with a non-hexadecimal number where a hexadecimal number is supposed
to be.


>How-To-Repeat:
cd /dev
sh MAKEDEV vtyv4

vty<pretty much anything greater than ff> seems to do it.
>Fix:
Don't make typos as root :>

Have the awk script in MAKEDEV for vty* do a sanity check?

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806300352.UAA20244>