From owner-freebsd-ports@FreeBSD.ORG Thu Feb 7 23:16:45 2013 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 408717DC; Thu, 7 Feb 2013 23:16:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 008F6656; Thu, 7 Feb 2013 23:16:44 +0000 (UTC) Received: from [192.168.0.6] (spaceball.home.andric.com [192.168.0.6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 59E3D5C43; Fri, 8 Feb 2013 00:16:41 +0100 (CET) Message-ID: <511435D8.8000900@FreeBSD.org> Date: Fri, 08 Feb 2013 00:16:40 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: Dewayne Geraghty Subject: Re: openssh-portable segmentation faults References: <67A39057348F4D1BA43004DB5F0E8DBB@white> <5113B343.303@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: ports@FreeBSD.org, Brooks Davis , Bryan Drewery X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 23:16:45 -0000 On 2013-02-07 22:14, Dewayne Geraghty wrote: ... > Bryan, Dimitry, > Thank-you for your interest. > Unfortunately we have no debugging tools on any of the machines. I'll build one today and reproduce. I have reproduced the segfault here: Starting program: /usr/ports/security/openssh-portable/work/openssh-5.8p2/ssh -vvv localhost OpenSSH_5.8p2 FreeBSD-openssh-portable-5.8.p2_3,1, OpenSSL 1.0.1c 10 May 2012 Program received signal SIGSEGV, Segmentation fault. istrsnvis (dst=0xbfbfb8f4 "debug1: Reading configuration data %.200s", dlen=0xbfbfb880, csrc=, flag=33, extra=) at /usr/src/contrib/libc-vis/vis.c:380 380 for (start = dst; (c = *src++) != '\0'; /* empty */) { (gdb) bt #0 istrsnvis (dst=0xbfbfb8f4 "debug1: Reading configuration data %.200s", dlen=0xbfbfb880, csrc=, flag=33, extra=) at /usr/src/contrib/libc-vis/vis.c:380 #1 0x28360cfd in istrnvis (dst=0xbfbfb8f4 "debug1: Reading configuration data %.200s", dlen=0xbfbfb880, src=, flag=-1077954316) at /usr/src/contrib/libc-vis/vis.c:534 #2 0x28360d71 in strnvis (dst=0xbfbfb878 "", dlen=3217014004, src=0xbfbfb878 "", flag=-1077954440) at /usr/src/contrib/libc-vis/vis.c:548 #3 0x08082e5d in do_log (level=SYSLOG_LEVEL_DEBUG1, fmt=0x80a914e "Reading configuration data %.200s", args=0xbfbfc134 "$\321\277\277@") at log.c:384 #4 0x08083048 in debug (fmt=0x80a914e "Reading configuration data %.200s") at log.c:209 #5 0x08054c8e in read_config_file (filename=0xbfbfd124 "/home/dim/.ssh/config", host=0xbfbfd770 "localhost", options=0x80b99dc , checkperm=1) at readconf.c:1051 #6 0x0804e542 in main (ac=0, av=0xbfbfd5c0) at ssh.c:670 This is exactly the same problem as reported in this thread about the security/pam_ssh_agent_auth port (rather long, beware): http://lists.freebsd.org/pipermail/freebsd-stable/2013-January/071703.html Executive summary: we recently imported a strnvis() implementation from NetBSD, which has differently ordered arguments from the strnvis() implementation in OpenBSD. When OpenSSH calls it with arguments ordered in the way OpenBSD expects, the function segfaults. I guess a similar approach as take in the above thread should be taken, e.g. rename the function in the port to openbsd_strnvis(), and have the port call that. Or use macro trickery to swap the arguments... :)