From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 154D4C4332B for ; Tue, 24 Mar 2020 09:47:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0DA220775 for ; Tue, 24 Mar 2020 09:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727296AbgCXJrz (ORCPT ); Tue, 24 Mar 2020 05:47:55 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44248 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbgCXJry (ORCPT ); Tue, 24 Mar 2020 05:47:54 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jGg9j-0000xm-7b; Tue, 24 Mar 2020 10:47:31 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 39C86100292; Tue, 24 Mar 2020 10:47:30 +0100 (CET) From: Thomas Gleixner To: Masami Hiramatsu Cc: LKML , x86@kernel.org, Paul McKenney , Josh Poimboeuf , "Joel Fernandes \(Google\)" , "Steven Rostedt \(VMware\)" , Alexei Starovoitov , Frederic Weisbecker , Mathieu Desnoyers , Brian Gerst , Juergen Gross , Alexandre Chartre , Peter Zijlstra , Tom Lendacky , Paolo Bonzini , kvm@vger.kernel.org Subject: Re: [patch V3 04/23] kprobes: Prevent probes in .noinstr.text section In-Reply-To: <20200324144953.eec3e73f249901582bdf564e@kernel.org> References: <20200320175956.033706968@linutronix.de> <20200320180032.799569116@linutronix.de> <20200323230025.a24f949a2143dbd5f208f00c@kernel.org> <87mu87oy7n.fsf@nanos.tec.linutronix.de> <20200324144953.eec3e73f249901582bdf564e@kernel.org> Date: Tue, 24 Mar 2020 10:47:30 +0100 Message-ID: <87369yf5jh.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masami Hiramatsu writes: > On Mon, 23 Mar 2020 17:03:24 +0100 > Thomas Gleixner wrote: >> > @@ -2212,6 +2212,10 @@ static int __init populate_kprobe_blacklist(unsigned long *start, >> > ret = kprobe_add_area_blacklist((unsigned long)__kprobes_text_start, >> > (unsigned long)__kprobes_text_end); >> > >> > + /* Symbols in noinstr section are blacklisted */ >> > + ret = kprobe_add_area_blacklist((unsigned long)__noinstr_text_start, >> > + (unsigned long)__noinstr_text_end); >> > + >> > return ret ? : arch_populate_kprobe_blacklist(); >> > } >> >> So that extra function is not required when adding that, right? > > That's right :) > >> >> >> +/* Functions in .noinstr.text must not be probed */ >> >> +static bool within_noinstr_text(unsigned long addr) >> >> +{ >> >> + /* FIXME: Handle module .noinstr.text */ > > And this reminds me that the module .kprobes.text is not handled yet :(. Correct. Any idea how to do that with a simple oneliner like the above? Thanks, tglx