bin/158942: Interactive wpa_cli does not terminate after "quit" and crashes after printing information from wpa_supplicant - looks like a readline(3) problem

Ralf Wenk IZ-FreeBSD0701 at hs-karlsruhe.de
Fri Jul 15 11:30:09 UTC 2011


>Number:         158942
>Category:       bin
>Synopsis:       Interactive wpa_cli does not terminate after "quit" and crashes after printing information from wpa_supplicant - looks like a readline(3) problem
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 15 11:30:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Ralf Wenk
>Release:        FreeBSD 9.0-CURRENT
>Organization:
Hochschule Karlsruhe, University of Applied Sciences
>Environment:
FreeBSD IZ-T193196065251a 9.0-CURRENT FreeBSD 9.0-CURRENT #1: Tue Jul 12 13:29:51 CEST 2011     root at IZ-T193196065251a:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
In interactive mode wpa_cli(8) does not terminate immediately.
Instead it seems to go into a loop consuming lots of CPU.
This can be terminated by SIGINT/CRTL-C.

After printing several (>2) lines of information from wpa_supplicant(8) wpa_cli(8)
crashes immediately if a key is pressed due to a failed assertion in malloc(3).
And even after one information-line the readline  functionality is disruped - please see "how to repeat the problem".

Both problems are gone when readline(3) is not used by building wpa_cli with
Makefile version 1.6 (SVN rev 196472).

>How-To-Repeat:
/usr/sbin/wpa_cli is a version build with readline(3).
~/bin/wpa_cli is a version build without readline(3).

Script started on Fri Jul 15 11:03:22 2011

# /usr/sbin/wpa_cli
wpa_cli v0.7.3
Copyright (c) 2004-2010, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode

> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> quit
load: 0.77  cmd: wpa_cli 4071 [running] 10.17r 5.04u 0.00s 37% 1736k
load: 0.87  cmd: wpa_cli 4071 [running] 14.17r 9.06u 0.00s 57% 1736k
load: 0.88  cmd: wpa_cli 4071 [running] 17.93r 12.75u 0.00s 75% 1736k
^C# ~/bin/wpa_cli
wpa_cli v0.7.3
Copyright (c) 2004-2010, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode

> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> quit
# /usr/sbin/wpa_cli
wpa_cli v0.7.3
Copyright (c) 2004-2010, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode

> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> <2>CTRL-EVENT-BSS-REMOVED 17 02:0b:6b:32:15:7b
^G[A
Unknown command '[A'
> [A
Unknown command '[A'
> quit
^C# /usr/sbin/wpa_cli
wpa_cli v0.7.3
Copyright (c) 2004-2010, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode

> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> <2>CTRL-EVENT-BSS-ADDED 18 00:0b:6b:4c:cf:e7
<2>CTRL-EVENT-BSS-ADDED 19 02:0b:6b:32:15:7b
<2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 00:0b:6b:4c:cf:e7 (SSID='GbE-I-AP02' freq=2412 MHz)
^G^[[K> Zwpa_cli: (malloc) /usr/src/lib/libc/stdlib/malloc.c:2636: Failed assert
ion: "(run->regs_mask[elm] & (1U << bit)) == 0"
Abort (core dumped)
# [A
[A: Command not found.
# gdb /usr/sbin/wpa_cli wpa_cli.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Core was generated by `wpa_cli'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libedit.so.7...done.
Loaded symbols for /lib/libedit.so.7
Reading symbols from /lib/libncurses.so.8...done.
Loaded symbols for /lib/libncurses.so.8
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x281e74c7 in kill () from /lib/libc.so.7
(gdb) bt
#0  0x281e74c7 in kill () from /lib/libc.so.7
#1  0x281e73e6 in raise () from /lib/libc.so.7
#2  0x281e5e6a in abort () from /lib/libc.so.7
#3  0x28166e93 in malloc_usable_size () from /lib/libc.so.7
#4  0x2816897a in malloc_usable_size () from /lib/libc.so.7
#5  0x281698fa in free () from /lib/libc.so.7
#6  0x280a0f23 in el_line () from /lib/libedit.so.7
#7  0x280a3b31 in el_getc () from /lib/libedit.so.7
#8  0x280ad01f in el_gets () from /lib/libedit.so.7
#9  0x2809e2ff in readline () from /lib/libedit.so.7
#10 0x0804c4ee in main (argc=Cannot access memory at address 0x5
)
    at /usr/src/usr.sbin/wpa/wpa_cli/../../../contrib/wpa//wpa_supplicant/wpa_cl
i.c:2038
(gdb) quit
# ~/bin/wpa_cli
wpa_cli v0.7.3
Copyright (c) 2004-2010, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode

> list
<2>Authentication with 00:0b:6b:4c:cf:e7 timed out.
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any
> list
<2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 00:0b:6b:4c:cf:e7 (SSID='GbE-I-AP02' freq=2412 MHz)
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> <2>Authentication with 00:0b:6b:4c:cf:e7 timed out.
<2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 00:0b:6b:4c:cf:e7 (SSID='GbE-I-AP02' freq=2412 MHz)
<2>Authentication with 00:0b:6b:4c:cf:e7 timed out.
^[[A
<2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 00:0b:6b:4c:cf:e7 (SSID='GbE-I-AP02' freq=2412 MHz)
Unknown command '^[[A'
> list
network id / ssid / bssid / flags
9       GbLI-IZ-AP99T   any
10      GbLI-IZ-AP98T   any
14      GbE-I-AP02      any     [CURRENT]
> quit
# exit

Script done on Fri Jul 15 11:09:24 2011
>Fix:
Do not aktivate the use of readline(3) in the Makefile.

It looks like the current development version 0.8 has already its own line-editing functionality.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list