From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966AbeA2Ntw (ORCPT ); Mon, 29 Jan 2018 08:49:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:52004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbeA2Nts (ORCPT ); Mon, 29 Jan 2018 08:49:48 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C39AC20C48 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Mon, 29 Jan 2018 22:49:44 +0900 From: Masami Hiramatsu To: Al Viro Cc: mhiramat@kernel.org, Steven Rostedt , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org Subject: Re: [RFC] apparent bogosity in unregister_ftrace_function_probe_func() Message-Id: <20180129224944.8d706976e6bcda761905ac0f@kernel.org> In-Reply-To: <20180127031706.GE13338@ZenIV.linux.org.uk> References: <20180127031706.GE13338@ZenIV.linux.org.uk> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 Jan 2018 03:17:06 +0000 Al Viro wrote: > It contains something very odd: > > func_g.type = filter_parse_regex(glob, strlen(glob), > &func_g.search, ¬); > func_g.len = strlen(func_g.search); > func_g.search = glob; > > /* we do not support '!' for function probes */ > if (WARN_ON(not)) > return -EINVAL; > > What the hell is the last assignment for? After that call of > filter_parse_regex() we could have func_g.search not equal to glob > only if glob started with '!' or '*'. In the former case we would've > buggered off with -EINVAL (not = 1). In the latter we would've set > func_g.search equal to glob + 1, calculated the length of that thing > in func_g.len and proceeded to reset func_g.search back to glob. Ah, right. It must be a bug! func_g.search should be assigned in filter_parse_regex(), and it should be "glob" without "!" if it is MATCH_GLOB. Of course above assignment should be removed. Thank you, -- Masami Hiramatsu