Received: by 10.223.185.116 with SMTP id b49csp2557635wrg; Thu, 15 Feb 2018 13:36:21 -0800 (PST) X-Google-Smtp-Source: AH8x224+4JfQMYI3pgH6xk7JD2i744f0QjtX7Eve9k47OI8HqqgUPi3+PVMrn4IRNE3HyCC5N75v X-Received: by 10.99.168.75 with SMTP id i11mr3265499pgp.420.1518730581318; Thu, 15 Feb 2018 13:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518730581; cv=none; d=google.com; s=arc-20160816; b=DCJKIOhImVFTH/XsEJ4+gR2RaAQVWYsOfkEbyzqb4UqOhxlfhpyFtoPutnP/agLt56 O5A9iw2OByqVJQDykl5QXDWOVFXh/foSY2oeSxNPHgMuC7Mcqbo/aK4k45JQLAb7qOiq tk8sB99Pbgq4TBu1BRSeE8UPQMj8K+L6il/JszcCnSnY+SV9VzWiS30sTdzUFHLve6K3 WfgFIzHSgQfqTDSESuhPvaJstDJZmOiWIitjSPsakiYPwiIuWFOCCsCV8ZWFwHA4wuvq a2v0TK0xETocSzqa+9UCFiES03+fPfhKbpzvTjxUGy2h2t+ZJCRC5cUJr/OO+kw8K2C/ XRyQ== 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=z5Nm4bPU7sezaCNB56uNJlsidINOUo76ioJWmG0w+eg=; b=zib8WqBg81RXYrsKIuXFRcVE2+k2eb7aktDo5deAAnlJjJuY5x654Jjqx38Sif/y4K 8sF7lHFD1l7qZ0OVNC83hH5EfJTAtBh0xkK6fDDPiFUU85tIy97EDoiWyo3l+Jds9Fij d/e+5/ivSbShx3NiEpyalr93E5RuxmlQGG38HYnAl+VKNN9qCGLpQYsNytVi7SyPvlWP cuPmfQpW7VqPjjbeUQb0hon9SEpmLX0zCuc2UJjMj0lSgXaRb6UnEI2GHadUrVtg/+B9 SAO9SX24hFxy63GE+kpbitVAiB1cvbUUgfSGT6JJ0m+hb0Qhf4l27hpPcJwd/vKizCcI jsOQ== 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 n6si4358591pgc.665.2018.02.15.13.36.05; Thu, 15 Feb 2018 13:36:21 -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 S1164051AbeBOP3b (ORCPT + 99 others); Thu, 15 Feb 2018 10:29:31 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54414 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163607AbeBOP32 (ORCPT ); Thu, 15 Feb 2018 10:29:28 -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 B3E7E10B8; Thu, 15 Feb 2018 15:29:27 +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.9 88/88] ftrace: Remove incorrect setting of glob search field Date: Thu, 15 Feb 2018 16:17:55 +0100 Message-Id: <20180215151234.639070044@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@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.9-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 @@ -3911,7 +3911,6 @@ __unregister_ftrace_function_probe(char 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))