Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1910293imm; Thu, 24 May 2018 02:46:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrr3fQZc3mx5KVoXgSjbgAM47w8CVaDFweEugWllE665q7vNpOlJ+aolqBZr8XN+/wjB2vX X-Received: by 2002:a63:62c7:: with SMTP id w190-v6mr5066426pgb.104.1527155204347; Thu, 24 May 2018 02:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155204; cv=none; d=google.com; s=arc-20160816; b=o8d3AoO2dBvZr6/jltZgjSZHfUGlFMEzFDxwychtitJ7rAuhf1xXaiVYLbJjtT73nn 1nojradEctEXz+KMHyzPsqjJKFxPz3ZynutzFpHuAxHp4nvNUSUOQVuycFzrjmM2n25V VP9SNETry2rWd5GESr9FKr6GyubTzJEkYTvzXUeP4EMUzw0YOyYXyqSl7Bi4fnJMpjXP Zear3DtLJpymLZQwUO8CJCZmIUwoMJIXr9dJ2M/HP0qFGr1ywAVtycmGjlHO+2U9daWR qxRVzBD0SYGpm5+3RzU4cSg9mZ2HYYJyQ6zDiiqhlMHVrvSPgUV9+sWLzCfWp3lo+mmn qrHA== 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=MQMFTeYzzt5bzRdmnbM0jHD4rWzuSQSYLlLTzI7ZI94=; b=bsayXS8Bzsu4VXu1CMHyvCB+iAn5fwsVqY0UD8aMxakx7o1EBsUy5sGQwmn9wPRhXX caumPtk8bbTBWhHx6/Abi6vsS1ePuNIfbmI6P946wE0iDU51luP/lOpOi9rK5j5NSNXr V6dp5rcFGholqQgkkpr7qvzdtZRphsA+feHOz3aQNx30rRXLTWaTExqfaRmaKVnr5kVG Fk+DkZfTWTTzjzvMc8eFknIRY3VlXI1LSl1o1DkGXC13fEFVc28dzQkpv2tRaly7ZXuF TaOoJr4w8Ye77qbvQ+i8hz5Z/KskytqWKwh1+qNvxJAjihs3S6VEvCebH9qyBSFkVA6y vgxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M2mJC6ia; 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 l125-v6si10129300pgl.410.2018.05.24.02.46.29; Thu, 24 May 2018 02:46:44 -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=M2mJC6ia; 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 S966810AbeEXJpf (ORCPT + 99 others); Thu, 24 May 2018 05:45:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:56658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966782AbeEXJp3 (ORCPT ); Thu, 24 May 2018 05:45:29 -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 5147620897; Thu, 24 May 2018 09:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155128; bh=LT4DtLC3Tvmjcq4MYt/7hBU/50rjY9279BrM58OqXco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M2mJC6ia/gaH8dT34gub/YhEKKZLRqkFSgPXfgxZ7tYpEQibXw/+hmr/jOgISqvBx dWUyRALMWCRrHt7oTpNRRUhsuDTrn1DEPi5jw/rcMyNVZJiKZrwivE2246O0xFo3Gf iDFNFufPf+RNsyngTH+vXK2yYwpYF4189GL6xol0= 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.4 65/92] ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabed Date: Thu, 24 May 2018 11:38:42 +0200 Message-Id: <20180524093205.539658174@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@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.4-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);