Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp355842yba; Fri, 12 Apr 2019 05:07:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiDw2512Zd83GxsB+gytUG1b4mkw14Ma5/Jay2t0UYfgSm0RkTI27MT+AAcMjBE5rQ0o8x X-Received: by 2002:a17:902:784d:: with SMTP id e13mr57504977pln.152.1555070853990; Fri, 12 Apr 2019 05:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555070853; cv=none; d=google.com; s=arc-20160816; b=u1Xn9cVVzt+e3l+xnEq2D+HtgCoBb1xw7mjwWDz7fH5fWyxeXfhSBmEdUtFCYxrIEj EH14wxSmkuq3lib+oz1QmyZtw3+eFESOjyJgea9Ar+bzejsv6/bQl9Wu6vGuziaNT2DL 2bPUltCLNXBCDRbTPaQUOXnMMj98yFOUJvXJTroAfCeT9SQSBEEquWSw0WYM3KMZ7WHF Ms70Sc0C9yk/n72pY9sIuBNfsc5xq+CT3a8W/yHiIO8RCBcWl/3gOWuXeqhb00i3vMlS b0YJl+0RWY8Z06idNWym/7Yk99QNuU7fH96aYppJ4NaHNVR5tZWzLQFZGoPnMah+j/NT ZN6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=KNGY37LWL5SvhTLGEfLzIGaMJs3IGl9FeWnCZ0esy38=; b=eiw3nvA0XeNpboBxVOTSUrmvLShXMBBOwx/LDw5rK/anZ7TuxqDWYWJE4+v1CjqVk5 sY989m8EmGcj4wz5+cJNyZh+2BWBlEkl+r256tBDT2VnUImUkk7x2kl/8ZnW2EWO1f76 Ve4VwGr7sOU5Dd4hfyfDfE/Bc1RutYWS9K8AeDJA4eQ9j1DtJKqMFYwcq+YlGhEtm0mK fEnpSG+cBxR9xKFxX3WwMVdQD/Rx71oRGFNS6mQpGSRw9Noc3s0HH29hmVMrnFdhO8lg z1lw5aVptHq02TH0wfQ8f23HmcPr0/barBfXUEwAeJJwfnIVu2rcwKQ8ffIT6L5z6ITv ThNw== 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 cm17si40063295plb.139.2019.04.12.05.07.18; Fri, 12 Apr 2019 05:07:33 -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; 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 S1727737AbfDLMGk (ORCPT + 99 others); Fri, 12 Apr 2019 08:06:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6173 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727110AbfDLMGf (ORCPT ); Fri, 12 Apr 2019 08:06:35 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1927465C30D0C7DA98B0; Fri, 12 Apr 2019 20:06:30 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 20:06:21 +0800 From: Xiongfeng Wang To: , , , , CC: , Subject: [RFC PATCH 3/3] stop_machine: mask sdei before running the callback Date: Fri, 12 Apr 2019 20:04:59 +0800 Message-ID: <1555070699-3685-4-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1555070699-3685-1-git-send-email-wangxiongfeng2@huawei.com> References: <1555070699-3685-1-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kprobes use 'stop_machine' to modify code which could be run in the sdei event handler at the same time. This patch mask sdei before running the stop_machine callback to avoid this race condition. Signed-off-by: Xiongfeng Wang --- kernel/stop_machine.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 067cb83..7b95632 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -22,6 +22,9 @@ #include #include #include +#ifdef CONFIG_ARM64 +#include +#endif /* * Structure to determine completion condition and record errors. May @@ -208,6 +211,9 @@ static int multi_cpu_stop(void *data) case MULTI_STOP_DISABLE_IRQ: local_irq_disable(); hard_irq_disable(); +#ifdef CONFIG_ARM64 + sdei_mask_local_cpu(); +#endif break; case MULTI_STOP_RUN: if (is_active) @@ -227,6 +233,9 @@ static int multi_cpu_stop(void *data) } } while (curstate != MULTI_STOP_EXIT); +#ifdef CONFIG_ARM64 + sdei_unmask_local_cpu(); +#endif local_irq_restore(flags); return err; } -- 1.7.12.4