Date: Thu, 2 Mar 2017 00:37:35 +0100 From: Michael Gmelin <freebsd@grem.de> To: Adrian Chadd <adrian.chadd@gmail.com> Cc: Eric van Gyzen <vangyzen@freebsd.org>, "Conrad E. Meyer" <cem@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org> Subject: Re: panic: invalid bcd xxx Message-ID: <80EC6EBB-8BF6-4990-9DEE-906EDCE69E06@grem.de> In-Reply-To: <CAJ-Vmo=-0g7bcU3uq_U0Lc%2B0%2B=-SUiHH02OChjXt=RK6kezDmw@mail.gmail.com> References: <20170228224739.167f2273@bsd64.grem.de> <226a00fa-5d04-0aa7-e0cc-6078edde6639@FreeBSD.org> <CAG6CVpXGQds1NYOOd1trYBTE8KNm=VYA3mq9yK3gjjVMt3NNpA@mail.gmail.com> <b753effa-aa7f-ff20-d127-28e1e827f304@FreeBSD.org> <20170301002620.6a5e35ce@bsd64.grem.de> <CAJ-Vmo=-0g7bcU3uq_U0Lc%2B0%2B=-SUiHH02OChjXt=RK6kezDmw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 2 Mar 2017, at 00:35, Adrian Chadd <adrian.chadd@gmail.com> 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 <freebsd@grem.de> wrote: >> On Tue, 28 Feb 2017 17:16:02 -0600 >> Eric van Gyzen <vangyzen@FreeBSD.org> wrote: >>=20 >>>> On 02/28/2017 16:57, Conrad Meyer wrote: >>>> On Tue, Feb 28, 2017 at 2:31 PM, Eric van Gyzen >>>> <vangyzen@freebsd.org> 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= "
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?80EC6EBB-8BF6-4990-9DEE-906EDCE69E06>