Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
arm64: print alloc free paths for address in registers
In case of a use after free kernel OOPs, freed path of the object is required to debug futher. In most of cases the object address is present in one of the registers. Thus check the register's address and if it belongs to slab, print its alloc and free path. commit a02a257 ("mm/slub: add support for free path information of an object") provides free path along with alloc path of object in mem_dump_obj(). Thus call it with register values same as in ARM with commit 14c0508 ("arm: print alloc free paths for address in registers") e.g. in the below issue register x20 belongs to slab, and a use after free issue occurred on one of its dereferenced values: [ 19.516507] Unable to handle kernel paging request at virtual address 006b6b6b6b6b6b73 .. .. [ 19.528784] Register x10 information: 0-page vmalloc region starting at 0xffff800011bb0000 allocated at paging_init+0x1d8/0x544 [ 19.529143] Register x11 information: 0-page vmalloc region starting at 0xffff800011bb0000 allocated at paging_init+0x1d8/0x544 [ 19.529513] Register x12 information: non-paged memory .. [ 19.544953] Register x20 information: slab kmalloc-128 start ffff0000c3a34280 data offset 128 pointer offset 0 size 128 allocated at meminfo_proc_show+0x44/0x588 [ 19.545432] ___slab_alloc+0x638/0x658 [ 19.545576] __slab_alloc.isra.0+0x2c/0x58 [ 19.545728] kmem_cache_alloc+0x584/0x598 [ 19.545877] meminfo_proc_show+0x44/0x588 [ 19.546022] seq_read_iter+0x258/0x460 [ 19.546160] proc_reg_read_iter+0x90/0xd0 [ 19.546308] generic_file_splice_read+0xd0/0x188 [ 19.546474] do_splice_to+0x90/0xe0 [ 19.546609] splice_direct_to_actor+0xbc/0x240 [ 19.546768] do_splice_direct+0x8c/0xe8 [ 19.546911] do_sendfile+0x2c4/0x500 [ 19.547048] __arm64_sys_sendfile64+0x160/0x168 [ 19.547205] el0_svc_common.constprop.0+0x60/0x120 [ 19.547377] do_el0_svc_compat+0x1c/0x40 [ 19.547524] el0_svc_compat+0x24/0x38 [ 19.547660] el0_sync_compat_handler+0x90/0x158 [ 19.547821] Free path: [ 19.547906] __slab_free+0x3dc/0x538 [ 19.548051] kfree+0x2d8/0x310 [ 19.548176] meminfo_proc_show+0x60/0x588 [ 19.548322] seq_read_iter+0x258/0x460 [ 19.548459] proc_reg_read_iter+0x90/0xd0 [ 19.548602] generic_file_splice_read+0xd0/0x188 [ 19.548761] do_splice_to+0x90/0xe0 [ 19.548889] splice_direct_to_actor+0xbc/0x240 [ 19.549040] do_splice_direct+0x8c/0xe8 [ 19.549183] do_sendfile+0x2c4/0x500 [ 19.549319] __arm64_sys_sendfile64+0x160/0x168 [ 19.549477] el0_svc_common.constprop.0+0x60/0x120 [ 19.549646] do_el0_svc_compat+0x1c/0x40 [ 19.549782] el0_svc_compat+0x24/0x38 [ 19.549913] el0_sync_compat_handler+0x90/0x158 [ 19.550067] el0_sync_compat+0x174/0x180 .. Signed-off-by: Vaneet Narang <v.narang@samsung.com> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
- Loading branch information