From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 15 14:30:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E0852F0E for ; Mon, 15 Apr 2013 14:30:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id C794532C for ; Mon, 15 Apr 2013 14:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FEU0t5056429 for ; Mon, 15 Apr 2013 14:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r3FEU0iO056428; Mon, 15 Apr 2013 14:30:00 GMT (envelope-from gnats) Resent-Date: Mon, 15 Apr 2013 14:30:00 GMT Resent-Message-Id: <201304151430.r3FEU0iO056428@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Luiz Otavio O Souza Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5EFAC0D for ; Mon, 15 Apr 2013 14:23:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id AAFA02C4 for ; Mon, 15 Apr 2013 14:23:03 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r3FEN2c9034087 for ; Mon, 15 Apr 2013 14:23:02 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r3FEN2Q5034086; Mon, 15 Apr 2013 14:23:02 GMT (envelope-from nobody) Message-Id: <201304151423.r3FEN2Q5034086@red.freebsd.org> Date: Mon, 15 Apr 2013 14:23:02 GMT From: Luiz Otavio O Souza To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/177872: [etherswitchcfg] [patch] etherswitchcfg(8) crashes if called with no argument for vlangroups members X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 14:30:00 -0000 >Number: 177872 >Category: kern >Synopsis: [etherswitchcfg] [patch] etherswitchcfg(8) crashes if called with no argument for vlangroups members >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 Apr 15 14:30:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Luiz Otavio O Souza >Release: -HEAD r248943 >Organization: >Environment: FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013 root@devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U mips >Description: etherswitchcfg(8) crashes when you don't set vlangroup members. >How-To-Repeat: root@rb433:~ # etherswitchcfg vlangroup1 members Apr 15 14:11:50 rb433 kernel: BAD_PAGE_FAULT: pid 973 tid 100050 (etherswitchcfg), uid 0: pc 0x405837e0 got a read fault (type 0x2) at 0 Apr 15 14:11:50 rb433 kernel: Trapframe Register Dump: Apr 15 14:11:50 rb433 kernel: zero: 0 at: 0x405dd5fc v0: 0x414058 v1: 0x414018 Apr 15 14:11:50 rb433 kernel: a0: 0 a1: 0x4031a0 a2: 0 a3: 0 Apr 15 14:11:50 rb433 kernel: t0: 0 t1: 0 t2: 0xccccccc t3: 0xffffffffcccccccc Apr 15 14:11:50 rb433 kernel: t4: 0x1 t5: 0 t6: 0x738 t7: 0x401de0 Apr 15 14:11:50 rb433 kernel: t8: 0x18 t9: 0x405837e0 s0: 0 s1: 0x2 Apr 15 14:11:50 rb433 kernel: s2: 0x4 s3: 0x7ffedc20 s4: 0x1 s5: 0x7fffdd1c Apr 15 14:11:50 rb433 kernel: s6: 0x7ffedc20 s7: 0x401984 k0: 0 k1: 0 Apr 15 14:11:50 rb433 kernel: gp: 0x41c980 sp: 0x7ffedbc0 s8: 0x403504 ra: 0x400c8c Apr 15 14:11:50 rb433 kernel: sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 Apr 15 14:11:51 rb433 kernel: cause: 0x8 pc: 0x405837e0 Apr 15 14:11:51 rb433 kernel: Page table info for pc address 0x405837e0: pde = 0x827c6000, pte = 0xa0044f1a Apr 15 14:11:51 rb433 kernel: Dumping 4 words starting at pc address 0x405837e0: Apr 15 14:11:51 rb433 kernel: 90880000 1100000b 90a90000 15090007 Apr 15 14:11:51 rb433 kernel: Page table info for bad address 0: pde = 0, pte = 0 Segmentation fault (core dumped) >Fix: Apply the attached patch which check for this condition and exit cleanly. Patch attached with submission follows: Index: sbin/etherswitchcfg/etherswitchcfg.c =================================================================== --- sbin/etherswitchcfg/etherswitchcfg.c (revision 241720) +++ sbin/etherswitchcfg/etherswitchcfg.c (working copy) @@ -216,7 +216,9 @@ int member, untagged; char *c, *d; int v; - + + if (!argv[1]) + errx(EX_USAGE, "Members option need an argument"); member = untagged = 0; if (strcmp(argv[1], "none") != 0) { for (c=argv[1]; *c; c=d) { >Release-Note: >Audit-Trail: >Unformatted: