kernel-hacking-2024-linux-s.../fs/proc
Peter Xu efd4149342 mm/smaps: don't access young/dirty bit if pte unpresent
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>
2022-08-20 15:17:45 -07:00
..
array.c proc: add some (hopefully) insightful comments 2022-07-29 18:12:35 -07:00
base.c proc: fix a dentry lock race between release_task and lookup 2022-07-17 17:31:43 -07:00
bootconfig.c
cmdline.c
consoles.c
cpuinfo.c
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 take care to handle NULL ->proc_lseek() 2022-08-14 15:16:18 -04:00
internal.h
interrupts.c
Kconfig
kcore.c
kmsg.c proc: delete unused <linux/uaccess.h> includes 2022-07-17 17:31:39 -07:00
loadavg.c
Makefile
meminfo.c mm: zswap: add basic meminfo and vmstat coverage 2022-05-19 14:08:53 -07:00
namespaces.c
nommu.c proc: delete unused <linux/uaccess.h> includes 2022-07-17 17:31:39 -07:00
page.c
proc_net.c proc: add some (hopefully) insightful comments 2022-07-29 18:12:35 -07:00
proc_sysctl.c sysctl changes for v5.19-rc1 2022-05-26 16:57:20 -07:00
proc_tty.c proc: delete unused <linux/uaccess.h> includes 2022-07-17 17:31:39 -07:00
root.c proc: add some (hopefully) insightful comments 2022-07-29 18:12:35 -07:00
self.c
softirqs.c
stat.c
task_mmu.c mm/smaps: don't access young/dirty bit if pte unpresent 2022-08-20 15:17:45 -07:00
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c proc: delete unused <linux/uaccess.h> includes 2022-07-17 17:31:39 -07:00