Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_kasan.c Create Date:2022-07-28 06:29:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kmalloc_uaf2

Proto:static noinline void __init kmalloc_uaf2(void)

Type:void

Parameter:Nothing

323  size = 43
325  pr_info("use-after-free after another kmalloc\n")
326  ptr1 = kmalloc(size, GFP_KERNEL)
327  If Not ptr1 Then
328  pr_err("Allocation failed\n")
329  Return
332  kfree(ptr1)
333  ptr2 = kmalloc(size, GFP_KERNEL)
334  If Not ptr2 Then
335  pr_err("Allocation failed\n")
336  Return
339  ptr1[40] = 'x'
340  If ptr1 == ptr2 Then pr_err("Could not detect use-after-free: ptr1 == ptr2\n")
342  kfree(ptr2)
Caller
NameDescribe
kmalloc_tests_init