The patch titled Subject: mm-mincore-make-mincore-more-conservative-v2 has been added to the -mm tree. Its filename is mm-mincore-make-mincore-more-conservative-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-mincore-make-mincore-more-conservative-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-mincore-make-mincore-more-conservative-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jiri Kosina <jkosina@xxxxxxx> Subject: mm-mincore-make-mincore-more-conservative-v2 Link: http://lkml.kernel.org/r/20190312141708.6652-2-vbabka@xxxxxxx Signed-off-by: Jiri Kosina <jkosina@xxxxxxx> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx> Acked-by: Josh Snyder <joshs@xxxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/mincore.c~mm-mincore-make-mincore-more-conservative-v2 +++ a/mm/mincore.c @@ -175,6 +175,12 @@ static inline bool can_do_mincore(struct return true; if (!vma->vm_file) return false; + /* + * Reveal pagecache information only for non-anonymous mappings that + * correspond to the files the calling process could (if tried) open + * for writing; otherwise we'd be including shared non-exclusive + * mappings, which opens a side channel. + */ return inode_owner_or_capable(file_inode(vma->vm_file)) || inode_permission(file_inode(vma->vm_file), MAY_WRITE) == 0; } @@ -201,7 +207,7 @@ static long do_mincore(unsigned long add return -ENOMEM; end = min(vma->vm_end, addr + (pages << PAGE_SHIFT)); if (!can_do_mincore(vma)) { - unsigned long pages = (end - addr) >> PAGE_SHIFT; + unsigned long pages = DIV_ROUND_UP(end - addr, PAGE_SIZE); memset(vec, 1, pages); return pages; } _ Patches currently in -mm which might be from jkosina@xxxxxxx are mm-mincore-make-mincore-more-conservative.patch mm-mincore-make-mincore-more-conservative-v2.patch