From owner-freebsd-stable@FreeBSD.ORG Sun Jul 3 00:39:53 2005 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 034DC16A445; Sun, 3 Jul 2005 00:39:53 +0000 (GMT) (envelope-from ps@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id F0FB0441C3; Sun, 3 Jul 2005 00:24:15 +0000 (GMT) (envelope-from ps@mu.org) Received: by elvis.mu.org (Postfix, from userid 1000) id 1BD4A625A2; Sat, 2 Jul 2005 17:20:24 -0700 (PDT) X-Original-To: ps@mu.org Delivered-To: ps@mu.org Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by elvis.mu.org (Postfix) with ESMTP id 2802F5C862; Tue, 8 Mar 2005 02:57:49 -0800 (PST) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 61D7656255; Tue, 8 Mar 2005 10:57:36 +0000 (GMT) (envelope-from owner-freebsd-current@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 9A8AF16A4D0; Tue, 8 Mar 2005 10:57:32 +0000 (GMT) Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3042516A4CE; Tue, 8 Mar 2005 10:57:28 +0000 (GMT) Received: from spider.deepcore.dk (cpe.atm2-0-53484.0x50a6c9a6.abnxx9.customer.tele.dk [80.166.201.166]) by mx1.FreeBSD.org (Postfix) with ESMTP id 494DD43D41; Tue, 8 Mar 2005 10:57:27 +0000 (GMT) (envelope-from sos@DeepCore.dk) Received: from [194.192.25.143] (laptop.deepcore.dk [194.192.25.143]) by spider.deepcore.dk (8.12.11/8.12.10) with ESMTP id j28AvMMd058441; Tue, 8 Mar 2005 11:57:25 +0100 (CET) (envelope-from sos@DeepCore.dk) Message-ID: <422D84FF.1010707@DeepCore.dk> From: =?ISO-8859-1?Q?S=F8ren_Schmidt?= User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nate Lawson References: <422225D6.5020009@root.org> In-Reply-To: <422225D6.5020009@root.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-mail-scanned: by DeepCore Virus & Spam killer v1.7 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Sender: owner-freebsd-current@freebsd.org Errors-To: owner-freebsd-current@freebsd.org X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on elvis.mu.org X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, MIME_8BIT_HEADER autolearn=no version=3.0.2 X-Spam-Level: Cc: stable@freebsd.org, current@freebsd.org Subject: Re: patch: fix ata panic with Thinkpad CD and DVD drives X-BeenThere: freebsd-stable@freebsd.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 03 Jul 2005 00:39:53 -0000 X-Original-Date: Tue, 08 Mar 2005 11:57:03 +0100 X-List-Received-Date: Sun, 03 Jul 2005 00:39:53 -0000 Nate Lawson wrote: > If you've been having "memory modified after free" panics on -current=20 > and have a Thinkpad, the attached patch should fix things for you. A=20 > quick check of RELENG_5 indicates that the bug is probably there also=20 > but I haven't tested for it there. >=20 > The bug is triggered by timeouts in the ata_getparam() probe path. The= =20 > ata_timeout() fires and ata_end_transaction() is called to get the=20 > status. However, it continues down into ata_pio_read() even though=20 > there is no data available since we had a timeout, not read completion.= =20 > ata_pio_read() reads 512 bytes of probably bogus data. The importan= t=20 > problem is that it also advances donecount. On subsequent timeouts=20 > (note there are 4 below), donecount advances into unallocated memory an= d=20 > so subsequent ata_pio_read() calls overwrite 512 bytes of someone else'= s=20 > memory. >=20 > The fix is to exit immediately if ATA_R_TIMEOUT is set after reading th= e=20 > status in ata_end_transaction(). It shouldn't go into ata_pio_read() i= f=20 > there was a timeout. The patch does this. >=20 > However, it only handles PIO timeouts since I wasn't sure the best way = > to proceed for unwinding DMA state and the like for the other cases.=20 > This is enough to fix the overwrite and subsequent panic on my systems.= =20 > I've run heavy IO stress and DVD accesses for a while and no further=20 > panics. >=20 > While looking into this, I found another potential problem. In one=20 > reinjection case, donecount wasn't reset to 0. The patch for=20 > ata-queue.c does this and I think it's necessary but don't hit this cas= e=20 > in testing so I can't be sure. Finally, there's one whitespace nit tha= t=20 > helps with clarity. >=20 > These are similar bugs to one found back in August that had the same=20 > effect. Here's the closest reference I could find in the mail archives= =20 > for this: > http://lists.freebsd.org/mailman/htdig/freebsd-current/2004-August/0330= 33.html=20 Just a note from here, these bugs are fixed in ATA mkIII so you could=20 just have gleaned the solution from there (or maybe you did :)) --=20 -S=F8ren _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"