From c2b7c24bc11c4b7b06c244f347b6e96388085a4c Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Tue, 23 Mar 2021 10:28:47 -0700 Subject: [PATCH] ANDROID: mm: page_pinner: unattribute follow_page in munlock_vma_pages_range munlock_vma_pages_range uses follow_page(FOLL_GET) so we need to use put_user_page to avoid false positive. However, munlock path is quite complicated to attribute them. At this point, do not make the muck. Instead just unattribute them to avoid false positive. Bug: 183414571 Signed-off-by: Minchan Kim Signed-off-by: Minchan Kim Change-Id: I4776bd1a94247e226b29fceb3879c338e8c7323a --- mm/mlock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/mlock.c b/mm/mlock.c index c15b5ef12d0b..188aa7458c99 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -470,8 +471,15 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, * has sneaked into the range, we won't oops here: great). */ page = follow_page(vma, start, FOLL_GET | FOLL_DUMP); - if (page && !IS_ERR(page)) { + /* + * munlock_vma_pages_range uses follow_page(FOLL_GET) + * so it need to use put_user_page but the munlock + * path is quite complicated to deal with each put + * sites correctly so just unattribute them to avoid + * false positive at this moment. + */ + reset_page_pinner(page, compound_order(page)); if (PageTransTail(page)) { VM_BUG_ON_PAGE(PageMlocked(page), page); put_page(page); /* follow_page_mask() */