From patchwork Thu Jun 11 23:45:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 6593331 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 922739F2F4 for ; Thu, 11 Jun 2015 23:48:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A86FD203B1 for ; Thu, 11 Jun 2015 23:48:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95F69202E9 for ; Thu, 11 Jun 2015 23:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbbFKXsI (ORCPT ); Thu, 11 Jun 2015 19:48:08 -0400 Received: from mga01.intel.com ([192.55.52.88]:49828 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752390AbbFKXsE (ORCPT ); Thu, 11 Jun 2015 19:48:04 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 11 Jun 2015 16:48:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,598,1427785200"; d="scan'208";a="745255166" Received: from spandruv-desk3.jf.intel.com ([10.7.199.77]) by orsmga002.jf.intel.com with ESMTP; 11 Jun 2015 16:48:03 -0700 From: Srinivas Pandruvada To: mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, pavel@ucw.cz, rjw@rjwysocki.net Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH] x86: General protection fault after STR (32 bit systems only) Date: Thu, 11 Jun 2015 16:45:38 -0700 Message-Id: <1434066338-6619-1-git-send-email-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 1.9.3 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Suspend to RAM process is returning to userspsace with DS set to KERNEL_DS after resume, this cause general protection fault. This is very difficult to reproduce, but this does happen on 32 bit systems. This crash is not reproduced after save/restore DS during calls to _save_processor_state/ __restore_processor_state respectively. Similar issue was reported in the past https://bugzilla.kernel.org/show_bug.cgi?id=61781, for which the root cause was not identified. Signed-off-by: Srinivas Pandruvada Reviewed-by: Andi Kleen --- arch/x86/include/asm/suspend_32.h | 2 +- arch/x86/power/cpu.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/suspend_32.h b/arch/x86/include/asm/suspend_32.h index 552d6c9..3503d0b 100644 --- a/arch/x86/include/asm/suspend_32.h +++ b/arch/x86/include/asm/suspend_32.h @@ -11,7 +11,7 @@ /* image of the saved processor state */ struct saved_context { - u16 es, fs, gs, ss; + u16 ds, es, fs, gs, ss; unsigned long cr0, cr2, cr3, cr4; u64 misc_enable; bool misc_enable_saved; diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 757678f..e0dfb01 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c @@ -79,6 +79,7 @@ static void __save_processor_state(struct saved_context *ctxt) * segment registers */ #ifdef CONFIG_X86_32 + savesegment(ds, ctxt->ds); savesegment(es, ctxt->es); savesegment(fs, ctxt->fs); savesegment(gs, ctxt->gs); @@ -198,6 +199,7 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) * segment registers */ #ifdef CONFIG_X86_32 + loadsegment(ds, ctxt->ds); loadsegment(es, ctxt->es); loadsegment(fs, ctxt->fs); loadsegment(gs, ctxt->gs);