mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: mingo@kernel.org
Cc: sds@tycho.nsa.gov, logang@deltatee.com, keescook@chromium.org,
	tglx@linutronix.de, luto@kernel.org, peterz@infradead.org,
	hpa@zytor.com, torvalds@linux-foundation.org, bp@alien8.de,
	linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com,
	brgerst@gmail.com, dvlasenk@redhat.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/power/64: Avoid memory corruption in 64-bit swsusp_arch_resume()
Date: Sat, 18 Jun 2016 01:33:47 +0200	[thread overview]
Message-ID: <2755592.YNNOVbNgS2@vostro.rjw.lan> (raw)
In-Reply-To: <tip-70595b479ce173425dd5cb347dc6c8b1060dfb2c@git.kernel.org>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.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;

  reply	other threads:[~2016-06-17 23:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 13:42 [PATCH] x86 / hibernate: Fix 64-bit code passing control to image kernel Rafael J. Wysocki
2016-06-13 21:58 ` Kees Cook
2016-06-13 22:15   ` Rafael J. Wysocki
2016-06-13 22:53     ` Kees Cook
2016-06-14  1:37       ` Rafael J. Wysocki
2016-06-14 11:31 ` [tip:x86/boot] x86/power/64: Fix crash whan the hibernation code passes control to the " tip-bot for Rafael J. Wysocki
2016-06-17 23:33   ` Rafael J. Wysocki [this message]
2016-06-14 12:06 ` [PATCH] x86 / hibernate: Fix 64-bit code passing control to " chenyu
2016-06-14 22:45   ` Rafael J. Wysocki
2016-06-18 18:09 ` [tip:x86/urgent] x86/power/64: Fix crash whan the hibernation code passes control to the " tip-bot for Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2755592.YNNOVbNgS2@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sds@tycho.nsa.gov \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®