From: Naresh Kamboju <naresh.kamboju@linaro.org>
To: Yang Shi <shy828301@gmail.com>
Cc: naoya.horiguchi@nec.com, hughd@google.com,
kirill.shutemov@linux.intel.com, willy@infradead.org,
peterx@redhat.com, osalvador@suse.de, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>,
Anders Roxell <anders.roxell@linaro.org>,
lkft-triage@lists.linaro.org
Subject: Re: [v3 PATCH 2/5] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault
Date: Tue, 2 Nov 2021 00:35:34 +0530 [thread overview]
Message-ID: <CA+G9fYs__zKSSLKPh4wEPSY5SH8QYkLzgd_3dJpMX72XxTfpdw@mail.gmail.com> (raw)
In-Reply-To: <20210930215311.240774-3-shy828301@gmail.com>
Hi Yang,
On Fri, 1 Oct 2021 at 03:23, Yang Shi <shy828301@gmail.com> wrote:
>
> When handling shmem page fault the THP with corrupted subpage could be PMD
> mapped if certain conditions are satisfied. But kernel is supposed to
> send SIGBUS when trying to map hwpoisoned page.
>
> There are two paths which may do PMD map: fault around and regular fault.
>
> Before commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault() codepaths")
> the thing was even worse in fault around path. The THP could be PMD mapped as
> long as the VMA fits regardless what subpage is accessed and corrupted. After
> this commit as long as head page is not corrupted the THP could be PMD mapped.
>
> In the regular fault path the THP could be PMD mapped as long as the corrupted
> page is not accessed and the VMA fits.
>
> This loophole could be fixed by iterating every subpage to check if any
> of them is hwpoisoned or not, but it is somewhat costly in page fault path.
>
> So introduce a new page flag called HasHWPoisoned on the first tail page. It
> indicates the THP has hwpoisoned subpage(s). It is set if any subpage of THP
> is found hwpoisoned by memory failure and cleared when the THP is freed or
> split.
>
> Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
> Cc: <stable@vger.kernel.org>
> Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Yang Shi <shy828301@gmail.com>
> ---
> include/linux/page-flags.h | 19 +++++++++++++++++++
> mm/filemap.c | 12 ++++++------
> mm/huge_memory.c | 2 ++
> mm/memory-failure.c | 6 +++++-
> mm/memory.c | 9 +++++++++
> mm/page_alloc.c | 4 +++-
> 6 files changed, 44 insertions(+), 8 deletions(-)
When CONFIG_MEMORY_FAILURE not set
we get these build failures.
Regression found on x86_64 and i386 gcc-11 builds
Following build warnings / errors reported on Linux mainline master.
metadata:
git_describe: v5.15-559-g19901165d90f
git_repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git_short_log: 19901165d90f (\"Merge tag
'for-5.16/inode-sync-2021-10-29' of git://git.kernel.dk/linux-block\")
target_arch: x86_64
toolchain: gcc-11
In file included from include/linux/mmzone.h:22,
from include/linux/gfp.h:6,
from include/linux/slab.h:15,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:9:
include/linux/page-flags.h:806:29: error: macro "PAGEFLAG_FALSE"
requires 2 arguments, but only 1 given
806 | PAGEFLAG_FALSE(HasHWPoisoned)
| ^
include/linux/page-flags.h:411: note: macro "PAGEFLAG_FALSE" defined here
411 | #define PAGEFLAG_FALSE(uname, lname) TESTPAGEFLAG_FALSE(uname,
lname) \
|
include/linux/page-flags.h:807:39: error: macro "TESTSCFLAG_FALSE"
requires 2 arguments, but only 1 given
807 | TESTSCFLAG_FALSE(HasHWPoisoned)
| ^
include/linux/page-flags.h:414: note: macro "TESTSCFLAG_FALSE" defined here
414 | #define TESTSCFLAG_FALSE(uname, lname)
\
|
include/linux/page-flags.h:806:1: error: unknown type name 'PAGEFLAG_FALSE'
806 | PAGEFLAG_FALSE(HasHWPoisoned)
| ^~~~~~~~~~~~~~
include/linux/page-flags.h:807:25: error: expected ';' before 'static'
807 | TESTSCFLAG_FALSE(HasHWPoisoned)
| ^
| ;
......
815 | static inline bool is_page_hwpoison(struct page *page)
| ~~~~~~
make[2]: *** [scripts/Makefile.build:121: arch/x86/kernel/asm-offsets.s] Error 1
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
build link:
-----------
https://builds.tuxbuild.com/20KPBpXK6K0bKSIKAIKfwlBq7O4/build.log
build config:
-------------
https://builds.tuxbuild.com/20KPBpXK6K0bKSIKAIKfwlBq7O4/config
# To install tuxmake on your system globally
# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-11
--kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/20KPBpXK6K0bKSIKAIKfwlBq7O4/config
link:
https://builds.tuxbuild.com/20KPBpXK6K0bKSIKAIKfwlBq7O4/tuxmake_reproducer.sh
--
Linaro LKFT
https://lkft.linaro.org
next prev parent reply other threads:[~2021-11-01 19:05 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 21:53 [RFC v3 PATCH 0/5] Solve silent data loss caused by poisoned page cache (shmem/tmpfs) Yang Shi
2021-09-30 21:53 ` [v3 PATCH 1/5] mm: hwpoison: remove the unnecessary THP check Yang Shi
2021-10-06 2:35 ` Yang Shi
2021-10-06 4:00 ` Naoya Horiguchi
2021-10-06 17:56 ` Yang Shi
2021-09-30 21:53 ` [v3 PATCH 2/5] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault Yang Shi
2021-10-01 7:23 ` Naoya Horiguchi
2021-10-01 21:07 ` Yang Shi
2021-10-04 14:06 ` Kirill A. Shutemov
2021-10-04 18:17 ` Yang Shi
2021-10-04 19:41 ` Kirill A. Shutemov
2021-10-04 20:13 ` Yang Shi
2021-10-06 19:54 ` Peter Xu
2021-10-06 23:41 ` Yang Shi
2021-10-07 16:14 ` Peter Xu
2021-10-07 18:28 ` Yang Shi
2021-10-08 9:35 ` Kirill A. Shutemov
2021-10-11 22:57 ` Peter Xu
2021-10-06 20:15 ` Peter Xu
2021-10-06 23:57 ` Yang Shi
2021-10-07 16:06 ` Peter Xu
2021-10-07 18:19 ` Yang Shi
2021-10-07 20:27 ` Yang Shi
2021-10-07 21:28 ` Yang Shi
2021-10-12 0:55 ` Peter Xu
2021-10-12 1:44 ` Peter Xu
2021-10-12 18:02 ` Yang Shi
2021-10-12 22:10 ` Peter Xu
2021-10-13 2:48 ` Yang Shi
2021-10-13 3:01 ` Peter Xu
2021-10-13 3:27 ` Yang Shi
2021-10-13 3:41 ` Peter Xu
2021-10-13 21:42 ` Yang Shi
2021-10-13 23:13 ` Peter Xu
2021-10-14 6:54 ` Naoya Horiguchi
2021-10-06 20:18 ` Peter Xu
2021-10-07 2:49 ` Yang Shi
2021-11-01 19:05 ` Naresh Kamboju [this message]
2021-11-01 19:26 ` Yang Shi
2021-09-30 21:53 ` [v3 PATCH 3/5] mm: hwpoison: refactor refcount check handling Yang Shi
2021-10-06 22:01 ` Peter Xu
2021-10-07 2:47 ` Yang Shi
2021-10-07 16:18 ` Peter Xu
2021-09-30 21:53 ` [v3 PATCH 4/5] mm: shmem: don't truncate page if memory failure happens Yang Shi
2021-10-01 7:05 ` Naoya Horiguchi
2021-10-01 21:08 ` Yang Shi
2021-10-12 1:57 ` Peter Xu
2021-10-12 19:17 ` Yang Shi
2021-10-12 22:26 ` Peter Xu
2021-10-13 3:00 ` Yang Shi
2021-10-13 3:06 ` Peter Xu
2021-10-13 3:29 ` Yang Shi
2021-09-30 21:53 ` [v3 PATCH 5/5] mm: hwpoison: handle non-anonymous THP correctly Yang Shi
2021-10-01 7:06 ` Naoya Horiguchi
2021-10-01 21:09 ` Yang Shi
2021-10-13 2:40 ` [RFC v3 PATCH 0/5] Solve silent data loss caused by poisoned page cache (shmem/tmpfs) Peter Xu
2021-10-13 3:09 ` Yang Shi
2021-10-13 3:24 ` Peter Xu
2021-10-14 6:54 ` Naoya Horiguchi
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+G9fYs__zKSSLKPh4wEPSY5SH8QYkLzgd_3dJpMX72XxTfpdw@mail.gmail.com \
--to=naresh.kamboju@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=anders.roxell@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkft-triage@lists.linaro.org \
--cc=naoya.horiguchi@nec.com \
--cc=osalvador@suse.de \
--cc=peterx@redhat.com \
--cc=sashal@kernel.org \
--cc=shy828301@gmail.com \
--cc=torvalds@linux-foundation.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