[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2755592.YNNOVbNgS2@vostro.rjw.lan>
Date: Sat, 18 Jun 2016 01:33:47 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: mingo@...nel.org
Cc: sds@...ho.nsa.gov, logang@...tatee.com, keescook@...omium.org,
tglx@...utronix.de, luto@...nel.org, peterz@...radead.org,
hpa@...or.com, torvalds@...ux-foundation.org, bp@...en8.de,
linux-pm@...r.kernel.org, rafael.j.wysocki@...el.com,
brgerst@...il.com, dvlasenk@...hat.com,
linux-kernel@...r.kernel.org
Subject: [PATCH] x86/power/64: Avoid memory corruption in 64-bit swsusp_arch_resume()
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Commit 70595b479ce1 (x86/power/64: Fix crash whan the hibernation
code passes control to the image kernel) forgot to update the last
argument of memcpy() in swsusp_arch_resume() to reflect the other
changes made by it and that may lead to memory corruption if the
core_restore_code code happens to be located at the end of a page,
so fix it.
Fixes: 70595b479ce1 (x86/power/64: Fix crash whan the hibernation code passes control to the image kernel)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
Commit 70595b479ce1 is in tip and linux-next now.
---
arch/x86/power/hibernate_64.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: linux-pm/arch/x86/power/hibernate_64.c
===================================================================
--- linux-pm.orig/arch/x86/power/hibernate_64.c
+++ linux-pm/arch/x86/power/hibernate_64.c
@@ -142,8 +142,7 @@ int swsusp_arch_resume(void)
relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC);
if (!relocated_restore_code)
return -ENOMEM;
- memcpy(relocated_restore_code, &core_restore_code,
- &restore_registers - &core_restore_code);
+ memcpy(relocated_restore_code, &core_restore_code, PAGE_SIZE);
restore_image();
return 0;
Powered by blists - more mailing lists