Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:copy_user_test

Proto:static noinline void __init copy_user_test(void)

Type:void

Parameter:Nothing

479  __user * usermem
480  size = 10
483  kmem = kmalloc(size, GFP_KERNEL)
484  If Not kmem Then Return
487  usermem = vm_mmap(NULL, 0, PAGE_SIZE, page can be read | page can be written | page can be executed , don't use a file | Changes are private , 0)
490  If IS_ERR(usermem) Then
491  pr_err("Failed to allocate user memory\n")
492  kfree(kmem)
493  Return
496  pr_info("out-of-bounds in copy_from_user()\n")
497  unused = copy_from_user(kmem, usermem, size + 1)
499  pr_info("out-of-bounds in copy_to_user()\n")
500  unused = copy_to_user(usermem, kmem, size + 1)
502  pr_info("out-of-bounds in __copy_from_user()\n")
503  unused = __copy_from_user(kmem, usermem, size + 1)
505  pr_info("out-of-bounds in __copy_to_user()\n")
506  unused = __copy_to_user(usermem, kmem, size + 1)
508  pr_info("out-of-bounds in __copy_from_user_inatomic()\n")
509  unused = Architectures should provide two primitives (raw_copy_{to,from}_user())* and get rid of their private instances of copy_{to,from}_user() and* __copy_{to,from}_user{,_inatomic}().* raw_copy_{to,from}_user(to, from, size) should copy up to size bytes and
511  pr_info("out-of-bounds in __copy_to_user_inatomic()\n")
512  unused = __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.*@to: Destination address, in user space.*@from: Source address, in kernel space.*@n: Number of bytes to copy.* Context: User context only.
514  pr_info("out-of-bounds in strncpy_from_user()\n")
515  unused = Copy a NUL terminated string from userspace
517  vm_munmap((unsignedlong)usermem, PAGE_SIZE)
518  kfree(kmem)
Caller
NameDescribe
kmalloc_tests_init