Bug 1269322 - gogoc segfaults
Summary: gogoc segfaults
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gogoc
Version: 23
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Juan Orti
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-07 00:51 UTC by Nick Urbanik
Modified: 2015-11-23 20:57 UTC (History)
1 user (show)

Fixed In Version: gogoc-1.2-46.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-23 20:57:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
This patch does not call setenv() with a NULL pointer for the name parameter (745 bytes, patch)
2015-11-07 01:09 UTC, Nick Urbanik
no flags Details | Diff

Description Nick Urbanik 2015-10-07 00:51:12 UTC
Description of problem:
gogoc will not start up without a segfault

Version-Release number of selected component (if applicable):
gogoc-1.2-45.fc23.x86_64

How reproducible:
always

Steps to Reproduce:
1. dnf update F22 to F23
2. attempt to start gogoc
3. gogoc terminates with segfault

Actual results:
segfault in strlen()

Expected results:
gogoc works

Additional info:
Core was generated by `/usr/bin/gogoc -f /etc/gogoc/gogoc.conf'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
106		movdqu	(%rax), %xmm12
(gdb) bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x00007f2537830229 in __add_to_environ (
    name=name@entry=0x55eba17311fb "TSP_CLIENT_DNS_ADDRESS_IPV6", 
    value=value@entry=0x0, combined=combined@entry=0x0, 
    replace=replace@entry=1) at setenv.c:138
#2  0x00007f253783033a in __setenv (
    name=name@entry=0x55eba17311fb "TSP_CLIENT_DNS_ADDRESS_IPV6", 
    value=value@entry=0x0, replace=replace@entry=1) at setenv.c:269
#3  0x000055eba17198d1 in tspSetEnv (
    Variable=Variable@entry=0x55eba17311fb "TSP_CLIENT_DNS_ADDRESS_IPV6", 
    Value=0x0, Flag=Flag@entry=1) at tsp_local.c:78
#4  0x000055eba171e19d in set_tsp_env_variables (
    pConfig=pConfig@entry=0x7ffe18c43bd0, 
    pTunnelInfo=pTunnelInfo@entry=0x7ffe18c43940) at tsp_setup.c:188
#5  0x000055eba171e533 in tspSetupInterface (c=c@entry=0x7ffe18c43bd0, 
    t=t@entry=0x7ffe18c43940) at tsp_setup.c:333
#6  0x000055eba1719d63 in tspStartLocal (socket=5, c=c@entry=0x7ffe18c43bd0, 
    t=t@entry=0x7ffe18c43940, nt=nt@entry=0x7ffe18c43ab0) at tsp_local.c:225
#7  0x000055eba170fca3 in tspSetupTunnel (conf=conf@entry=0x7ffe18c43bd0, 
    nt=0x7ffe18c43ab0, version_index=version_index@entry=1, 
    broker_list=broker_list@entry=0x7ffe18c43aa8) at tsp_client.c:620
#8  0x000055eba171062f in tspMain (argc=<optimized out>, argv=<optimized out>)
    at tsp_client.c:1230
---Type <return> to continue, or q <return> to quit---
#9  0x00007f2537817580 in __libc_start_main (main=0x55eba170e6b0 <main>, 
    argc=3, argv=0x7ffe18c44068, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffe18c44058) at libc-start.c:289
#10 0x000055eba170e739 in _start ()
(gdb) 
$ sudo egrep -v '^[ \t]*([#;]|$)' /etc/gogoc/gogoc.conf | sed -r 's/(userid|passwd)=.*/\1=\1value/'
userid=useridvalue
passwd=passwdvalue
server=broker.aarnet.net.au
auth_method=any
host_type=host
prefixlen=64
if_prefix=p10p1
dns_server=ns1.aarnet.net.au:ns2.aarnet.net.au:ns3.aarnet.net.au.
gogoc_dir=/etc/gogoc
auto_retry_connect=yes
retry_delay=30
retry_delay_max=300
keepalive=yes
keepalive_interval=30
tunnel_mode=v6anyv4
if_tunnel_v6v4=sit1
if_tunnel_v6udpv4=tun
if_tunnel_v4v6=sit0
client_v4=auto
client_v6=auto
template=linux
proxy_client=no
broker_list=/var/lib/gogoc/tsp-broker-list.txt
last_server=/var/lib/gogoc/tsp-last-server.txt
always_use_same_server=no
log_stderr=0
log_file=1
log_syslog=1
log_filename=/var/log/gogoc/gogoc.log
log_rotation=yes
log_rotation_size=1024
log_rotation_delete=no
syslog_facility=USER

Comment 1 Nick Urbanik 2015-10-07 01:15:08 UTC
OK, it is not always reproducible; now it is running:
$ sudo systemctl status -l gogoc
● gogoc.service - Freenet6.net tunnel client to IPv6
   Loaded: loaded (/usr/lib/systemd/system/gogoc.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-10-07 12:05:07 AEDT; 4min 46s ago
     Docs: man:gogoc(8)
           man:gogoc.conf(5)
 Main PID: 10735 (gogoc)
   CGroup: /system.slice/gogoc.service
           └─10735 /usr/bin/gogoc -f /etc/gogoc/gogoc.conf

Oct 07 12:06:37 hostname.domain gogoc[10735]: TSP version not supported by server: 2.0.2.
Oct 07 12:06:37 hostname.domain gogoc[10735]: Failed to retrieve TSP capabilities.
Oct 07 12:06:37 hostname.domain gogoc[10735]: Disconnected. Retrying.
Oct 07 12:06:37 hostname.domain gogoc[10735]: A TSP error occurred. Status: 310. Info: Server-side error.
Oct 07 12:06:37 hostname.domain gogoc[10735]: Tunnel negotiation failed. Status: 393229
Oct 07 12:08:37 hostname.domain gogoc[10735]: TSP version not supported by server: 2.0.2.
Oct 07 12:08:37 hostname.domain gogoc[10735]: Failed to retrieve TSP capabilities.
Oct 07 12:08:37 hostname.domain gogoc[10735]: Disconnected. Retrying.
Oct 07 12:08:37 hostname.domain gogoc[10735]: A TSP error occurred. Status: 310. Info: Server-side error.
Oct 07 12:08:37 hostname.domain gogoc[10735]: Tunnel negotiation failed. Status: 393229

Comment 2 Nick Urbanik 2015-11-06 21:18:58 UTC
On another machine, I consistently get this same failure with the same backtrace.

Comment 3 Nick Urbanik 2015-11-07 01:06:47 UTC
Valgrind says:
[root@home ccpp-2015-11-07-07:15:40-12588]# valgrind /usr/bin/gogoc -n -f /etc/gogoc/gogoc.conf
==33932== Memcheck, a memory error detector
==33932== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==33932== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==33932== Command: /usr/bin/gogoc -n -f /etc/gogoc/gogoc.conf
==33932== 
==33933== Invalid read of size 1
==33933==    at 0x4C2BC22: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==33933==    by 0x5A71228: __add_to_environ (setenv.c:138)
==33933==    by 0x4C308FF: setenv (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==33933==    by 0x1198D0: tspSetEnv (tsp_local.c:78)
==33933==    by 0x11E19C: set_tsp_env_variables (tsp_setup.c:188)
==33933==    by 0x11E532: tspSetupInterface (tsp_setup.c:333)
==33933==    by 0x119D62: tspStartLocal (tsp_local.c:225)
==33933==    by 0x10FCA2: tspSetupTunnel (tsp_client.c:620)
==33933==    by 0x11062E: tspMain (tsp_client.c:1230)
==33933==    by 0x5A5857F: (below main) (libc-start.c:289)
==33933==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==33933== 
==33933== 
==33933== Process terminating with default action of signal 11 (SIGSEGV)
==33933==  Access not within mapped region at address 0x0
==33933==    at 0x4C2BC22: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==33933==    by 0x5A71228: __add_to_environ (setenv.c:138)
==33933==    by 0x4C308FF: setenv (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==33933==    by 0x1198D0: tspSetEnv (tsp_local.c:78)
==33933==    by 0x11E19C: set_tsp_env_variables (tsp_setup.c:188)
==33933==    by 0x11E532: tspSetupInterface (tsp_setup.c:333)
==33933==    by 0x119D62: tspStartLocal (tsp_local.c:225)
==33933==    by 0x10FCA2: tspSetupTunnel (tsp_client.c:620)
==33933==    by 0x11062E: tspMain (tsp_client.c:1230)
==33933==    by 0x5A5857F: (below main) (libc-start.c:289)

Comment 4 Nick Urbanik 2015-11-07 01:09:14 UTC
Created attachment 1090819 [details]
This patch does not call setenv() with a NULL pointer for the name parameter

This fixes the bug for me.  At last, I can use gogoc again.

Comment 5 Juan Orti 2015-11-07 09:45:35 UTC
Thank you, I'll apply your patch.

Comment 6 Fedora Update System 2015-11-07 17:59:30 UTC
gogoc-1.2-46.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-bb72ef3cd9

Comment 7 Fedora Update System 2015-11-08 13:23:43 UTC
gogoc-1.2-46.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update gogoc'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-bb72ef3cd9

Comment 8 Fedora Update System 2015-11-23 20:57:18 UTC
gogoc-1.2-46.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.