From: Pavel Tatashin <pasha.tatashin@soleen.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm <linux-mm@kvack.org>
Subject: Re: compound_head() vs uninitialized struct page poisoning
Date: Wed, 1 May 2019 16:32:32 -0400 [thread overview]
Message-ID: <CA+CK2bDAPuXcDewb+Q--VWuDUGhzvufHRwZmh1=tuaOUMJfsMw@mail.gmail.com> (raw)
In-Reply-To: <20190501202433.GC28500@bombadil.infradead.org>
On Wed, May 1, 2019 at 4:24 PM Matthew Wilcox <willy@infradead.org> wrote:
>
>
> Hi Pavel,
>
> This strikes me as wrong:
>
> #define PF_HEAD(page, enforce) PF_POISONED_CHECK(compound_head(page))
>
> If we hit a page which is poisoned, PAGE_POISON_PATTERN is ~0, so PageTail
> is set, and compound_head will return() 0xfff..ffe. PagePoisoned()
> will then try to derefence that pointer and we'll get an oops that isn't
> obviously PagePoisoned.
>
> I think this should have been:
>
> #define PF_HEAD(page, enforce) compound_head(PF_POISONED_CHECK(page))
Yes, I agree, this makes sense.
>
> One could make the argument for double-checking:
>
> #define PF_HEAD(page, enforce) PF_POISONED_CHECK(compound_head(PF_POISONED_CHECK(page)))
>
> but I think this is overkill; if a tail page is initialised, then there's
> no way that its head page should have been uninitialised.
Also agree, no need to check head if subpage is initialized.
>
> Would a patch something along these lines make sense? Compile-tested only.
Yes, I like the re-ordering PF_POISONED_CHECK()s to be before the
other accesses to PPs.
Thank you,
Pasha
prev parent reply other threads:[~2019-05-01 20:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 20:24 Matthew Wilcox
2019-05-01 20:32 ` Pavel Tatashin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+CK2bDAPuXcDewb+Q--VWuDUGhzvufHRwZmh1=tuaOUMJfsMw@mail.gmail.com' \
--to=pasha.tatashin@soleen.com \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox