linux-stable/fs/proc
Peter Xu 02ab2b234c mm/smaps: don't access young/dirty bit if pte unpresent
[ Upstream commit efd4149342 ]

These bits should only be valid when the ptes are present.  Introducing
two booleans for it and set it to false when !pte_present() for both pte
and pmd accountings.

The bug is found during code reading and no real world issue reported, but
logically such an error can cause incorrect readings for either smaps or
smaps_rollup output on quite a few fields.

For example, it could cause over-estimate on values like Shared_Dirty,
Private_Dirty, Referenced.  Or it could also cause under-estimate on
values like LazyFree, Shared_Clean, Private_Clean.

Link: https://lkml.kernel.org/r/20220805160003.58929-1-peterx@redhat.com
Fixes: b1d4d9e0cb ("proc/smaps: carefully handle migration entries")
Fixes: c94b6923fa ("/proc/PID/smaps: Add PMD migration entry parsing")
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-31 17:18:01 +02:00
..
Kconfig
Makefile
array.c
base.c proc: fix a dentry lock race between release_task and lookup 2022-08-17 15:15:54 +02:00
bootconfig.c
cmdline.c
consoles.c
cpuinfo.c x86/aperfmperf: Replace aperfmperf_get_khz() 2022-04-27 20:22:19 +02:00
devices.c
fd.c procfs: prevent unprivileged processes accessing fdinfo dir 2022-05-09 17:34:28 -07:00
fd.h
generic.c proc: fix dentry/inode overinstantiating under /proc/${pid}/net 2022-05-09 18:29:19 -07:00
inode.c
internal.h
interrupts.c
kcore.c fs/proc/kcore.c: remove check of list iterator against head past the loop body 2022-04-29 14:37:59 -07:00
kmsg.c
loadavg.c
meminfo.c mm: zswap: add basic meminfo and vmstat coverage 2022-05-19 14:08:53 -07:00
namespaces.c
nommu.c
page.c
proc_net.c proc: fix dentry/inode overinstantiating under /proc/${pid}/net 2022-05-09 18:29:19 -07:00
proc_sysctl.c sysctl changes for v5.19-rc1 2022-05-26 16:57:20 -07:00
proc_tty.c
root.c
self.c
softirqs.c
stat.c
task_mmu.c mm/smaps: don't access young/dirty bit if pte unpresent 2022-08-31 17:18:01 +02:00
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c vmcore: convert read_from_oldmem() to take an iov_iter 2022-04-29 14:37:59 -07:00