Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3151383pxa; Tue, 18 Aug 2020 07:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFGla7T4ECyt+2RXZ0jVhzBGiyN4t/v6hPZHOaIiJeFZp0lVR41j0PvUD/8y8D5EgB5ggf X-Received: by 2002:a17:906:3449:: with SMTP id d9mr20987914ejb.460.1597762472502; Tue, 18 Aug 2020 07:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597762472; cv=none; d=google.com; s=arc-20160816; b=wx4SGrlgihd5ey1R/Ab94r1/SpoFHLf6DtFy32sgk49LJk6XRpnJLjF/fol2KfLprx UO5Iygw7HUtr2pqjjgWhZmFxusdCSCJ9zvOAczvpHRGNmQhEEKrIGQFWJUqZcE6n14Ap Hx3K87knXT6HIx54Au7WgwR0Zhvs6YvtfHpljdSBcva7FmZEN7f+wMckXZ2iLTBnrh/P AFgzOfyu0zb3aYw4iFExughb2kU4a1x8z9kLzHdq1d67WJ8qStym5Y/sNNOzzfhTcxv6 +p/ZQe89ZVCRabhoOM2tOn0G6TL+bOz9SWqkc/zWbAdTtPSz+5PDFYYjRlFnbYFRhivA VYsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=IMEgi4/3K27vm4J7YWCkqD3mfqP5tMrU815lpHwarSE=; b=L0R7dfuROQHq9SMT95DVjH8UZRUl/v2Xy24x9DR0VSSLfxrtpZKJK0N7TvCNL753+i gtQHn7MJW6x2909DAIXJV6IfK9ZrwrfG8B3Y96rRTW3a03ucxmU1uhmKOGGnA28QvOHt WaKfRTMDkmGXAdQjX4ZbC1QyG4l4vrBYtE2kaghJ2MZxuGLxg4CDftDpWpyf3kagaQWr 3dgMnQBaW+0TFn/cpzCA1H5uv7ewCJ6M4UOJNny5J1c5+yqcmrqV9cJ2ILdP66RoKQIJ b4XUCZJLQVfcu0eedISaCbRlDyz3pBffA8ivGtblyLQ0wiFhDK7Napew7ddOvgXOkFnh OuHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JshAvEf5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 89si13571929edr.198.2020.08.18.07.54.08; Tue, 18 Aug 2020 07:54:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JshAvEf5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgHROuD (ORCPT + 99 others); Tue, 18 Aug 2020 10:50:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726745AbgHROuD (ORCPT ); Tue, 18 Aug 2020 10:50:03 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 4FFC420866; Tue, 18 Aug 2020 14:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597762203; bh=aC0a+9Dqz+xL6DqOsy65jLPJS026yhiSAzjqQcepjuo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JshAvEf5sD0uKtjIkYZf5OeOLR+8ZCAUEzYqTrQmuoKBBkZf1y04mfkcT7FfRYXsc a6XmQbbDaXcMnq1VXll9PBZdC3HdVUTiatqWSpvaaymLU/Dupw+zTw2Q8jwVMf3RGi pwQL+oINPDOHIgkjlQsGrwAOtyckKKbc6rGNcQM4= Date: Tue, 18 Aug 2020 23:49:56 +0900 From: Masami Hiramatsu To: Jarkko Sakkinen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andi Kleen , Ard Biesheuvel , Jessica Yu , Mark Rutland , Masami Hiramatsu , Mike Rapoport , Peter Zijlstra , Russell King , Will Deacon , Steven Rostedt , Ingo Molnar Subject: Re: [PATCH] kprobes: Use module_name() macro Message-Id: <20200818234956.c616371d8766e74aef5e7bd2@kernel.org> In-Reply-To: <20200818050857.117998-1-jarkko.sakkinen@linux.intel.com> References: <20200818050857.117998-1-jarkko.sakkinen@linux.intel.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Aug 2020 08:08:57 +0300 Jarkko Sakkinen wrote: > It is advised to use module_name() macro instead of dereferencing mod->name > directly. This makes sense for consistencys sake and also it prevents a > hard dependency to CONFIG_MODULES. > > Cc: linux-mm@kvack.org > Cc: Andi Kleen > Cc: Ard Biesheuvel > Cc: Jessica Yu > Cc: Mark Rutland , > Cc: Masami Hiramatsu > Cc: Mike Rapoport > Cc: Peter Zijlstra > Cc: Russell King > Cc: Will Deacon > Signed-off-by: Jarkko Sakkinen OK, this looks good to me. Acked-by: Masami Hiramatsu Thank you, > --- > I thought that to get things moving it would make sense to fix this low > hanging fruit issue first. Similarly as Masami's fix kernel/kprobes.c > this will make my patch set less rambling, and thus easier to follow. > kernel/trace/trace_kprobe.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index aefb6065b508..19c00ee90945 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -106,9 +106,10 @@ static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk) > static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, > struct module *mod) > { > - int len = strlen(mod->name); > + int len = strlen(module_name(mod)); > const char *name = trace_kprobe_symbol(tk); > - return strncmp(mod->name, name, len) == 0 && name[len] == ':'; > + > + return strncmp(module_name(mod), name, len) == 0 && name[len] == ':'; > } > > static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) > @@ -688,7 +689,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb, > if (ret) > pr_warn("Failed to re-register probe %s on %s: %d\n", > trace_probe_name(&tk->tp), > - mod->name, ret); > + module_name(mod), ret); > } > } > mutex_unlock(&event_mutex); > -- > 2.25.1 > -- Masami Hiramatsu