Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kcov.c Create Date:2022-07-28 11:34:02
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kcov_ioctl_locked

Proto:static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, unsigned long arg)

Type:int

Parameter:

TypeParameterName
struct kcov *kcov
unsigned intcmd
unsigned longarg
555  Case cmd == KCOV_INIT_TRACE
556  kcov_debug("KCOV_INIT_TRACE\n")
561  If mode != KCOV_MODE_DISABLED Then Return -EBUSY
568  size = arg
569  If size < 2 || size > INT_MAX / sizeof(unsignedlong) Then Return -EINVAL
571  Size of arena (in long's). = size
572  mode = KCOV_MODE_INIT
573  Return 0
574  Case cmd == KCOV_ENABLE
575  kcov_debug("KCOV_ENABLE\n")
583  If mode != KCOV_MODE_INIT || Not Coverage buffer shared with user space. Then Return -EINVAL
585  t = current process
586  If (Task for which we collect coverage, or NULL. != NULL || kcov != NULL) Then Return -EBUSY
588  mode = kcov_get_mode(arg)
589  If mode < 0 Then Return mode
591  Fault in a lazily-faulted vmalloc area before it can be used by* __santizer_cov_trace_pc(), to avoid recursion issues if any code on the* vmalloc fault handling path is instrumented.
592  mode = mode
593  kcov_start(t, Size of arena (in long's). , Coverage buffer shared with user space. , mode, Sequence is incremented each time kcov is reenabled, used by* kcov_remote_stop(), see the comment there.)
595  kcov = kcov
596  Task for which we collect coverage, or NULL. = t
598  kcov_get(kcov)
599  Return 0
600  Case cmd == KCOV_DISABLE
601  kcov_debug("KCOV_DISABLE\n")
603  unused = arg
604  If unused != 0 || kcov != kcov Then Return -EINVAL
606  t = current process
607  If WARN_ON(Task for which we collect coverage, or NULL. != t) Then Return -EINVAL
609  kcov_disable(t, kcov)
610  kcov_put(kcov)
611  Return 0
612  Case cmd == KCOV_REMOTE_ENABLE
613  kcov_debug("KCOV_REMOTE_ENABLE\n")
614  If mode != KCOV_MODE_INIT || Not Coverage buffer shared with user space. Then Return -EINVAL
616  t = current process
617  If (Task for which we collect coverage, or NULL. != NULL || kcov != NULL) Then Return -EBUSY
619  remote_arg = arg
620  mode = kcov_get_mode(KCOV_TRACE_PC or KCOV_TRACE_CMP )
621  If mode < 0 Then Return mode
623  If Length of coverage buffer in words > LONG_MAX / sizeof(unsignedlong) Then Return -EINVAL
625  mode = mode
626  kcov = kcov
627  Task for which we collect coverage, or NULL. = t
628  Collecting coverage from remote (background) threads. = true
629  Size of remote area (in long's). = Length of coverage buffer in words
630  spin_lock( & kcov_remote_lock)
632  kcov_debug("handle %llx\n", handles[i])
636  kcov_disable(t, kcov)
637  Return -EINVAL
640  If IS_ERR(remote) Then
642  kcov_disable(t, kcov)
643  Return PTR_ERR(remote)
646  If common_handle Then
647  kcov_debug("common handle %llx\n", common_handle)
652  kcov_disable(t, kcov)
653  Return -EINVAL
657  If IS_ERR(remote) Then
659  kcov_disable(t, kcov)
660  Return PTR_ERR(remote)
664  spin_unlock( & kcov_remote_lock)
666  kcov_get(kcov)
667  Return 0
668  Default
669  Return -ENOTTY
Caller
NameDescribe
kcov_ioctl