mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] kcov: improve mmap processing
@ 2021-12-21 17:03 Aleksandr Nogikh
  2021-12-21 17:03 ` [PATCH v2 1/2] kcov: split ioctl handling into locked and unlocked parts Aleksandr Nogikh
  2021-12-21 17:03 ` [PATCH v2 2/2] kcov: properly handle subsequent mmap calls Aleksandr Nogikh
  0 siblings, 2 replies; 5+ messages in thread
From: Aleksandr Nogikh @ 2021-12-21 17:03 UTC (permalink / raw)
  To: kasan-dev, linux-kernel, akpm
  Cc: dvyukov, andreyknvl, elver, glider, tarasmadan, bigeasy, nogikh

Subsequent mmaps of the same kcov descriptor currently do not update the
virtual memory of the task and yet return 0 (success). This is
counter-intuitive and may lead to unexpected memory access errors.

Also, this unnecessarily limits the functionality of kcov to only the
simplest usage scenarios. Kcov instances are effectively forever attached
to their first address spaces and it becomes impossible to e.g. reuse the
same kcov handle in forked child processes without mmapping the memory
first. This is exactly what we tried to do in syzkaller and
inadvertently came upon this behavior.

This patch series addresses the problem described above.

v1 of the patch:
https://lore.kernel.org/lkml/20211220152153.910990-1-nogikh@google.com/

Changes from v1:
- Split into 2 commits.
- Minor coding style changes.

Aleksandr Nogikh (2):
  kcov: split ioctl handling into locked and unlocked parts
  kcov: properly handle subsequent mmap calls

 kernel/kcov.c | 99 +++++++++++++++++++++++++++++----------------------
 1 file changed, 57 insertions(+), 42 deletions(-)

-- 
2.34.1.307.g9b7440fafd-goog


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

end of thread, other threads:[~2021-12-22 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 17:03 [PATCH v2 0/2] kcov: improve mmap processing Aleksandr Nogikh
2021-12-21 17:03 ` [PATCH v2 1/2] kcov: split ioctl handling into locked and unlocked parts Aleksandr Nogikh
2021-12-21 20:19   ` Marco Elver
2021-12-22 12:28     ` Aleksandr Nogikh
2021-12-21 17:03 ` [PATCH v2 2/2] kcov: properly handle subsequent mmap calls Aleksandr Nogikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®