From patchwork Wed Feb 24 00:54:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 8397681 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 44DD2C0553 for ; Wed, 24 Feb 2016 00:58:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C183202F0 for ; Wed, 24 Feb 2016 00:58:07 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 784112021A for ; Wed, 24 Feb 2016 00:58:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYNjP-0005Ur-EY; Wed, 24 Feb 2016 00:55:07 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYNjN-0005UY-EY for xen-devel@lists.xensource.com; Wed, 24 Feb 2016 00:55:05 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id 52/1B-10715-86FFCC65; Wed, 24 Feb 2016 00:55:04 +0000 X-Env-Sender: lurodriguez@suse.de X-Msg-Ref: server-12.tower-27.messagelabs.com!1456275303!26098206!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46583 invoked from network); 24 Feb 2016 00:55:03 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-12.tower-27.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 24 Feb 2016 00:55:03 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4E8C1ABD3; Wed, 24 Feb 2016 00:55:01 +0000 (UTC) Date: Wed, 24 Feb 2016 01:54:58 +0100 From: "Luis R. Rodriguez" To: "H. Peter Anvin" Message-ID: <20160224005458.GK25240@wotan.suse.de> References: <1455889559-9428-1-git-send-email-mcgrof@kernel.org> <1455889559-9428-3-git-send-email-mcgrof@kernel.org> <56C77A53.6060708@zytor.com> <20160219214856.GX25240@wotan.suse.de> <56CCE9B6.4080000@zytor.com> <56CCF41F.8080507@zytor.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56CCF41F.8080507@zytor.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Benjamin Herrenschmidt , Ming Lei , Masami Hiramatsu , Boris Ostrovsky , linux-arch@vger.kernel.org, "xen-devel@lists.xensource.com" , Russell King , X86 ML , linux-security-module , anil.s.keshavamurthy@intel.com, Ingo Molnar , Arnd Bergmann , Rusty Russell , jbaron@akamai.com, Borislav Petkov , Thomas Gleixner , andriy.shevchenko@linux.intel.com, Michael Brown , Juergen Gross , ananth@in.ibm.com, Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , Andy Lutomirski , "Luis R. Rodriguez" , David Vrabel , David Woodhouse , David Miller Subject: Re: [Xen-devel] [RFC v2 2/7] tables.h: add linker table support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Feb 23, 2016 at 04:06:55PM -0800, H. Peter Anvin wrote: > On 02/23/2016 03:36 PM, Luis R. Rodriguez wrote: > > > >> 4. the only useful operator on a range is "is address X inside this > >> range"; this operator is likely *not* useful for a table, since ^^^^^^^^^^^^ > >> if you have to ever invoke it you are probably doing something very > >> wrong. > > > > kprobe uses it :P > > > > Could you explain how? Sorry I misread this as "unless you are a table", kprobes has two ranges, one is a table (blacklist) and the other just a range (for kprobes); only kprobes uses "address inside this range", as reflected below. So I agree with you. index d10ab6b9b5e0..d816c659f358 100644 #define DECLARE_SECTION_TEXT_TYPE(type, name) \ extern const type name[], name##__end[]; #define DECLARE_SECTION_TEXT(name) \ DECLARE_SECTION_TEXT_TYPE(char, name) Then tables.h would use the TYPE version: #define DECLARE_LINKTABLE_TEXT(type, name) \ DECLARE_SECTION_TEXT_TYPE(type, name) Since I've been making _TEXT the implicit type for section names(SECTION_INIT is .init.text) the above could just be DECLARE_SECTION_TYPE() and DECLARE_SECTION() for text if we prefer. Luis --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1328,8 +1328,7 @@ out: bool __weak arch_within_kprobe_blacklist(unsigned long addr) { /* The __kprobes marked functions and entry code must not be probed */ - return addr >= (unsigned long)__kprobes_text_start && - addr < (unsigned long)__kprobes_text_end; + return LINKTABLE_ADDR_WITHIN(kprobes, addr); } bool within_kprobe_blacklist(unsigned long addr) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index d10ab6b9b5e0..d816c659f358 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1328,8 +1328,7 @@ out: bool __weak arch_within_kprobe_blacklist(unsigned long addr) { /* The __kprobes marked functions and entry code must not be probed */ - return addr >= (unsigned long)__kprobes_text_start && - addr < (unsigned long)__kprobes_text_end; + return LINKTABLE_ADDR_WITHIN(kprobes, addr); } What about rebranding general section primitives under section.h