From owner-freebsd-arm@FreeBSD.ORG Fri Jan 18 09:54:48 2008 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D85C16A41A; Fri, 18 Jan 2008 09:54:48 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [IPv6:2001:4200:7000:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 9C66113C46B; Fri, 18 Jan 2008 09:54:45 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id CCA8433CD1; Fri, 18 Jan 2008 11:54:39 +0200 (SAST) Date: Fri, 18 Jan 2008 11:54:39 +0200 From: John Hay To: freebsd-arm@freebsd.org Message-ID: <20080118095439.GA5677@zibbi.meraka.csir.co.za> References: <20080117105854.GA44923@zibbi.meraka.csir.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080117105854.GA44923@zibbi.meraka.csir.co.za> User-Agent: Mutt/1.4.2.1i Cc: des@freebsd.org Subject: Re: sshd broken on arm? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 09:54:48 -0000 On Thu, Jan 17, 2008 at 12:58:54PM +0200, John Hay wrote: > Hi Guys, > > I just did a new build using RELENG_7 for the arm (Avila boards) and then > found that I cannot ssh into them. The sshd crash with a bus error just > after you entered your username and password. My build of mid November > did not do it. Anybody got ideas? > > The last part of "sshd -Dddd" on the arm board looks like this: > > debug1: server_input_channel_req: channel 0 request pty-req reply 0 > debug1: session_by_channel: session 0 channel 0 > debug1: session_input_channel_req: session 0 req pty-req > debug1: Allocating pty. > debug3: mm_request_send entering: type 25 > debug3: monitor_read: checking request 25 > debug3: mm_answer_pty entering > debug1: session_new: init > debug1: session_new: session 0 > debug3: mm_pty_allocate: waiting for MONITOR_ANS_PTY > debug3: mm_request_receive_expect entering: type 26 > debug3: mm_request_receive entering > debug3: mm_request_send entering: type 26 > ssh_mm_receive_fd: recvmsg: expected received 1 got 0 > debug1: do_cleanup > debug1: PAM: cleanup > Bus error (core dumped) > debug3: PAM: sshpam_thread_cleanup entering Ok, I found the problem. It looks like something changed and now the alignment for the char tmp[...] array in monitor_fdpass.c:mm_send_fd and monitor_fdpass.c:mm_receive_fd is different and the arm processors do not like it. Attached is my quick fix. One question that I have is if we should just fix all of these "problems" or should something be changed so that these things are aligned again? In the last month or two I have come across quite a few of these things that used to work on the arm and now do not anymore because of alignment changes. (I have cc'ed des@ because his name pitch up a lot in the openssh cvs logs. :-) John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org Index: monitor_fdpass.c =================================================================== RCS file: /home/ncvs/src/crypto/openssh/monitor_fdpass.c,v retrieving revision 1.1.1.7 diff -u -r1.1.1.7 monitor_fdpass.c --- monitor_fdpass.c 10 Nov 2006 16:38:34 -0000 1.1.1.7 +++ monitor_fdpass.c 18 Jan 2008 08:45:19 -0000 @@ -49,7 +49,7 @@ char ch = '\0'; ssize_t n; #ifndef HAVE_ACCRIGHTS_IN_MSGHDR - char tmp[CMSG_SPACE(sizeof(int))]; + char tmp[CMSG_SPACE(sizeof(int)) + sizeof(int)]; struct cmsghdr *cmsg; #endif @@ -58,7 +58,7 @@ msg.msg_accrights = (caddr_t)&fd; msg.msg_accrightslen = sizeof(fd); #else - msg.msg_control = (caddr_t)tmp; + msg.msg_control = (caddr_t)(_ALIGN(tmp)); msg.msg_controllen = CMSG_LEN(sizeof(int)); cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(sizeof(int)); @@ -94,7 +94,7 @@ char ch; int fd; #ifndef HAVE_ACCRIGHTS_IN_MSGHDR - char tmp[CMSG_SPACE(sizeof(int))]; + char tmp[CMSG_SPACE(sizeof(int)) + sizeof(int)]; struct cmsghdr *cmsg; #endif @@ -107,8 +107,8 @@ msg.msg_accrights = (caddr_t)&fd; msg.msg_accrightslen = sizeof(fd); #else - msg.msg_control = tmp; - msg.msg_controllen = sizeof(tmp); + msg.msg_control = (caddr_t)(_ALIGN(tmp)); + msg.msg_controllen = CMSG_LEN(sizeof(int)); #endif if ((n = recvmsg(sock, &msg, 0)) == -1)