Lines Matching +full:can +full:- +full:fd

5 for coverage-guided fuzzing. Coverage data of a running kernel is exported via
7 thus KCOV can capture precise coverage of a single system call.
13 inherently non-deterministic parts of the kernel (e.g. scheduler, locking).
15 Besides collecting code coverage, KCOV can also collect comparison operands.
18 Besides collecting coverage data from syscall handlers, KCOV can also collect
24 -------------
41 mount -t debugfs none /sys/kernel/debug
44 -------------------
49 .. code-block:: c
73 int fd;
76 /* A single fd descriptor allows coverage collection on a single
79 fd = open("/sys/kernel/debug/kcov", O_RDWR);
80 if (fd == -1)
83 if (ioctl(fd, KCOV_INIT_TRACE, COVER_SIZE))
85 /* Mmap buffer shared between kernel- and user-space. */
87 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
91 if (ioctl(fd, KCOV_ENABLE, KCOV_TRACE_PC))
96 read(-1, NULL, 0);
102 * coverage can be enabled for a different thread.
104 if (ioctl(fd, KCOV_DISABLE, 0))
109 if (close(fd))
134 The interface is fine-grained to allow efficient forking of test processes.
141 ------------------------------
145 .. code-block:: c
149 /* Number of 64-bit words per record. */
155 * Bit 0 shows whether one of the arguments is a compile-time constant.
165 int fd;
169 fd = open("/sys/kernel/debug/kcov", O_RDWR);
170 if (fd == -1)
172 if (ioctl(fd, KCOV_INIT_TRACE, COVER_SIZE))
179 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
183 if (ioctl(fd, KCOV_ENABLE, KCOV_TRACE_CMP))
186 read(-1, NULL, 0);
193 /* arg1 and arg2 - operands of the comparison. */
196 /* ip - caller address. */
200 /* is_const - true if either operand is a compile-time constant.*/
205 is_const ? "const" : "non-const");
207 if (ioctl(fd, KCOV_DISABLE, 0))
212 if (close(fd))
221 --------------------------
224 userspace process, KCOV can also collect coverage for parts of the kernel
225 executing in other contexts - so-called "remote" coverage.
257 different code sections can be passed at once.
259 For #2, the userspace process instead must pass a non-zero handle through the
268 are used. Bytes 4-7 are reserved and must be zero.
281 In practice, any value can be used for common handle instance id if coverage
290 .. code-block:: c
328 int fd;
332 fd = open("/sys/kernel/debug/kcov", O_RDWR);
333 if (fd == -1)
335 if (ioctl(fd, KCOV_INIT_TRACE, COVER_SIZE))
338 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
346 arg->trace_mode = KCOV_TRACE_PC;
347 arg->area_size = COVER_SIZE;
348 arg->num_handles = 1;
349 arg->common_handle = kcov_remote_handle(KCOV_SUBSYSTEM_COMMON,
351 arg->handles[0] = kcov_remote_handle(KCOV_SUBSYSTEM_USB,
353 if (ioctl(fd, KCOV_REMOTE_ENABLE, arg))
367 if (ioctl(fd, KCOV_DISABLE, 0))
371 if (close(fd))