The patch titled Subject: kcov: make kcov work properly with KASLR enabled has been added to the -mm tree. Its filename is kcov-make-kcov-work-properly-with-kaslr-enabled.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kcov-make-kcov-work-properly-with-kaslr-enabled.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kcov-make-kcov-work-properly-with-kaslr-enabled.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Alexander Popov <alex.popov@xxxxxxxxx> Subject: kcov: make kcov work properly with KASLR enabled Subtract KASLR offset from the kernel addresses reported by kcov. Tested on x86_64 and AArch64 (Hikey LeMaker). Link: http://lkml.kernel.org/r/1481417456-28826-3-git-send-email-alex.popov@xxxxxxxxx Signed-off-by: Alexander Popov <alex.popov@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Rob Herring <robh@xxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx> Cc: Jon Masters <jcm@xxxxxxxxxx> Cc: David Daney <david.daney@xxxxxxxxxx> Cc: Ganapatrao Kulkarni <gkulkarni@xxxxxxxxxxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Nicolai Stange <nicstange@xxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Alexander Popov <alex.popov@xxxxxxxxx> Cc: syzkaller <syzkaller@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/kcov.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff -puN kernel/kcov.c~kcov-make-kcov-work-properly-with-kaslr-enabled kernel/kcov.c --- a/kernel/kcov.c~kcov-make-kcov-work-properly-with-kaslr-enabled +++ a/kernel/kcov.c @@ -14,6 +14,7 @@ #include <linux/debugfs.h> #include <linux/uaccess.h> #include <linux/kcov.h> +#include <asm/setup.h> /* * kcov descriptor (one per opened debugfs file). @@ -68,6 +69,11 @@ void notrace __sanitizer_cov_trace_pc(vo if (mode == KCOV_MODE_TRACE) { unsigned long *area; unsigned long pos; + unsigned long ip = _RET_IP_; + +#ifdef CONFIG_RANDOMIZE_BASE + ip -= kaslr_offset(); +#endif /* * There is some code that runs in interrupts but for which @@ -81,7 +87,7 @@ void notrace __sanitizer_cov_trace_pc(vo /* The first word is number of subsequent PCs. */ pos = READ_ONCE(area[0]) + 1; if (likely(pos < t->kcov_size)) { - area[pos] = _RET_IP_; + area[pos] = ip; WRITE_ONCE(area[0], pos); } } _ Patches currently in -mm which might be from alex.popov@xxxxxxxxx are arm64-setup-introduce-kaslr_offset.patch kcov-make-kcov-work-properly-with-kaslr-enabled.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html