Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbbBMFuR (ORCPT ); Fri, 13 Feb 2015 00:50:17 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:23218 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbbBMFtM (ORCPT ); Fri, 13 Feb 2015 00:49:12 -0500 From: Wang Nan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [RFC PATCH v3 11/26] early kprobes: introduce kprobe_is_early for futher early kprobe use. Date: Fri, 13 Feb 2015 13:40:44 +0800 Message-ID: <1423806044-61946-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1423805941-61407-1-git-send-email-wangnan0@huawei.com> References: <1423805941-61407-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.54DD8FF6.0162,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c3644e90eb7ffb7358733eca03038f7a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1358 Lines: 48 Following early kprobe patches will enable kprobe registering very early, even before kprobe system initialized. kprobe_is_early() can be used to check whether we are working on early kprobe. Signed-off-by: Wang Nan --- include/linux/kprobes.h | 2 ++ kernel/kprobes.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 1ab5475..e1c8307 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -50,6 +50,8 @@ #define KPROBE_REENTER 0x00000004 #define KPROBE_HIT_SSDONE 0x00000008 +extern int kprobes_is_early(void); + #else /* CONFIG_KPROBES */ typedef int kprobe_opcode_t; struct arch_specific_insn { diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c90e417..647c95a 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -68,6 +68,12 @@ #endif static int kprobes_initialized; + +int kprobes_is_early(void) +{ + return !kprobes_initialized; +} + static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE]; static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE]; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/