From patchwork Fri Jun 17 23:33:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9185165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 392E46075F for ; Fri, 17 Jun 2016 23:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B20627BE5 for ; Fri, 17 Jun 2016 23:29:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C295282EE; Fri, 17 Jun 2016 23:29:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00,FSL_HELO_HOME, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB56B27BE5 for ; Fri, 17 Jun 2016 23:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbcFQX3f (ORCPT ); Fri, 17 Jun 2016 19:29:35 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:61900 "HELO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751690AbcFQX3f (ORCPT ); Fri, 17 Jun 2016 19:29:35 -0400 Received: from 217.96.253.76.ipv4.supernova.orange.pl (217.96.253.76) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80.2) id cc5ae28818b9b16b; Sat, 18 Jun 2016 01:29:33 +0200 From: "Rafael J. Wysocki" 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 Message-ID: <2755592.YNNOVbNgS2@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <3006711.q9ei2E2zzf@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki 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 --- Commit 70595b479ce1 is in tip and linux-next now. --- arch/x86/power/hibernate_64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;