Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp579817img; Fri, 22 Mar 2019 04:27:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtmwf69KQiueJgJeiNakVRGGLWLMkdLgGwN8W/wQItFBDaKSrDRajWC+JUfN82/5SDCjrr X-Received: by 2002:a65:4542:: with SMTP id x2mr8293709pgr.65.1553254067499; Fri, 22 Mar 2019 04:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553254067; cv=none; d=google.com; s=arc-20160816; b=uA4OVd4It//f5nht/DP1eeIa/3RjIdi1UGamM7MFNW6QVb7xFlxwzodWIoNlO/EpBk vFUEaAi5agBEOBd+I8iR8MOxUorpwdEApLmaePvQD+RNbYlLgW/79rgj1w1Hl0ZXNfRs jbLWEQ5GOhKl7rtAIjLNq3yeUJ1/eAeAQQ/g3cA3ks3GJmrTqO4Cl2F9OKyKLeXnN/L3 3CtgcWh8WGD3lBDdoIDlGH8+ouY3RsiJOs4dCUOelqDFO+MUkFDxIQ3V7L5Jm8LLOf6b gZGD4bGDGRfn7vczpRiYULMsK0/tLjLI2f2SWi9YA6eq+sa/YReg5QohugTQBWD7SzkJ Kueg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AJBGFdb9pd3d2XbTH/rz0vDu5HJXEoSGK4SXrMlxuq0=; b=PE4AHGuLmz9p5C86065zYlq0x0cppAi/8K7ibiIX2EyTIfJClUZSn7YhmHbrvzS9ca OAY4FS07fLPjttb6n+oPMdAaPv5W4pFsM27jGp9fHXu8uoEKlzWLoW9Ppk9quBuy7ehM 5m0CgYtIjmllllKULISic1koXX2trh3ju1DgzrMKNBOfW4KZbFI6ryzyacyTV96rp00H 2cTqDsOlBU3d2mV+YCvFZgvY7GAk3Pol+xc4ncAHSaO2OVY4WAorFwAIwG1MPDq6m6lX 8lmnkge+pn66Xs9mDz9/5qN6bDhI+Cbo/ZhMYAlHW7SkvJMhw1vYltcaIOym9gNTka4b caHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IFU0DQW4; 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 s14si6354643pgs.98.2019.03.22.04.27.32; Fri, 22 Mar 2019 04:27:47 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=IFU0DQW4; 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 S1729375AbfCVL0E (ORCPT + 99 others); Fri, 22 Mar 2019 07:26:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728745AbfCVL0C (ORCPT ); Fri, 22 Mar 2019 07:26:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E33AA20657; Fri, 22 Mar 2019 11:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253961; bh=CuiZyeM3+zr2KQxNmILH/Tk7Osv5QFLMxuTH/Esu92s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFU0DQW4ZuF5nfmOeKwTmOUK+Z2gbPi4EIPkCSN7IJ2oPWKvZclRvquYy2fbQmwb7 jmhHm3bfYtPOweY8Jxff7jk+dswcntgtQ3k3KHkNPUcIym6lX3+Slikl8uFuGVC56V 7UzNQ4BI4NUoQmR1uvQmy7noKA47jbvkmhSezI2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 3.18 124/134] powerpc/32: Clear on-stack exception marker upon exception return Date: Fri, 22 Mar 2019 12:15:37 +0100 Message-Id: <20190322111219.412629332@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe Leroy commit 9580b71b5a7863c24a9bd18bcd2ad759b86b1eff upstream. Clear the on-stack STACK_FRAME_REGS_MARKER on exception exit in order to avoid confusing stacktrace like the one below. Call Trace: [c0e9dca0] [c01c42a0] print_address_description+0x64/0x2bc (unreliable) [c0e9dcd0] [c01c4684] kasan_report+0xfc/0x180 [c0e9dd10] [c0895130] memchr+0x24/0x74 [c0e9dd30] [c00a9e38] msg_print_text+0x124/0x574 [c0e9dde0] [c00ab710] console_unlock+0x114/0x4f8 [c0e9de40] [c00adc60] vprintk_emit+0x188/0x1c4 --- interrupt: c0e9df00 at 0x400f330 LR = init_stack+0x1f00/0x2000 [c0e9de80] [c00ae3c4] printk+0xa8/0xcc (unreliable) [c0e9df20] [c0c27e44] early_irq_init+0x38/0x108 [c0e9df50] [c0c15434] start_kernel+0x310/0x488 [c0e9dff0] [00003484] 0x3484 With this patch the trace becomes: Call Trace: [c0e9dca0] [c01c42c0] print_address_description+0x64/0x2bc (unreliable) [c0e9dcd0] [c01c46a4] kasan_report+0xfc/0x180 [c0e9dd10] [c0895150] memchr+0x24/0x74 [c0e9dd30] [c00a9e58] msg_print_text+0x124/0x574 [c0e9dde0] [c00ab730] console_unlock+0x114/0x4f8 [c0e9de40] [c00adc80] vprintk_emit+0x188/0x1c4 [c0e9de80] [c00ae3e4] printk+0xa8/0xcc [c0e9df20] [c0c27e44] early_irq_init+0x38/0x108 [c0e9df50] [c0c15434] start_kernel+0x310/0x488 [c0e9dff0] [00003484] 0x3484 Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/entry_32.S | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -757,6 +757,9 @@ fast_exception_return: mtcr r10 lwz r10,_LINK(r11) mtlr r10 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r11) REST_GPR(10, r11) mtspr SPRN_SRR1,r9 mtspr SPRN_SRR0,r12 @@ -987,6 +990,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE mtcrf 0xFF,r10 mtlr r11 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r1) /* * Once we put values in SRR0 and SRR1, we are in a state * where exceptions are not recoverable, since taking an @@ -1024,6 +1030,9 @@ exc_exit_restart_end: mtlr r11 lwz r10,_CCR(r1) mtcrf 0xff,r10 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r1) REST_2GPRS(9, r1) .globl exc_exit_restart exc_exit_restart: