• Wu Fengguang's avatar
    kcore: add _text to KCORE_TEXT · 36e15263
    Wu Fengguang authored
    Extend KCORE_TEXT to cover the pages between _text and _stext, to allow
    examining some important page table pages.
    
    `readelf -a` output on x86_64 before and after patch:
    	  Type           Offset             VirtAddr           PhysAddr
    before    LOAD           0x00007fff8100c000 0xffffffff81009000 0x0000000000000000
    after     LOAD           0x00007fff81003000 0xffffffff81000000 0x0000000000000000
    
    The newly covered pages are:
    
    	0xffffffff81000000 <startup_64> etc.
    	0xffffffff81001000 <init_level4_pgt>
    	0xffffffff81002000 <level3_ident_pgt>
    	0xffffffff81003000 <level3_kernel_pgt>
    	0xffffffff81004000 <level2_fixmap_pgt>
    	0xffffffff81005000 <level1_fixmap_pgt>
    	0xffffffff81006000 <level2_ident_pgt>
    	0xffffffff81007000 <level2_kernel_pgt>
    	0xffffffff81008000 <level2_spare_pgt>
    
    Before patch, /proc/kcore shows outdated contents for the above page
    table pages, for example:
    
    	(gdb) p level3_ident_pgt
    	$1 = {<text variable, no debug info>} 0xffffffff81002000 <level3_ident_pgt>
    	(gdb) p/x *((pud_t *)&level3_ident_pgt)@512
    	$2 = {{pud = 0x1006063}, {pud = 0x0} <repeats 511 times>}
    
    while the real content is:
    
    	root@hp /home/wfg# hexdump -s 0x1002000 -n 4096 /dev/mem
    	1002000 6063 0100 0000 0000 8067 0000 0000 0000
    	1002010 0000 0000 0000 0000 0000 0000 0000 0000
    	*
    	1003000
    
    That is, on a x86_64 box with 2GB memory, we can see first-1GB / full-2GB
    identity mapping before/after patch:
    
    	(gdb) p/x *((pud_t *)&level3_ident_pgt)@512
    before  $1 = {{pud = 0x1006063}, {pud = 0x0} <repeats 511 times>}
    after   $1 = {{pud = 0x1006063}, {pud = 0x8067}, {pud = 0x0} <repeats 510 times>}
    
    Obviously the content before patch is wrong.
    Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    36e15263
Name
Last commit
Last update
..
9p Loading commit data...
adfs Loading commit data...
affs Loading commit data...
afs Loading commit data...
autofs Loading commit data...
autofs4 Loading commit data...
befs Loading commit data...
bfs Loading commit data...
btrfs Loading commit data...
cachefiles Loading commit data...
ceph Loading commit data...
cifs Loading commit data...
coda Loading commit data...
configfs Loading commit data...
cramfs Loading commit data...
debugfs Loading commit data...
devpts Loading commit data...
dlm Loading commit data...
ecryptfs Loading commit data...
efs Loading commit data...
exofs Loading commit data...
exportfs Loading commit data...
ext2 Loading commit data...
ext3 Loading commit data...
ext4 Loading commit data...
fat Loading commit data...
freevxfs Loading commit data...
fscache Loading commit data...
fuse Loading commit data...
gfs2 Loading commit data...
hfs Loading commit data...
hfsplus Loading commit data...
hostfs Loading commit data...
hpfs Loading commit data...
hppfs Loading commit data...
hugetlbfs Loading commit data...
isofs Loading commit data...
jbd Loading commit data...
jbd2 Loading commit data...
jffs2 Loading commit data...
jfs Loading commit data...
lockd Loading commit data...
logfs Loading commit data...
minix Loading commit data...
ncpfs Loading commit data...
nfs Loading commit data...
nfs_common Loading commit data...
nfsd Loading commit data...
nilfs2 Loading commit data...
nls Loading commit data...
notify Loading commit data...
ntfs Loading commit data...
ocfs2 Loading commit data...
omfs Loading commit data...
openpromfs Loading commit data...
partitions Loading commit data...
proc Loading commit data...
qnx4 Loading commit data...
quota Loading commit data...
ramfs Loading commit data...
reiserfs Loading commit data...
romfs Loading commit data...
smbfs Loading commit data...
squashfs Loading commit data...
sysfs Loading commit data...
sysv Loading commit data...
ubifs Loading commit data...
udf Loading commit data...
ufs Loading commit data...
xfs Loading commit data...
Kconfig Loading commit data...
Kconfig.binfmt Loading commit data...
Makefile Loading commit data...
aio.c Loading commit data...
anon_inodes.c Loading commit data...
attr.c Loading commit data...
bad_inode.c Loading commit data...
binfmt_aout.c Loading commit data...
binfmt_elf.c Loading commit data...
binfmt_elf_fdpic.c Loading commit data...
binfmt_em86.c Loading commit data...
binfmt_flat.c Loading commit data...
binfmt_misc.c Loading commit data...
binfmt_script.c Loading commit data...
binfmt_som.c Loading commit data...
bio-integrity.c Loading commit data...
bio.c Loading commit data...
block_dev.c Loading commit data...
buffer.c Loading commit data...
char_dev.c Loading commit data...
compat.c Loading commit data...
compat_binfmt_elf.c Loading commit data...
compat_ioctl.c Loading commit data...
dcache.c Loading commit data...
dcookies.c Loading commit data...
direct-io.c Loading commit data...
drop_caches.c Loading commit data...
eventfd.c Loading commit data...
eventpoll.c Loading commit data...
exec.c Loading commit data...
fcntl.c Loading commit data...
fifo.c Loading commit data...
file.c Loading commit data...
file_table.c Loading commit data...
filesystems.c Loading commit data...
fs-writeback.c Loading commit data...
fs_struct.c Loading commit data...
generic_acl.c Loading commit data...
inode.c Loading commit data...
internal.h Loading commit data...
ioctl.c Loading commit data...
ioprio.c Loading commit data...
libfs.c Loading commit data...
locks.c Loading commit data...
mbcache.c Loading commit data...
mpage.c Loading commit data...
namei.c Loading commit data...
namespace.c Loading commit data...
nfsctl.c Loading commit data...
no-block.c Loading commit data...
open.c Loading commit data...
pipe.c Loading commit data...
pnode.c Loading commit data...
pnode.h Loading commit data...
posix_acl.c Loading commit data...
read_write.c Loading commit data...
read_write.h Loading commit data...
readdir.c Loading commit data...
select.c Loading commit data...
seq_file.c Loading commit data...
signalfd.c Loading commit data...
splice.c Loading commit data...
stack.c Loading commit data...
stat.c Loading commit data...
statfs.c Loading commit data...
super.c Loading commit data...
sync.c Loading commit data...
timerfd.c Loading commit data...
utimes.c Loading commit data...
xattr.c Loading commit data...
xattr_acl.c Loading commit data...