Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1932861imu; Fri, 23 Nov 2018 02:16:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8J2J+JrGQpPsxFqTnTBdC0y28o2D3yyPYFuZGYSKRzVbUhjwyzdNOeGTB4nkSS+9xuQYy X-Received: by 2002:a63:6445:: with SMTP id y66mr13851845pgb.250.1542968188372; Fri, 23 Nov 2018 02:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542968188; cv=none; d=google.com; s=arc-20160816; b=WA3IyCWij3ZWmkgQF9DkgV67C5Jf9hIOsxcumvSjcQciHeXme4T+xQZrjt46YTqN3I miodCg7M0qbPKc0IiAuCWVh+e/iZsdJX6HrZIUmM/xZraq5pDkl3fRze5z+cXL79Cvu8 5OmkEe7TvGNBRX5TGeSjUjZ/r5pSJA+0KiIkwRfSA9Je7KUM1hLffh/Il55ElvRHPwDQ GW5gzO+NYYKu6liDATtNf3BRg4fXvLf3s+wWNLhVnjrJMRwGAw4Y7AGyl1uKL5b8CqDL 21qiJ7SaGXWwZ4G7swz9aXxN7HOW+HGyKBsRn5Fef3LA9JRQgo4z40sqsgv5L/LHdCeF TbXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=bgxk1w91TI4FDProyoF/54nLdBJe4VIL4SEcRJnf6Zg=; b=Mz63qjHm869LX2UCwDgkm8BfgcCJn8aquN2TeokmvbH7DiGaOx4OvXjIskUksq/z30 EjAAzf3aqn4Jb2I3Y7kOLCiPnphSwxXuCh377fcIyqoPAV5Bd1PqjU19qtQQ+xqSOc1P aJa4aa7193esl547//XCCucA9S5DWljiJsgToDxmz0yuSh07ps/vnSrpEG10ozk32a0A 1wCq98LaHRHhk33Sf2ZxHglg7E4UapJUTlDz0asOuFNmZMWw7J/qJoBjINkCBCPRdLHq 59uEBgNzPAp2g9O8ZrBjY1gRNOyKaddrpEyTGiwhwYB6QfL5206a9mN/91FAiAvqIhcx YnCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j187si9346325pfg.160.2018.11.23.02.16.12; Fri, 23 Nov 2018 02:16:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393954AbeKVUvO (ORCPT + 99 others); Thu, 22 Nov 2018 15:51:14 -0500 Received: from terminus.zytor.com ([198.137.202.136]:42787 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387936AbeKVUvN (ORCPT ); Thu, 22 Nov 2018 15:51:13 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wAMAB3RA3743779 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Nov 2018 02:11:04 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wAMAB3cx3743776; Thu, 22 Nov 2018 02:11:03 -0800 Date: Thu, 22 Nov 2018 02:11:03 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andy Lutomirski Message-ID: Cc: tglx@linutronix.de, luto@kernel.org, peterz@infradead.org, riel@surriel.com, dave.hansen@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, yu-cheng.yu@intel.com, torvalds@linux-foundation.org, mingo@kernel.org, bp@alien8.de Reply-To: yu-cheng.yu@intel.com, torvalds@linux-foundation.org, mingo@kernel.org, bp@alien8.de, tglx@linutronix.de, luto@kernel.org, peterz@infradead.org, dave.hansen@linux.intel.com, riel@surriel.com, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <4e36812b6e1e95236a812021d35cbf22746b5af6.1542841400.git.luto@kernel.org> References: <4e36812b6e1e95236a812021d35cbf22746b5af6.1542841400.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/oops: Show the correct CS value in show_regs() Git-Commit-ID: d38bc89c72e7235ac889ae64fe7828e2e61a18af X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d38bc89c72e7235ac889ae64fe7828e2e61a18af Gitweb: https://git.kernel.org/tip/d38bc89c72e7235ac889ae64fe7828e2e61a18af Author: Andy Lutomirski AuthorDate: Wed, 21 Nov 2018 15:11:24 -0800 Committer: Ingo Molnar CommitDate: Thu, 22 Nov 2018 09:23:01 +0100 x86/oops: Show the correct CS value in show_regs() show_regs() shows the CS in the CPU register instead of the value in regs. This means that we'll probably print "CS: 0010" almost all the time regardless of what was actually in CS when the kernel malfunctioned. This gives a particularly confusing result if we OOPSed due to an implicit supervisor access from user mode. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/4e36812b6e1e95236a812021d35cbf22746b5af6.1542841400.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/process_64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 0e0b4288a4b2..2b8e6324fa20 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -66,7 +66,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode) unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned long d0, d1, d2, d3, d6, d7; unsigned int fsindex, gsindex; - unsigned int ds, cs, es; + unsigned int ds, es; show_iret_regs(regs); @@ -98,7 +98,6 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode) } asm("movl %%ds,%0" : "=r" (ds)); - asm("movl %%cs,%0" : "=r" (cs)); asm("movl %%es,%0" : "=r" (es)); asm("movl %%fs,%0" : "=r" (fsindex)); asm("movl %%gs,%0" : "=r" (gsindex)); @@ -114,7 +113,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode) printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", fs, fsindex, gs, gsindex, shadowgs); - printk(KERN_DEFAULT "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, + printk(KERN_DEFAULT "CS: %04lx DS: %04x ES: %04x CR0: %016lx\n", regs->cs, ds, es, cr0); printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);