From patchwork Thu Apr 6 13:52:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96985 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp740917obc; Thu, 6 Apr 2017 06:52:46 -0700 (PDT) X-Received: by 10.84.168.69 with SMTP id e63mr43509397plb.124.1491486766380; Thu, 06 Apr 2017 06:52:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si1933861plk.173.2017.04.06.06.52.46; Thu, 06 Apr 2017 06:52:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934838AbdDFNwk (ORCPT + 6 others); Thu, 6 Apr 2017 09:52:40 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:35324 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934806AbdDFNwa (ORCPT ); Thu, 6 Apr 2017 09:52:30 -0400 Received: by mail-pg0-f47.google.com with SMTP id 81so37118165pgh.2 for ; Thu, 06 Apr 2017 06:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6yT+JYRa9QZ7UM+rLY8vnkaCFnyuMqFyDqEHLZkTyXE=; b=Bfn6Skq6rxSeTj2hAkZ1SHqwRiZYMfJv/EZzgmyIBgk/hHz16w5aCvhy4lUFPvoI8N BcIxZ7yol6WqiyQsJJLvEQ/KOcRfLs9MSThu8+BRdW9o5VX3G01xjdxEvH3In+rryWBa BUyfHTpeoBzv9GMxUiVfXaogGlZfxKavA5g+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6yT+JYRa9QZ7UM+rLY8vnkaCFnyuMqFyDqEHLZkTyXE=; b=BxcUa6sneuq+yKV/S3PRVAF+qEUVQhJRKhAr7JZvrdqu6IiRhxfWBpM6mM/OJFUhFe DY5ogML1k9XyGyNlZUR1vg7Z+dVqLXQ8dAwGd60QotvuEuCaKcTg+dmwAqhNgOoWqUZ1 mj/sN8gjWRIXtMLW1/7SagOvxw3nTriUj5j7mcc1Eus9N495paE/sutfthgxeEwq6c6i i/cedRiiimbrGWsIKDtqvpUMImRVhBOIJL6nSKGQpUMx3TuU911bVKipi4Ywd1eMBOND THCcTnmWsPiiKGngAWUDO32Va9OZIZSie8BI0tA7n+uOxjTzMMJqmTtwY0MEpzozW8w/ Ebrg== X-Gm-Message-State: AFeK/H1PguquplKwL+OK8cTJ8LQqEn8vPOhG1ixrjdT1gHMiyNopaikHVNzWPKNndrV2Oyn6 X-Received: by 10.84.174.129 with SMTP id r1mr43837891plb.173.1491486749120; Thu, 06 Apr 2017 06:52:29 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id v11sm4187210pfi.50.2017.04.06.06.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 06:52:28 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Matt Redfearn , Thomas Gleixner , Adam Buchbinder , "Maciej W . Rozycki" , Marcin Nowakowski , Chris Metcalf , Paul Burton , Jiri Slaby , Andrew Morton , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Ralf Baechle Subject: [PATCH for-4.10 2/6] MIPS: Stack unwinding while on IRQ stack Date: Thu, 6 Apr 2017 19:22:10 +0530 Message-Id: <1491486734-15668-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491486734-15668-1-git-send-email-amit.pundir@linaro.org> References: <1491486734-15668-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matt Redfearn Within unwind stack, check if the stack pointer being unwound is within the CPU's irq_stack and if so use that page rather than the task's stack page. Signed-off-by: Matt Redfearn Acked-by: Jason A. Donenfeld Cc: Thomas Gleixner Cc: Adam Buchbinder Cc: Maciej W. Rozycki Cc: Marcin Nowakowski Cc: Chris Metcalf Cc: James Hogan Cc: Paul Burton Cc: Jiri Slaby Cc: Andrew Morton Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/14741/ Signed-off-by: Ralf Baechle (cherry picked from commit d42d8d106b0275b027c1e8992c42aecf933436ea) Signed-off-by: Amit Pundir --- arch/mips/kernel/process.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 7d80447..efa1df5 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -556,7 +557,19 @@ EXPORT_SYMBOL(unwind_stack_by_address); unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, unsigned long pc, unsigned long *ra) { - unsigned long stack_page = (unsigned long)task_stack_page(task); + unsigned long stack_page = 0; + int cpu; + + for_each_possible_cpu(cpu) { + if (on_irq_stack(cpu, *sp)) { + stack_page = (unsigned long)irq_stack[cpu]; + break; + } + } + + if (!stack_page) + stack_page = (unsigned long)task_stack_page(task); + return unwind_stack_by_address(stack_page, sp, pc, ra); } #endif