Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp801030imm; Mon, 21 May 2018 14:44:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr01to184a1UqzdGfLkG5uk3hFeTwbMPZhpM+vygaYC+ae0JOx1p1QodvzfoxMwzuVe3p2b X-Received: by 2002:a17:902:7241:: with SMTP id c1-v6mr22143182pll.217.1526939060085; Mon, 21 May 2018 14:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526939060; cv=none; d=google.com; s=arc-20160816; b=tzO0RXEIwx36LF1OJ0nuZcLTeqWltNEkngytG7uj4eQ8RzltXaeBKgLKQzDYgkavlQ xAl6bzThdWCcObdFzsJqlEUjtOokc6M/ka+kR+hhdZfExrVOnU6m+Uc8hPwTNrAa6JbH oP9he6gfYeAkyfdQ0S49aJK8vAmvioMaIbj5c0o1RFtZU10tAaolKQoFcRRevnUIInQm Y9iSOXafvB/2HfPo0GkvlwavNMLrZylc47XZ9/wFqmyH1rHeWqDAg3+gxAPMlF0a4K5P jDHZGSzxIBgGEVDj70LRTcnok20AYfudZ2FTm2suIRVGLUdRuclb3NCOTCSfj4drapJ1 j/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ETpoNsgvwBduGcwHXXBAbt6KijzqcY4Y2fc9KVJGo0Y=; b=y+5bCl7Sdwdy/vuhPK401ielONcojveiZBebHIQAmm23Cli0Lj9ItyE/eM0W0T7YyB f9ejhh/fJDpOsby4cCzYnjEjlnOuh/gvsMdZMrcVszki4tSKmFaUKDoe1u2RKeOMCvLA SCvWYTZSPQN/18cxv5NiBqP4eOuDiHRnBWSBHX3d140Nx7miwRS2xGWv2SW6J3r/jE7y N49bBo4RDc5FyDpAHHNiNGvmwYjJ+HQHQmIwYdFRKGAx7aKFCE3UOfp4B/0352fse/8Y hHjFhU6Agj20rczRWSGq0pGWHjC+W0lmvoQUMKP23UBJgO6jxUq3JoI4mKO6a5fmGpZN zt4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KZmqSbsm; 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 z23-v6si15304900plo.492.2018.05.21.14.44.05; Mon, 21 May 2018 14:44:20 -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=KZmqSbsm; 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 S1754638AbeEUVm7 (ORCPT + 99 others); Mon, 21 May 2018 17:42:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932238AbeEUVYV (ORCPT ); Mon, 21 May 2018 17:24:21 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 123A120872; Mon, 21 May 2018 21:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937860; bh=wlPMzM/zaYxKW5CoPx2chleYa8dbYOQmKZb3IopjQLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZmqSbsmeVYhTsagdUuGgaOuWbQvWOnqTEpXDgZan3WzmiaG9qpR1wukNSFbHbd74 cy9sNm4zacyQK+VxvOatyYyIM92w7VzgVXIUBJs1VqRj+Aua+Mil31uEhPZZQWDrSI 6S8lzsyVkddk09J/hFtG7jyaWAQCcyDYAKj4zxdg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Russell King Subject: [PATCH 4.16 052/110] ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabed Date: Mon, 21 May 2018 23:11:49 +0200 Message-Id: <20180521210509.886524459@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu commit 69af7e23a6870df2ea6fa79ca16493d59b3eebeb upstream. Since get_kprobe_ctlblk() uses smp_processor_id() to access per-cpu variable, it hits smp_processor_id sanity check as below. [ 7.006928] BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1 [ 7.007859] caller is debug_smp_processor_id+0x20/0x24 [ 7.008438] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.16.0-rc1-00192-g4eb17253e4b5 #1 [ 7.008890] Hardware name: Generic DT based system [ 7.009917] [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [ 7.010473] [] (show_stack) from [] (dump_stack+0x84/0x98) [ 7.010990] [] (dump_stack) from [] (check_preemption_disabled+0x138/0x13c) [ 7.011592] [] (check_preemption_disabled) from [] (debug_smp_processor_id+0x20/0x24) [ 7.012214] [] (debug_smp_processor_id) from [] (optimized_callback+0x2c/0xe4) [ 7.013077] [] (optimized_callback) from [] (0xbf0021b0) To fix this issue, call get_kprobe_ctlblk() right after irq-disabled since that disables preemption. Fixes: 0dc016dbd820 ("ARM: kprobes: enable OPTPROBES for ARM 32") Signed-off-by: Masami Hiramatsu Cc: stable@vger.kernel.org Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/probes/kprobes/opt-arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/arm/probes/kprobes/opt-arm.c +++ b/arch/arm/probes/kprobes/opt-arm.c @@ -165,13 +165,14 @@ optimized_callback(struct optimized_kpro { unsigned long flags; struct kprobe *p = &op->kp; - struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); + struct kprobe_ctlblk *kcb; /* Save skipped registers */ regs->ARM_pc = (unsigned long)op->kp.addr; regs->ARM_ORIG_r0 = ~0UL; local_irq_save(flags); + kcb = get_kprobe_ctlblk(); if (kprobe_running()) { kprobes_inc_nmissed_count(&op->kp);