Rongwei Wang 8468e937df mm, thp: fix incorrect unmap behavior for private pages
When truncating pagecache on file THP, the private pages of a process
should not be unmapped mapping.  This incorrect behavior on a dynamic
shared libraries which will cause related processes to happen core dump.

A simple test for a DSO (Prerequisite is the DSO mapped in file THP):

    int main(int argc, char *argv[])
    {
	int fd;

	fd = open(argv[1], O_WRONLY);
	if (fd < 0) {
		perror("open");
	}

	close(fd);
	return 0;
    }

The test only to open a target DSO, and do nothing.  But this operation
will lead one or more process to happen core dump.  This patch mainly to
fix this bug.

Link: https://lkml.kernel.org/r/20211025092134.18562-3-rongwei.wang@linux.alibaba.com
Fixes: eb6ecbed0aa2 ("mm, thp: relax the VM_DENYWRITE constraint on file-backed THPs")
Signed-off-by: Rongwei Wang <rongwei.wang@linux.alibaba.com>
Tested-by: Xu Yu <xuyu@linux.alibaba.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Collin Fijalkovich <cfijalkovich@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-11-06 13:30:41 -07:00
..
2021-10-07 11:20:08 -07:00
2021-08-19 09:02:55 +09:00
2021-10-29 10:46:59 -07:00
2021-10-19 09:36:06 +02:00
2021-04-12 15:04:29 +02:00
2021-07-06 11:06:04 -07:00
2021-09-04 10:48:47 -07:00
2021-09-02 12:32:12 -07:00
2021-08-26 22:28:02 +02:00
2021-09-22 09:21:02 -07:00
2021-09-04 10:25:26 -07:00
2021-09-10 09:46:48 -07:00
2021-06-30 12:21:16 -07:00
2021-06-29 10:53:48 -07:00
2021-09-03 15:33:47 -07:00
2021-08-16 10:50:32 -06:00
2021-08-19 09:02:55 +09:00
2021-09-09 11:39:57 -07:00
\n
2021-08-30 10:24:50 -07:00
2021-08-31 11:13:35 -07:00
2021-09-09 13:25:49 -07:00
2021-09-11 14:48:42 -07:00
2021-10-19 17:09:34 -06:00
2021-08-31 11:06:32 -07:00
2021-06-29 10:53:48 -07:00
2021-02-21 11:02:48 -08:00
2021-02-13 17:17:53 +01:00
2021-08-10 17:57:22 +02:00