History

kcov: cleanup debug messages

Patch series "kcov: collect coverage from usb soft interrupts", v4. This patchset extends kcov to allow collecting coverage from soft interrupts and then uses the new functionality to collect coverage from USB code. This has allowed to find at least one new HID bug [1], which was recently fixed by Alan [2]. [1] https://syzkaller.appspot.com/bug?extid=09ef48aa58261464b621 [2] https://patchwork.kernel.org/patch/11283319/ Any subsystem that uses softirqs (e.g. timers) can make use of this in the future. Looking at the recent syzbot reports, an obvious candidate is the networking subsystem [3, 4, 5 and many more]. [3] https://syzkaller.appspot.com/bug?extid=522ab502c69badc66ab7 [4] https://syzkaller.appspot.com/bug?extid=57f89d05946c53dbbb31 [5] https://syzkaller.appspot.com/bug?extid=df358e65d9c1b9d3f5f4 This pach (of 7): Previous commit left a lot of excessive debug messages, clean them up. Link; http://lkml.kernel.org/r/cover.1585233617.git.andreyknvl@google.com Link; http://lkml.kernel.org/r/ab5e2885ce674ba6e04368551e51eeb6a2c11baf.1585233617.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Alexander Potapenko <glider@google.com> Cc: Marco Elver <elver@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com> Link: http://lkml.kernel.org/r/4a497134b2cf7a9d306d28e3dd2746f5446d1605.1584655448.git.andreyknvl@google.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Andrey Konovalov committed 6 years ago

Commit 3c61df31 parent 6929f711 file · +2 −20Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/kcov.c+2−20
@@ -98,6 +98,7 @@ static struct kcov_remote *kcov_remote_find(u64 handle) · 97 unmodified lines
98 return NULL;98 return NULL;
99}99}
100 100
101/* Must be called with kcov_remote_lock locked. */
101static struct kcov_remote *kcov_remote_add(struct kcov *kcov, u64 handle)102static struct kcov_remote *kcov_remote_add(struct kcov *kcov, u64 handle)
102{103{
103 struct kcov_remote *remote;104 struct kcov_remote *remote;
@@ -119,16 +120,13 @@ static struct kcov_remote_area *kcov_remote_area_get(unsigned int size) · 15 unmodified lines
119 struct kcov_remote_area *area;120 struct kcov_remote_area *area;
120 struct list_head *pos;121 struct list_head *pos;
121 122
122 kcov_debug("size = %u\n", size);
123 list_for_each(pos, &kcov_remote_areas) {123 list_for_each(pos, &kcov_remote_areas) {
124 area = list_entry(pos, struct kcov_remote_area, list);124 area = list_entry(pos, struct kcov_remote_area, list);
125 if (area->size == size) {125 if (area->size == size) {
126 list_del(&area->list);126 list_del(&area->list);
127 kcov_debug("rv = %px\n", area);
128 return area;127 return area;
129 }128 }
130 }129 }
131 kcov_debug("rv = NULL\n");
132 return NULL;130 return NULL;
133}131}
134 132
@@ -136,7 +134,6 @@ static struct kcov_remote_area *kcov_remote_area_get(unsigned int size) · 1 unmodified line
136static void kcov_remote_area_put(struct kcov_remote_area *area,134static void kcov_remote_area_put(struct kcov_remote_area *area,
137 unsigned int size)135 unsigned int size)
138{136{
139 kcov_debug("area = %px, size = %u\n", area, size);
140 INIT_LIST_HEAD(&area->list);137 INIT_LIST_HEAD(&area->list);
141 area->size = size;138 area->size = size;
142 list_add(&area->list, &kcov_remote_areas);139 list_add(&area->list, &kcov_remote_areas);
@@ -366,7 +363,6 @@ static void kcov_remote_reset(struct kcov *kcov) · 223 unmodified lines
366 hash_for_each_safe(kcov_remote_map, bkt, tmp, remote, hnode) {363 hash_for_each_safe(kcov_remote_map, bkt, tmp, remote, hnode) {
367 if (remote->kcov != kcov)364 if (remote->kcov != kcov)
368 continue;365 continue;
369 kcov_debug("removing handle %llx\n", remote->handle);
370 hash_del(&remote->hnode);366 hash_del(&remote->hnode);
371 kfree(remote);367 kfree(remote);
372 }368 }
@@ -553,7 +549,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 180 unmodified lines
553 549
554 switch (cmd) {550 switch (cmd) {
555 case KCOV_INIT_TRACE:551 case KCOV_INIT_TRACE:
556 kcov_debug("KCOV_INIT_TRACE\n");
557 /*552 /*
558 * Enable kcov in trace mode and setup buffer size.553 * Enable kcov in trace mode and setup buffer size.
559 * Must happen before anything else.554 * Must happen before anything else.
@@ -572,7 +567,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 12 unmodified lines
572 kcov->mode = KCOV_MODE_INIT;567 kcov->mode = KCOV_MODE_INIT;
573 return 0;568 return 0;
574 case KCOV_ENABLE:569 case KCOV_ENABLE:
575 kcov_debug("KCOV_ENABLE\n");
576 /*570 /*
577 * Enable coverage for the current task.571 * Enable coverage for the current task.
578 * At this point user must have been enabled trace mode,572 * At this point user must have been enabled trace mode,
@@ -598,7 +592,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 19 unmodified lines
598 kcov_get(kcov);592 kcov_get(kcov);
599 return 0;593 return 0;
600 case KCOV_DISABLE:594 case KCOV_DISABLE:
601 kcov_debug("KCOV_DISABLE\n");
602 /* Disable coverage for the current task. */595 /* Disable coverage for the current task. */
603 unused = arg;596 unused = arg;
604 if (unused != 0 || current->kcov != kcov)597 if (unused != 0 || current->kcov != kcov)
@@ -610,7 +603,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 5 unmodified lines
610 kcov_put(kcov);603 kcov_put(kcov);
611 return 0;604 return 0;
612 case KCOV_REMOTE_ENABLE:605 case KCOV_REMOTE_ENABLE:
613 kcov_debug("KCOV_REMOTE_ENABLE\n");
614 if (kcov->mode != KCOV_MODE_INIT || !kcov->area)606 if (kcov->mode != KCOV_MODE_INIT || !kcov->area)
615 return -EINVAL;607 return -EINVAL;
616 t = current;608 t = current;
@@ -629,7 +621,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 12 unmodified lines
629 kcov->remote_size = remote_arg->area_size;621 kcov->remote_size = remote_arg->area_size;
630 spin_lock(&kcov_remote_lock);622 spin_lock(&kcov_remote_lock);
631 for (i = 0; i < remote_arg->num_handles; i++) {623 for (i = 0; i < remote_arg->num_handles; i++) {
632 kcov_debug("handle %llx\n", remote_arg->handles[i]);
633 if (!kcov_check_handle(remote_arg->handles[i],624 if (!kcov_check_handle(remote_arg->handles[i],
634 false, true, false)) {625 false, true, false)) {
635 spin_unlock(&kcov_remote_lock);626 spin_unlock(&kcov_remote_lock);
@@ -644,8 +635,6 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd, · 8 unmodified lines
644 }635 }
645 }636 }
646 if (remote_arg->common_handle) {637 if (remote_arg->common_handle) {
647 kcov_debug("common handle %llx\n",
648 remote_arg->common_handle);
649 if (!kcov_check_handle(remote_arg->common_handle,638 if (!kcov_check_handle(remote_arg->common_handle,
650 true, false, false)) {639 true, false, false)) {
651 spin_unlock(&kcov_remote_lock);640 spin_unlock(&kcov_remote_lock);
@@ -782,7 +771,6 @@ void kcov_remote_start(u64 handle) · 130 unmodified lines
782 spin_lock(&kcov_remote_lock);771 spin_lock(&kcov_remote_lock);
783 remote = kcov_remote_find(handle);772 remote = kcov_remote_find(handle);
784 if (!remote) {773 if (!remote) {
785 kcov_debug("no remote found");
786 spin_unlock(&kcov_remote_lock);774 spin_unlock(&kcov_remote_lock);
787 return;775 return;
788 }776 }
@@ -810,8 +798,6 @@ void kcov_remote_start(u64 handle) · 21 unmodified lines
810 /* Reset coverage size. */798 /* Reset coverage size. */
811 *(u64 *)area = 0;799 *(u64 *)area = 0;
812 800
813 kcov_debug("area = %px, size = %u", area, size);
814
815 kcov_start(t, size, area, mode, sequence);801 kcov_start(t, size, area, mode, sequence);
816 802
817}803}
@@ -881,10 +867,8 @@ void kcov_remote_stop(void) · 63 unmodified lines
881 unsigned int size = t->kcov_size;867 unsigned int size = t->kcov_size;
882 int sequence = t->kcov_sequence;868 int sequence = t->kcov_sequence;
883 869
884 if (!kcov) {870 if (!kcov)
885 kcov_debug("no kcov found\n");
886 return;871 return;
887 }
888 872
889 kcov_stop(t);873 kcov_stop(t);
890 t->kcov = NULL;874 t->kcov = NULL;
@@ -894,8 +878,6 @@ void kcov_remote_stop(void) · 3 unmodified lines
894 * KCOV_DISABLE could have been called between kcov_remote_start()878 * KCOV_DISABLE could have been called between kcov_remote_start()
895 * and kcov_remote_stop(), hence the check.879 * and kcov_remote_stop(), hence the check.
896 */880 */
897 kcov_debug("move if: %d == %d && %d\n",
898 sequence, kcov->sequence, (int)kcov->remote);
899 if (sequence == kcov->sequence && kcov->remote)881 if (sequence == kcov->sequence && kcov->remote)
900 kcov_move_area(kcov->mode, kcov->area, kcov->size, area);882 kcov_move_area(kcov->mode, kcov->area, kcov->size, area);
901 spin_unlock(&kcov->lock);883 spin_unlock(&kcov->lock);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t