* [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c
@ 2016-06-02 12:20 James Morse
2016-06-14 23:26 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: James Morse @ 2016-06-02 12:20 UTC (permalink / raw)
To: linux-arm-kernel
Kasan causes the compiler to instrument C code and is used at runtime to
detect accesses to memory that has been freed, or not yet allocated.
The code in snapshot.c saves and restores memory when hibernating. This will
access whole pages in the slab cache that have both free and allocated
areas, resulting in a large number of false positives from Kasan.
Disable instrumentation of this file.
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
With this, I can hibernate/resume a kernel built with kasan on arm64.
kernel/power/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index cb880a14cc39..eb4f717705ba 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -1,6 +1,8 @@
ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG
+KASAN_SANITIZE_snapshot.o := n
+
obj-y += qos.o
obj-$(CONFIG_PM) += main.o
obj-$(CONFIG_VT_CONSOLE_SLEEP) += console.o
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c
2016-06-02 12:20 [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c James Morse
@ 2016-06-14 23:26 ` Rafael J. Wysocki
2016-06-15 10:25 ` James Morse
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-06-14 23:26 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday, June 02, 2016 01:20:32 PM James Morse wrote:
> Kasan causes the compiler to instrument C code and is used at runtime to
> detect accesses to memory that has been freed, or not yet allocated.
>
> The code in snapshot.c saves and restores memory when hibernating. This will
> access whole pages in the slab cache that have both free and allocated
> areas, resulting in a large number of false positives from Kasan.
>
> Disable instrumentation of this file.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>
> ---
> With this, I can hibernate/resume a kernel built with kasan on arm64.
>
> kernel/power/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/power/Makefile b/kernel/power/Makefile
> index cb880a14cc39..eb4f717705ba 100644
> --- a/kernel/power/Makefile
> +++ b/kernel/power/Makefile
> @@ -1,6 +1,8 @@
>
> ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG
>
> +KASAN_SANITIZE_snapshot.o := n
> +
> obj-y += qos.o
> obj-$(CONFIG_PM) += main.o
> obj-$(CONFIG_VT_CONSOLE_SLEEP) += console.o
>
Applied, thanks!
Does the arch code need to be annotated in a similar way too?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c
2016-06-14 23:26 ` Rafael J. Wysocki
@ 2016-06-15 10:25 ` James Morse
2016-06-16 1:22 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: James Morse @ 2016-06-15 10:25 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rafael,
On 15/06/16 00:26, Rafael J. Wysocki wrote:
> Does the arch code need to be annotated in a similar way too?
Only if you do the restore copying from C, both 32bit and 64bit x86 do this copy
in assembly code, which doesn't get instrumented.
Thanks,
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c
2016-06-15 10:25 ` James Morse
@ 2016-06-16 1:22 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-06-16 1:22 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday, June 15, 2016 11:25:18 AM James Morse wrote:
> Hi Rafael,
>
> On 15/06/16 00:26, Rafael J. Wysocki wrote:
> > Does the arch code need to be annotated in a similar way too?
>
> Only if you do the restore copying from C, both 32bit and 64bit x86 do this copy
> in assembly code, which doesn't get instrumented.
OK, that's what I wanted to know.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-16 1:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-02 12:20 [PATCH] PM / Hibernate: Don't let kasan instrument snapshot.c James Morse
2016-06-14 23:26 ` Rafael J. Wysocki
2016-06-15 10:25 ` James Morse
2016-06-16 1:22 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).