All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kcov: fix unexpected faults
@ 2018-05-04 13:55 Mark Rutland
  2018-05-04 13:55 ` [PATCH 1/3] kcov: ensure irq code sees a valid area Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mark Rutland @ 2018-05-04 13:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, aryabinin, dvyukov, mark.rutland, mingo, peterz

Hi,

These patches fix a few issues where KCOV code could trigger recursive
faults, discovered while debugging a patch enabling KCOV for arch/arm:

* On CONFIG_PREEMPT kernels, there's a small race window where
  __sanitizer_cov_trace_pc() can see a bogus kcov_area.

* Lazy faulting of the vmalloc area can cause mutual recursion between
  fault handling code and __sanitizer_cov_trace_pc().

* During the context switch, switching the mm can cause the kcov_area to
  be transiently unmapped.

These are prerequisites for enabling KCOV on arm, but the issues
themsevles are generic -- we just happen to avoid them by chance rather
than design on x86-64 and arm64.

I've tested this on arm atop of v4.17-rc3, with KCOV enabled.

Thanks,
Mark.

Mark Rutland (3):
  kcov: ensure irq code sees a valid area
  kcov: prefault the kcov_area
  sched/core / kcov: avoid kcov_area during task switch

 include/linux/kcov.h  | 14 ++++++++++++++
 include/linux/sched.h |  2 +-
 kernel/kcov.c         | 17 +++++++++++++++--
 kernel/sched/core.c   |  4 ++++
 4 files changed, 34 insertions(+), 3 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-05-09  9:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 13:55 [PATCH 0/3] kcov: fix unexpected faults Mark Rutland
2018-05-04 13:55 ` [PATCH 1/3] kcov: ensure irq code sees a valid area Mark Rutland
2018-05-04 14:56   ` Mark Rutland
2018-05-04 13:55 ` [PATCH 2/3] kcov: prefault the kcov_area Mark Rutland
2018-05-04 14:36   ` Andrey Ryabinin
2018-05-04 14:38     ` Mark Rutland
2018-05-04 14:42       ` Andrey Ryabinin
2018-05-08 22:51   ` Andrew Morton
2018-05-09  9:41     ` Mark Rutland
2018-05-04 13:55 ` [PATCH 3/3] sched/core / kcov: avoid kcov_area during task switch Mark Rutland
2018-05-04 14:32   ` Andrey Ryabinin
2018-05-04 14:36     ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.