* CONFIRMED bug in do_generic_file_read
@ 2005-05-13 0:57 Jim Washer
2005-05-13 7:57 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Jim Washer @ 2005-05-13 0:57 UTC (permalink / raw)
To: linux-kernel
Well, my original post got ZERO responses, but I've continued to look
at this, and with the help of a colleague I think we've bottomed out.
do_generic_file_read does indeed have a bug, as mentioned below. However,
this bug is generally not hit as the call to a_ops->readpage (normally
pointing at blkdev_readpage) NEVER returns an error. However, the Veritas
code's readpage does return errors, and this triggers this KERNEL BUG.
I don't know enough about the page cache to know if simply NULLing the
page->mapping pointer is safe.
Anyone care to address this?
thanks
- jim
On Mon, 9 May 2005 08:02:05 -0700 (PDT)
Jim Washer <e2big@us.ibm.com> wrote:
>
> I've been looking at a stack trace from a 2.4.x kenrel where the kernel
> hits the "page has mapping still set" BUG() in __free_pages_ok.
>
> What I've found is that in do_generic_file_read, the call:
> error = mapping->a_ops->readpage(filp, page);
>
> is returning an error (EFAULT)
>
> However, shortly after, we fall into:
> /* UHHUH! A synchronous read error occurred. Report it */
> desc->error = error;
> page_cache_release(page);
> break;
>
> This code tries to free the page in question. However, is it reasonable for
> do_generic_file_read to free a page "that belongs to" filesystem code?
>
> Is there some (un)written rule that says filesystem readpage code MUST
> unmap a page before returning an error?
>
>
> I notice that several other locations in do_generic_file_read first check
> that the page has no mapping before freeing, but not here.
>
>
> Further details.
> 1)The file system in question is veritas VXFS, which is NOT open source.
> However, I'm asking this as a general question about whether or not
> there is a requirement that an given FS unmap a page before returning
> an error
>
> 2)The kernel is RHEL3u3, but the code path here apprears the same in 2.4.30
>
> 3)I've not included the stack trace here, as it came from a RHEL3 kernel,
> which I assume most reader of lkml would not have access to.
> I don't want to get into arguing about the analysis of this particular
> stack, but rather I want to consider if the attempted page free in
> do_generic_file_read is "correct" in ALL cases.
>
>
> thanks for considering this.
>
> - jim
>
>
> --
> James Washer
> IBM Linux Change Team
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
James Washer
IBM Linux Change Team
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CONFIRMED bug in do_generic_file_read
2005-05-13 0:57 CONFIRMED bug in do_generic_file_read Jim Washer
@ 2005-05-13 7:57 ` Al Viro
[not found] ` <OFF1B70B69.DFDD4B59-ON88257000.004A3F64-88257000.004B2949@us.ibm.com>
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2005-05-13 7:57 UTC (permalink / raw)
To: Jim Washer; +Cc: linux-kernel
On Thu, May 12, 2005 at 05:57:57PM -0700, Jim Washer wrote:
> Well, my original post got ZERO responses, but I've continued to look
> at this, and with the help of a colleague I think we've bottomed out.
> do_generic_file_read does indeed have a bug, as mentioned below. However,
> this bug is generally not hit as the call to a_ops->readpage (normally
> pointing at blkdev_readpage) NEVER returns an error. However, the Veritas
> code's readpage does return errors, and this triggers this KERNEL BUG.
Hardly. What it does, apparently, is extra page_cache_release().
> I don't know enough about the page cache to know if simply NULLing the
> page->mapping pointer is safe.
Analysis above is BS.
a) page with non-NULL ->mapping == page in cache. Code that adds
page to page cache grabs a reference before putting it on the lists.
b) code that evicts page from cache drops a reference after getting
the sucker off lists.
c) final page_cache_release() while page is still in cache is,
indeed, a bug. Of memory-corrupting variety.
d) ->readpage() has no fscking business playing with any of the above.
e) while we are at it, -EFAULT is a hell of a strange error for
->readpage(), but that's a separate story.
Check for unbalanced page_cache_release() in their code.
> Anyone care to address this?
See above. Anything beyond that requires
1) access to their code
2) good supply of industrial-strength barf-bags to deal with
inevitable consequences of (1).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-13 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 0:57 CONFIRMED bug in do_generic_file_read Jim Washer
2005-05-13 7:57 ` Al Viro
[not found] ` <OFF1B70B69.DFDD4B59-ON88257000.004A3F64-88257000.004B2949@us.ibm.com>
2005-05-13 15:17 ` Al Viro
[not found] ` <OF77CCCDF4.63E93C67-ON88257000.0060D4EE-88257000.006248F5@us.ibm.com>
2005-05-13 18:20 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox