From owner-freebsd-current@freebsd.org Tue Feb 28 22:31:44 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 644BACF1CB6 for ; Tue, 28 Feb 2017 22:31:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 501A99B7; Tue, 28 Feb 2017 22:31:43 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 8BC3C5646A; Tue, 28 Feb 2017 16:31:37 -0600 (CST) Subject: Re: panic: invalid bcd xxx To: Michael Gmelin , "freebsd-current@freebsd.org" , Conrad Meyer References: <20170228224739.167f2273@bsd64.grem.de> From: Eric van Gyzen Message-ID: <226a00fa-5d04-0aa7-e0cc-6078edde6639@FreeBSD.org> Date: Tue, 28 Feb 2017 16:31:36 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170228224739.167f2273@bsd64.grem.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2017 22:31:44 -0000 On 02/28/2017 15:47, Michael Gmelin wrote: > Booting r313561[0] I get the following panic: > > mountroot: waiting for device /dev/ufs/FreeBSD_install > panic: invalid bcd 177 (also 254, 255 etc.) > cpuid = 1 > KDB: stack backtrace: > db_trace_self_wrapper... > vpanic()... > kassert_panic()... > atrtc_gettime()... > inittodr()... > vfs_mountroot()... > start_init()... > fork_exit()... > fork_trampoline()... > (copied from a screenshot, hence the ellipsis) > > This is on an Acer C720 Chromebook, confirmed on two devices (one with > cyapa touchpad, one with elan touchpad). Same problem happened with a > CURRENT checked out about 10 hours ago. Previous versions of 12-CURRENT > worked ok (last version I tested personally was back in > November/December though). Your system's real-time clock is returning garbage. r312702 added some input validation a few weeks ago. Previously, the kernel was reading beyond the end of an array and either complaining about the clock or setting it to the wrong time based on whatever was in the memory beyond the array. The added validation shouldn't be an assertion because it operates on data beyond the kernel's control. Try this: --- sys/libkern.h (revision 314424) +++ sys/libkern.h (working copy) @@ -57,8 +57,10 @@ bcd2bin(int bcd) { - KASSERT(bcd >= 0 && bcd < LIBKERN_LEN_BCD2BIN, - ("invalid bcd %d", bcd)); + if (bcd < 0 || bcd >= LIBKERN_LEN_BCD2BIN) { + printf("invalid bcd %d\n", bcd); + return (0); + } return (bcd2bin_data[bcd]); } Eric