Introduced new tracing mode KCOV_MODE_UNIQUE.
Subsystems (3)
PATCH v3 1/1 Introduced new tracing mode KCOV_MODE_UNIQUE.
It simply stores the executed PCs.
The execution order is discarded.
Each bit in the shared buffer represents every fourth byte of the text segment.
Since a call instruction on every supported architecture is at least four bytes, it is safe to just store every fourth byte of the text segment. In contrast to KCOV_MODE_TRACE_PC, the shared buffer cannot overflow. Thus, all executed PCs are recorded.
--- Documentation/dev-tools/kcov.rst | 79 +++++++++++++++++++++++++ include/linux/kcov.h | 12 ++-- include/uapi/linux/kcov.h | 10 ++++ kernel/kcov.c | 98 ++++++++++++++++++++++++-------- 4 files changed, 172 insertions(+), 27 deletions(-)
Documentation/dev-tools/kcov.rst +79 -0
@@ -127,6 +127,85 @@ That is, a parent process opens /sys/kernel/debug/kcov, enables trace mode, mmaps coverage buffer and then forks child processes in a loop. Child processes only need to enable coverage (disable happens automatically on thread end). +If someone is interested in a set of executed PCs, and does not care about +execution order, he or she can use KCOV_INIT_UNIQUE to do so: + +.. code-block:: c + + #include <stdio.h> + #include <stddef.h> + #include <stdint.h> + #include <stdlib.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <sys/ioctl.h> + #include <sys/mman.h> + #include <unistd.h> + #include <fcntl.h> + + #define KCOV_INIT_UNIQUE _IOR('c', 2, unsigned long) + #define KCOV_ENABLE _IO('c', 100) + #define KCOV_DISABLE _IO('c', 101) + + #define BITS_PER_LONG 64 + #define KCOV_TRACE_PC 0 + #define KCOV_TRACE_CMP 1 + #define KCOV_UNIQUE_PC 2 + /* + * Determine start of text segment via 'nm vmlinux | grep _stext | cut -d " " -f1', + * and fill in. + */ + #define STEXT_START 0xffffffff81000000 + + + + int main(int argc, char **argv) + { + int fd; + unsigned long *cover, n, i; + + /* A single fd descriptor allows coverage collection on a single + * thread. + */ + fd = open("/sys/kernel/debug/kcov", O_RDWR); + if (fd == -1) + perror("open"), exit(1); + /* Setup trace mode and trace size. */ + if ((n = ioctl(fd, KCOV_INIT_UNIQUE, 0)) < 0) + perror("ioctl"), exit(1); + /* Mmap buffer shared between kernel- and user-space. */ + cover = (unsigned long*)mmap(NULL, n, + PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if ((void*)cover == MAP_FAILED) + perror("mmap"), exit(1); + /* Enable coverage collection on the current thread. */ + if (ioctl(fd, KCOV_ENABLE, KCOV_UNIQUE_PC)) + perror("ioctl"), exit(1); + /* That's the target syscal call. */ + read(-1, NULL, 0); + /* Disable coverage collection for the current thread. After this call + * coverage can be enabled for a different thread. + */ + if (ioctl(fd, KCOV_DISABLE, 0)) + perror("ioctl"), exit(1); + /* Convert byte size into element size */ + n /= sizeof(unsigned long); + /* Print executed PCs in sorted order */ + for (i = 0; i < n; i++) { + for (int j = 0; j < BITS_PER_LONG; j++) { + if (cover[i] & (1L << j)) { + printf("0x%jx\n", (uintmax_t)(STEXT_START + (i * BITS_PER_LONG + j) * 4)); + } + } + } + /* Free resources. */ + if (munmap(cover, n * sizeof(unsigned long))) + perror("munmap"), exit(1); + if (close(fd)) + perror("close"), exit(1); + return 0; + } + Comparison operands collection ------------------------------
include/linux/kcov.h +8 -4
@@ -12,17 +12,21 @@ enum kcov_mode {/* Coverage collection is not enabled yet. */ KCOV_MODE_DISABLED =0 ,/* KCOV was initialized, but tracing mode hasn't been chosen yet. */ -KCOV_MODE_INIT =1 , +KCOV_MODE_INIT_TRACE =1 , +/* KCOV was initialized, but recording of unique PCs hasn't been chosen yet. */ +KCOV_MODE_INIT_UNIQUE =2 ,/* * Tracing coverage collection mode. * Covered PCs are collected in a per-task buffer. */ -KCOV_MODE_TRACE_PC =2 , +KCOV_MODE_TRACE_PC =4 ,/* Collecting comparison operands mode. */ - KCOV_MODE_TRACE_CMP = 3, +KCOV_MODE_TRACE_CMP =8 , +/* Collecting unique covered PCs. Execution order is not saved. */ + KCOV_MODE_UNIQUE_PC = 16, }; -#define KCOV_IN_CTXSW (1 << 30) +#define KCOV_IN_CTXSW (1 << 31)void kcov_task_init (struct task_struct *t);void kcov_task_exit (struct task_struct *t);
include/uapi/linux/kcov.h +10 -0
@@ -19,6 +19,7 @@ struct kcov_remote_arg {#define KCOV_REMOTE_MAX_HANDLES 0x100#define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) +#define KCOV_INIT_UNIQUE _IOR('c', 2, unsigned long)#define KCOV_ENABLE _IO('c', 100)#define KCOV_DISABLE _IO('c', 101)#define KCOV_REMOTE_ENABLE _IOW('c', 102, struct kcov_remote_arg)
@@ -35,6 +36,15 @@ enum {KCOV_TRACE_PC =0 ,/* Collecting comparison operands mode. */ KCOV_TRACE_CMP =1 , +/* +* Unique coverage collection mode. +* Unique covered PCs are collected in a per-task buffer. +* De-duplicates the collected PCs. Execution order is *not* saved. +* Each bit in the buffer represents every fourth byte of the text segment. +* Since a call instruction is at least four bytes on every supported +* architecture, storing just every fourth byte is sufficient. +*/ + KCOV_UNIQUE_PC = 2, };/*
kernel/kcov.c +75 -23
200 lines not on this page · raw message
Signature · 1 line
2.30.2
Quoted 9 lines · Alexander Lochmann
It simply stores the executed PCs.
The execution order is discarded.
Each bit in the shared buffer represents every fourth byte of the text segment.
Since a call instruction on every supported architecture is at least four bytes, it is safe to just store every fourth byte of the text segment. In contrast toKCOV_MODE_TRACE_PC, the shared buffer cannot overflow. Thus, all executed PCs are recorded.
Odd line-wrapping :(
Anyway, this describes _what_ this does, but I have no idea _why_ we want this at all. What does this do that you can not do today? Why is this needed? Who will use this? What tools have been modified to work with it to prove it works properly?
thanks,
greg k-h
Andrey Konovalov
reviewerQuoted 1 line · Alexander Lochmann
Hi Alexander,
Quoted 7 lines
It simply stores the executed PCs.
The execution order is discarded.
Each bit in the shared buffer represents every fourth byte of the text segment.
Since a call instruction on every supported architecture is at least four bytes, it is safe to just store every fourth byte of the text segment.
What about jumps?
[...]
include/linux/kcov.h enum kcov_mode { · line 29
Quoted 2 lines
include/linux/kcov.h +1
-1-#define KCOV_IN_CTXSW (1 << 30) +#define KCOV_IN_CTXSW (1 << 31)
This change needs to be mentioned and explained in the changelog.
Quoted 20 lines
kernel/kcov.c +4
-4-static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) +static __always_inline notrace bool check_kcov_mode(enum kcov_mode needed_mode, +struct task_struct *t, +unsigned int *mode) { -unsigned int mode; -/* * We are interested in code coverage as a function of a syscall inputs, * so we ignore code executed in interrupts, unless we are in a remote @@ -162,7 +163,7 @@ static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru*/ if (!in_task () && !(in_serving_softirq () && t->kcov_softirq))return false; - mode =READ_ONCE (t->kcov_mode); + *mode =READ_ONCE (t->kcov_mode);/* * There is some code that runs in interrupts but for which * in_interrupt() returns false (e.g. preempt_schedule_irq()).
kernel/kcov.c static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru · line 175
Quoted 5 lines
kernel/kcov.c +1
-1@@ -171,7 +172,7 @@ static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru* kcov_start(). */ barrier (); -return mode == needed_mode; +return ((int )(*mode & (KCOV_IN_CTXSW | needed_mode))) >0 ;
This change needs to be mentioned and explained in the changelog.
[...]
Quoted 23 lines
kernel/kcov.c +6
-7static notrace unsigned long canonicalize_ip (unsigned long ip)@@ -191,18 +192,27 @@ void notrace __sanitizer_cov_trace_pc(void)struct task_struct *t;unsigned long *area;unsigned long ip =canonicalize_ip (_RET_IP_); -unsigned long pos; +unsigned long pos, idx; +unsigned int mode; t = current; -if (!check_kcov_mode (KCOV_MODE_TRACE_PC , t)) +if (!check_kcov_mode (KCOV_MODE_TRACE_PC |KCOV_MODE_UNIQUE_PC , t, &mode))return ; area = t->kcov_area; -/* The first 64-bit word is the number of subsequent PCs. */ - pos =READ_ONCE (area[0 ]) +1 ; -if (likely (pos < t->kcov_size)) { - area[pos] = ip; -WRITE_ONCE (area[0 ], pos); +if (likely (mode ==KCOV_MODE_TRACE_PC )) { +/* The first 64-bit word is the number of subsequent PCs. */ + pos =READ_ONCE (area[0 ]) +1 ;
kernel/kcov.c void notrace __sanitizer_cov_trace_pc(void) · line 215
Quoted 10 lines
kernel/kcov.c +10
-0+if (likely (pos < t->kcov_size)) { + area[pos] = ip; +WRITE_ONCE (area[0 ], pos); + } + }else { + idx = (ip -canonicalize_ip ((unsigned long )&_stext)) /4 ; + pos = idx %BITS_PER_LONG ; + idx /=BITS_PER_LONG ; +if (likely (idx < t->kcov_size)) +WRITE_ONCE (area[idx],READ_ONCE (area[idx]) |1L << pos);
This is confusing: for KCOV_MODE_TRACE_PC, pos is used to index area, and for else, idx is used to index area. You should swap idx and pos.
[...]
kernel/kcov.c static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) · line 230
Quoted 10 lines
kernel/kcov.c +2
-1@@ -213,9 +223,10 @@ static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)struct task_struct *t;u64 *area;u64 count, start_index, end_pos, max_pos; +unsigned int mode; t = current; -if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t)) +if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t, &mode))return ;
mode isn't used here, right? No need for it then.
Quoted 17 lines
kernel/kcov.c +3
-1@@ -562,12 +576,14 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, {struct task_struct *t;unsigned long size, unused; -int mode, i; +int mode, i, text_size, ret =0 ;struct kcov_remote_arg *remote_arg;struct kcov_remote *remote;unsigned long flags;switch (cmd) { +case KCOV_INIT_UNIQUE : + fallthrough;case KCOV_INIT_TRACE :/* * Enable kcov in trace mode and setup buffer size.
kernel/kcov.c static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · line 600
Quoted 9 lines
kernel/kcov.c +1
-5@@ -581,11 +597,42 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,* that must not overflow. */ size = arg; -if (size <2 || size >INT_MAX /sizeof (unsigned long )) -return -EINVAL ; - kcov->size = size; - kcov->mode =KCOV_MODE_INIT ; -return 0 ; +if (cmd ==KCOV_INIT_UNIQUE ) {
Let's put this code under KCOV_INIT_UNIQUE in the switch. This internal if only saves duplicating two lines of code, which isn't worth it.
Quoted 25 lines
kernel/kcov.c +25
-0+if (size !=0 ) +return -EINVAL ; + text_size = (canonicalize_ip ((unsigned long )&_etext) + -canonicalize_ip ((unsigned long )&_stext)); +/** +* A call instr is at least four bytes on every supported architecture. +* Hence, just every fourth instruction can potentially be a call. +*/ + text_size =roundup (text_size,4 ); + text_size /=4 ; +/* +* Round up size of text segment to multiple of BITS_PER_LONG. +* Otherwise, we cannot track +* the last (text_size % BITS_PER_LONG) addresses. +*/ + text_size =roundup (text_size,BITS_PER_LONG ); +/* Get the amount of bytes needed */ + text_size = text_size /8 ; +/* mmap() requires size to be a multiple of PAGE_SIZE */ + text_size =roundup (text_size,PAGE_SIZE ); +/* Get the cover size (= amount of bytes stored) */ + ret = text_size; + kcov->size = text_size /sizeof (unsigned long ); + kcov_debug("text size = 0x%lx, roundup = 0x%x, kcov->size = 0x%x\n", + ((unsigned long)&_etext) - ((unsigned long)&_stext),
kernel/kcov.c static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · line 635
Quoted 10 lines
kernel/kcov.c +10
-0+ text_size, + kcov->size); + kcov->mode =KCOV_MODE_INIT_UNIQUE ; + }else { +if (size <2 || size >INT_MAX /sizeof (unsigned long )) +return -EINVAL ; + kcov->size = size; + kcov->mode =KCOV_MODE_INIT_TRACE ; + } +return ret;
Thanks!
Dmitry Vyukov
reviewerQuoted 15 lines · Andrey Konovalov
Quoted 1 line · Alexander Lochmann
Hi Alexander,
Quoted 7 lines
It simply stores the executed PCs.
The execution order is discarded.
Each bit in the shared buffer represents every fourth byte of the text segment.
Since a call instruction on every supported architecture is at least four bytes, it is safe to just store every fourth byte of the text segment.
Quoted 1 line
What about jumps?
KCOV adds call __sanitizer_cov_trace_pc per coverage point. So besides the instructions in the original code, we also always have this call.
Quoted 162 lines
[...]
include/linux/kcov.h enum kcov_mode { · line 29
Quoted 2 lines
include/linux/kcov.h +1
-1-#define KCOV_IN_CTXSW (1 << 30) +#define KCOV_IN_CTXSW (1 << 31)This change needs to be mentioned and explained in the changelog.
Quoted 20 lines
kernel/kcov.c +4
-4-static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) +static __always_inline notrace bool check_kcov_mode(enum kcov_mode needed_mode, +struct task_struct *t, +unsigned int *mode) { -unsigned int mode; -/* * We are interested in code coverage as a function of a syscall inputs, * so we ignore code executed in interrupts, unless we are in a remote @@ -162,7 +163,7 @@ static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru*/ if (!in_task () && !(in_serving_softirq () && t->kcov_softirq))return false; - mode =READ_ONCE (t->kcov_mode); + *mode =READ_ONCE (t->kcov_mode);/* * There is some code that runs in interrupts but for which * in_interrupt() returns false (e.g. preempt_schedule_irq()). kernel/kcov.c static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru · line 175
Quoted 5 lines
kernel/kcov.c +1
-1@@ -171,7 +172,7 @@ static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru* kcov_start(). */ barrier (); -return mode == needed_mode; +return ((int )(*mode & (KCOV_IN_CTXSW | needed_mode))) >0 ;This change needs to be mentioned and explained in the changelog.
[...]
Quoted 23 lines
kernel/kcov.c +6
-7static notrace unsigned long canonicalize_ip (unsigned long ip)@@ -191,18 +192,27 @@ void notrace __sanitizer_cov_trace_pc(void)struct task_struct *t;unsigned long *area;unsigned long ip =canonicalize_ip (_RET_IP_); -unsigned long pos; +unsigned long pos, idx; +unsigned int mode; t = current; -if (!check_kcov_mode (KCOV_MODE_TRACE_PC , t)) +if (!check_kcov_mode (KCOV_MODE_TRACE_PC |KCOV_MODE_UNIQUE_PC , t, &mode))return ; area = t->kcov_area; -/* The first 64-bit word is the number of subsequent PCs. */ - pos =READ_ONCE (area[0 ]) +1 ; -if (likely (pos < t->kcov_size)) { - area[pos] = ip; -WRITE_ONCE (area[0 ], pos); +if (likely (mode ==KCOV_MODE_TRACE_PC )) { +/* The first 64-bit word is the number of subsequent PCs. */ + pos =READ_ONCE (area[0 ]) +1 ;kernel/kcov.c void notrace __sanitizer_cov_trace_pc(void) · line 215
Quoted 10 lines
kernel/kcov.c +10
-0+if (likely (pos < t->kcov_size)) { + area[pos] = ip; +WRITE_ONCE (area[0 ], pos); + } + }else { + idx = (ip -canonicalize_ip ((unsigned long )&_stext)) /4 ; + pos = idx %BITS_PER_LONG ; + idx /=BITS_PER_LONG ; +if (likely (idx < t->kcov_size)) +WRITE_ONCE (area[idx],READ_ONCE (area[idx]) |1L << pos);This is confusing: for
KCOV_MODE_TRACE_PC, pos is used to index area, and for else, idx is used to index area. You should swap idx and pos.[...]
kernel/kcov.c static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) · line 230
Quoted 10 lines
kernel/kcov.c +2
-1@@ -213,9 +223,10 @@ static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)struct task_struct *t;u64 *area;u64 count, start_index, end_pos, max_pos; +unsigned int mode; t = current; -if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t)) +if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t, &mode))return ;mode isn't used here, right? No need for it then.
Quoted 17 lines
kernel/kcov.c +3
-1@@ -562,12 +576,14 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, {struct task_struct *t;unsigned long size, unused; -int mode, i; +int mode, i, text_size, ret =0 ;struct kcov_remote_arg *remote_arg;struct kcov_remote *remote;unsigned long flags;switch (cmd) { +case KCOV_INIT_UNIQUE : + fallthrough;case KCOV_INIT_TRACE :/* * Enable kcov in trace mode and setup buffer size. kernel/kcov.c static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · line 600
Quoted 9 lines
kernel/kcov.c +1
-5@@ -581,11 +597,42 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,* that must not overflow. */ size = arg; -if (size <2 || size >INT_MAX /sizeof (unsigned long )) -return -EINVAL ; - kcov->size = size; - kcov->mode =KCOV_MODE_INIT ; -return 0 ; +if (cmd ==KCOV_INIT_UNIQUE ) {Let's put this code under
KCOV_INIT_UNIQUEin the switch. This internal if only saves duplicating two lines of code, which isn't worth it.Quoted 25 lines
kernel/kcov.c +25
-0+if (size !=0 ) +return -EINVAL ; + text_size = (canonicalize_ip ((unsigned long )&_etext) + -canonicalize_ip ((unsigned long )&_stext)); +/** +* A call instr is at least four bytes on every supported architecture. +* Hence, just every fourth instruction can potentially be a call. +*/ + text_size =roundup (text_size,4 ); + text_size /=4 ; +/* +* Round up size of text segment to multiple of BITS_PER_LONG. +* Otherwise, we cannot track +* the last (text_size % BITS_PER_LONG) addresses. +*/ + text_size =roundup (text_size,BITS_PER_LONG ); +/* Get the amount of bytes needed */ + text_size = text_size /8 ; +/* mmap() requires size to be a multiple of PAGE_SIZE */ + text_size =roundup (text_size,PAGE_SIZE ); +/* Get the cover size (= amount of bytes stored) */ + ret = text_size; + kcov->size = text_size /sizeof (unsigned long ); + kcov_debug("text size = 0x%lx, roundup = 0x%x, kcov->size = 0x%x\n", + ((unsigned long)&_etext) - ((unsigned long)&_stext),kernel/kcov.c static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · line 635
Quoted 10 lines
kernel/kcov.c +10
-0+ text_size, + kcov->size); + kcov->mode =KCOV_MODE_INIT_UNIQUE ; + }else { +if (size <2 || size >INT_MAX /sizeof (unsigned long )) +return -EINVAL ; + kcov->size = size; + kcov->mode =KCOV_MODE_INIT_TRACE ; + } +return ret;Thanks!
--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/CA%2BfCnZcTi%3DQLGC_LCdhs%2BfMrxkqX66kXEuM5ewOmjVjifKzUrw%40mail.gmail.com.
Andrey Konovalov
reviewerQuoted 17 lines · Dmitry Vyukov
Quoted 15 lines · Andrey Konovalov
Quoted 1 line · Alexander Lochmann
Hi Alexander,
Quoted 7 lines
It simply stores the executed PCs.
The execution order is discarded.
Each bit in the shared buffer represents every fourth byte of the text segment.
Since a call instruction on every supported architecture is at least four bytes, it is safe to just store every fourth byte of the text segment.
Quoted 4 lines
Quoted 1 line
What about jumps?
KCOV adds call
__sanitizer_cov_trace_pcper coverage point. So besides the instructions in the original code, we also always have this call.
Ah, I see. This should be explained in the changelog.
This means that a KCOV user will need the kernel binary to recover the actual PCs that were covered, as the information about the lower two bits is lost, right? This needs to be explained as well.
Thanks!
Quoted 7 lines · Andrey Konovalov
Quoted 7 lines
kernel/kcov.c +1
-0@@ -213,9 +223,10 @@ static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)struct task_struct *t;u64 *area;u64 count, start_index, end_pos, max_pos; +unsigned int mode;
Quoted 7 lines
kernel/kcov.c static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip) · line 230
Quoted 4 lines
kernel/kcov.c +1
-1t = current; -if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t)) +if (!check_kcov_mode (KCOV_MODE_TRACE_CMP , t, &mode))return ;mode isn't used here, right? No need for it then.
No, it's not. However, check_kcov_mode() needs it. Dmitry suggested passing a pointer to check_kcov_mode(), and let the optimizer do the rest.
Quoted 22 lines
Quoted 22 lines
kernel/kcov.c +3
-3@@ -562,12 +576,14 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, {struct task_struct *t;unsigned long size, unused; -int mode, i; +int mode, i, text_size, ret =0 ;struct kcov_remote_arg *remote_arg;struct kcov_remote *remote;unsigned long flags;switch (cmd) { +case KCOV_INIT_UNIQUE : + fallthrough;case KCOV_INIT_TRACE :/* * Enable kcov in trace mode and setup buffer size. @@ -581,11 +597,42 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,* that must not overflow. */ size = arg; -if (size <2 || size >INT_MAX /sizeof (unsigned long )) -return -EINVAL ;
Quoted 8 lines
kernel/kcov.c static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · line 600
Quoted 4 lines
kernel/kcov.c +1
-3- kcov->size = size; - kcov->mode =KCOV_MODE_INIT ; -return 0 ; +if (cmd ==KCOV_INIT_UNIQUE ) {Let's put this code under
KCOV_INIT_UNIQUEin the switch. This internal if only saves duplicating two lines of code, which isn't worth it.
So. Shall I skip the fallthrough and move 'my' code upwards?
Signature · 3 lines
Alexander Lochmann PGP key: 0xBC3EF6FD Heiliger Weg 72 phone: +49.231.28053964 D-44141 Dortmund mobile: +49.151.15738323