# git rev-parse -q --verify 2bc2026269beb0d7923317f5a4a28ce4d5bbc94c^{commit} 2bc2026269beb0d7923317f5a4a28ce4d5bbc94c already have revision, skipping fetch # git checkout -q -f -B kisskb 2bc2026269beb0d7923317f5a4a28ce4d5bbc94c # git clean -qxdf # < git log -1 # commit 2bc2026269beb0d7923317f5a4a28ce4d5bbc94c # Author: Michael Ellerman # Date: Thu Jul 19 23:36:10 2018 +1000 # # powerpc/mm: Don't report PUDs as memory leaks when using kmemleak # # Paul Menzel reported that kmemleak was producing reports such as: # # unreferenced object 0xc0000000f8b80000 (size 16384): # comm "init", pid 1, jiffies 4294937416 (age 312.240s) # hex dump (first 32 bytes): # 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ # 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ # backtrace: # [<00000000d997deb7>] __pud_alloc+0x80/0x190 # [<0000000087f2e8a3>] move_page_tables+0xbac/0xdc0 # [<00000000091e51c2>] shift_arg_pages+0xc0/0x210 # [<00000000ab88670c>] setup_arg_pages+0x22c/0x2a0 # [<0000000060871529>] load_elf_binary+0x41c/0x1648 # [<00000000ecd9d2d4>] search_binary_handler.part.11+0xbc/0x280 # [<0000000034e0cdd7>] __do_execve_file.isra.13+0x73c/0x940 # [<000000005f953a6e>] sys_execve+0x58/0x70 # [<000000009700a858>] system_call+0x5c/0x70 # # Indicating that a PUD was being leaked. # # However what's really happening is that kmemleak is not able to # recognise the references from the PGD to the PUD, because they are not # fully qualified pointers. # # We can confirm that in xmon, eg: # # Find the task struct for pid 1 "init": # 0:mon> P # task_struct ->thread.ksp PID PPID S P CMD # c0000001fe7c0000 c0000001fe803960 1 0 S 13 systemd # # Dump virtual address 0 to find the PGD: # 0:mon> dv 0 c0000001fe7c0000 # pgd @ 0xc0000000f8b01000 # # Dump the memory of the PGD: # 0:mon> d c0000000f8b01000 # c0000000f8b01000 00000000f8b90000 0000000000000000 |................| # c0000000f8b01010 0000000000000000 0000000000000000 |................| # c0000000f8b01020 0000000000000000 0000000000000000 |................| # c0000000f8b01030 0000000000000000 00000000f8b80000 |................| # ^^^^^^^^^^^^^^^^ # # There we can see the reference to our supposedly leaked PUD. But # because it's missing the leading 0xc, kmemleak won't recognise it. # # We can confirm it's still in use by translating an address that is # mapped via it: # 0:mon> dv 7fff94000000 c0000001fe7c0000 # pgd @ 0xc0000000f8b01000 # pgdp @ 0xc0000000f8b01038 = 0x00000000f8b80000 <-- # pudp @ 0xc0000000f8b81ff8 = 0x00000000037c4000 # pmdp @ 0xc0000000037c5ca0 = 0x00000000fbd89000 # ptep @ 0xc0000000fbd89000 = 0xc0800001d5ce0386 # Maps physical address = 0x00000001d5ce0000 # Flags = Accessed Dirty Read Write # # The fix is fairly simple. We need to tell kmemleak to ignore PUD # allocations and never report them as leaks. We can also tell it not to # scan the PGD, because it will never find pointers in there. However it # will still notice if we allocate a PGD and then leak it. # # Reported-by: Paul Menzel # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < git log --format=%s --max-count=1 2bc2026269beb0d7923317f5a4a28ce4d5bbc94c # < make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-next_mpc85xx_defconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- mpc85xx_defconfig # make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-next_mpc85xx_defconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- /kisskb/src/net/Makefile:24: CC cannot link executables. Skipping bpfilter. /kisskb/src/net/Makefile:24: CC cannot link executables. Skipping bpfilter. /kisskb/src/kernel/cgroup/cgroup-v1.c: In function 'cgroup1_mount': /kisskb/src/kernel/cgroup/cgroup-v1.c:1256:20: warning: 'root' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:183:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/sound/soc/codecs/wm8960.c: In function 'wm8960_configure_clocking': /kisskb/src/sound/soc/codecs/wm8960.c:803:70: warning: 'j' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/sound/soc/codecs/wm8960.c:800:68: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2497:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1819:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/mm/hugetlb.c: In function 'alloc_pool_huge_page': /kisskb/src/mm/hugetlb.c:1433:5: warning: 'page' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:339:21: note: 'pdeo' was declared here /kisskb/src/fs/udf/unicode.c: In function 'udf_name_conv_char': /kisskb/src/fs/udf/unicode.c:132:8: warning: 'c' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq': /kisskb/src/drivers/tty/serial/8250/8250_core.c:251:18: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c:231:19: note: 'i' was declared here /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c: In function 'allocate_bd': /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:139:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] arch/powerpc/boot/mpc8555cds.dtb: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) arch/powerpc/boot/mpc8541cds.dtb: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb6b448) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) INFO: Uncompressed kernel (size 0xb5acfc) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xc00000) Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5505995 Bytes = 5376.95 kB = 5.25 MB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5529982 Bytes = 5400.37 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00288 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530492 Bytes = 5400.87 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00288 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530383 Bytes = 5400.76 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530026 Bytes = 5400.42 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530428 Bytes = 5400.81 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00288 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5531920 Bytes = 5402.27 kB = 5.28 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5531580 Bytes = 5401.93 kB = 5.28 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530179 Bytes = 5400.57 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00288 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5531229 Bytes = 5401.59 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5529718 Bytes = 5400.12 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5532363 Bytes = 5402.70 kB = 5.28 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530257 Bytes = 5400.64 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5530380 Bytes = 5400.76 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5532297 Bytes = 5402.63 kB = 5.28 MB Load Address: 00c00000 Entry Point: 00c00248 Image Name: Linux-4.18.0-rc3-g2bc2026 Created: Fri Jul 20 00:54:09 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5529981 Bytes = 5400.37 kB = 5.27 MB Load Address: 00c00000 Entry Point: 00c00288 Completed OK # rm -rf /kisskb/build/powerpc-next_mpc85xx_defconfig_powerpc # Build took: 0:01:38.224193