Received: by 10.223.185.116 with SMTP id b49csp237451wrg; Thu, 15 Feb 2018 20:49:24 -0800 (PST) X-Google-Smtp-Source: AH8x226alg6pkLKZWXbdIqXDhDOg4IItqoOkNDiwRguBds4xdCOKGXiyfC5tHs7TD/FWV7JyNMej X-Received: by 10.99.99.2 with SMTP id x2mr4148273pgb.406.1518756564172; Thu, 15 Feb 2018 20:49:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518756564; cv=none; d=google.com; s=arc-20160816; b=bgur6kgzFKa8IcOFbZGYVx9k5LHfSRPffXlhMQwiU1hozFJWOeoS4pp/ztk2EkR5qS G1czTXdmPEsp33z5QLMs/A8cg5KhN4gO4Yv6R+h0yZ/lyaGmycZTz71t5fzrw5rhtE6H g5nnEGB2rBKHf5Cj+PnssM4a8YNihkLXxZ5ALnyNZjGkc889D59/V1mwZXuX2rMB1WMO jIhmN8KtFn/3M+1DXMSqb8aF8U7FTw4s2+LicCTNFmmOjYbFX7xs0DMPLD/P+jYjT54v Ayhc5i3ONjhUYMcFR5wOnNqPHD/PWL+ro33uGAe/AMgiAMq28BymhRPlqm9oZyCeeNVR 45Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kDWu5G+9wpzI/mqTJvQgNMizqYMADd/p2T3Q09RAJOY=; b=nKRVM+WyTt77CMcW0dd7omJUkvcgVIEtKPh/wRucpGk+h4vpF3WuI1hIHwqyBbD9ES lu6CuFVTrnNHbCtVbnL/qk5TAS10LYfe3YCHfI9uxfWumKpZfyO63S9Xni6V1uTBZUV/ jTCoDnm5aHEPGfV6En9TxjkeI4vv+e/zvyiMkh7+NdBDQmKBdbez1AbttA2WVk+XnZBg UKDPasyuQZrPll69Dma83OQAdAm4dWztl2TVAXlx5S6FkpqoOwb3L5DM1/Cd3Qv0HT5C OKcv9wkjxx57XyaPGsVu8dEUr4ynBOBlz3CiEMlfUDlBmIHjnlGNnwXmgTkr7d8AT9n8 m0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si1094726pga.1.2018.02.15.20.49.08; Thu, 15 Feb 2018 20:49:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424977AbeBOPru (ORCPT + 99 others); Thu, 15 Feb 2018 10:47:50 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36340 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424947AbeBOPrr (ORCPT ); Thu, 15 Feb 2018 10:47:47 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E355B1025; Thu, 15 Feb 2018 15:47:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Masami Hiramatsu , Al Viro , "Steven Rostedt (VMware)" Subject: [PATCH 4.15 199/202] ftrace: Remove incorrect setting of glob search field Date: Thu, 15 Feb 2018 16:18:19 +0100 Message-Id: <20180215151723.055165995@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt (VMware) commit 7b6586562708d2b3a04fe49f217ddbadbbbb0546 upstream. __unregister_ftrace_function_probe() will incorrectly parse the glob filter because it resets the search variable that was setup by filter_parse_regex(). Al Viro reported this: 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. Suppose the glob is e.g. *foo*. We end up with func_g.type = MATCH_MIDDLE_ONLY; func_g.len = 3; func_g.search = "*foo"; Feeding that to ftrace_match_record() will not do anything sane - we will be looking for names containing "*foo" (->len is ignored for that one). Link: http://lkml.kernel.org/r/20180127031706.GE13338@ZenIV.linux.org.uk Fixes: 3ba009297149f ("ftrace: Introduce ftrace_glob structure") Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Reviewed-by: Masami Hiramatsu Reported-by: Al Viro Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 1 - 1 file changed, 1 deletion(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -4456,7 +4456,6 @@ unregister_ftrace_function_probe_func(ch 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))