From owner-freebsd-current@freebsd.org Wed Mar 1 23:37:45 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 C3CB7CF4FF2 for ; Wed, 1 Mar 2017 23:37:45 +0000 (UTC) (envelope-from freebsd@grem.de) Received: from mail.grem.de (outcast.grem.de [213.239.217.27]) by mx1.freebsd.org (Postfix) with SMTP id 40ECC811 for ; Wed, 1 Mar 2017 23:37:44 +0000 (UTC) (envelope-from freebsd@grem.de) Received: (qmail 39354 invoked by uid 89); 1 Mar 2017 23:37:36 -0000 Received: from unknown (HELO ?192.168.250.192?) (mg@grem.de@46.244.129.140) by mail.grem.de with ESMTPA; 1 Mar 2017 23:37:36 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: panic: invalid bcd xxx From: Michael Gmelin X-Mailer: iPhone Mail (14D27) In-Reply-To: Date: Thu, 2 Mar 2017 00:37:35 +0100 Cc: Eric van Gyzen , "Conrad E. Meyer" , "freebsd-current@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <80EC6EBB-8BF6-4990-9DEE-906EDCE69E06@grem.de> References: <20170228224739.167f2273@bsd64.grem.de> <226a00fa-5d04-0aa7-e0cc-6078edde6639@FreeBSD.org> <20170301002620.6a5e35ce@bsd64.grem.de> To: Adrian Chadd 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: Wed, 01 Mar 2017 23:37:45 -0000 > On 2 Mar 2017, at 00:35, Adrian Chadd wrote: >=20 > This is an emulated BIOS though, right? >=20 > I don't know if we're going to get the RTC 'bugfixed'... >=20 It's SeaBIOS, yes. I feel like this might end up in another quirk/workaround= solution. -m >=20 > -adrian >=20 >> On 28 February 2017 at 15:26, Michael Gmelin wrote: >> On Tue, 28 Feb 2017 17:16:02 -0600 >> Eric van Gyzen wrote: >>=20 >>>> On 02/28/2017 16:57, Conrad Meyer wrote: >>>> On Tue, Feb 28, 2017 at 2:31 PM, Eric van Gyzen >>>> wrote: >>>>> 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. >>>>>=20 >>>>> The added validation shouldn't be an assertion because it operates >>>>> on data beyond the kernel's control. Try this: >>>>>=20 >>>>> --- sys/libkern.h (revision 314424) >>>>> +++ sys/libkern.h (working copy) >>>>> @@ -57,8 +57,10 @@ >>>>> bcd2bin(int bcd) >>>>> { >>>>>=20 >>>>> - KASSERT(bcd >=3D 0 && bcd < LIBKERN_LEN_BCD2BIN, >>>>> - ("invalid bcd %d", bcd)); >>>>> + if (bcd < 0 || bcd >=3D LIBKERN_LEN_BCD2BIN) { >>>>> + printf("invalid bcd %d\n", bcd); >>>>> + return (0); >>>>> + } >>>>> return (bcd2bin_data[bcd]); >>>>> } >>>>=20 >>>> I don't think removing this assertion and truncating to zero is the >>>> right thing to do. Adding an error return to this routine is a >>>> little much, though. I think probably the caller should perform >>>> input validation between the broken device and this routine. >>>=20 >>> Either of those would be a much better solution. This was just a >>> quick hack to get the memstick to boot. >>>=20 >>=20 >> Thanks for your response. >>=20 >> I'm not in a hurry, so I can wait for a proper solution. Let me know if >> I should test anything or can help in some other way. >>=20 >> -m >>=20 >>=20 >> -- >> Michael Gmelin >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= "