Received: by 10.192.165.148 with SMTP id m20csp2118247imm; Thu, 26 Apr 2018 06:26:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Ji7/R2/2w0AB7WKUZuroUAWIHde4Hxx8207fRLp6CzsYzNC+a1KQHpKY+YTJRL5X767y8 X-Received: by 2002:a17:902:31a4:: with SMTP id x33-v6mr34170853plb.355.1524749191036; Thu, 26 Apr 2018 06:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524749191; cv=none; d=google.com; s=arc-20160816; b=IYCd/1qh9rwYxgsUht50ZHD9qLc6zxPIJIMRjdtWLDiXgIWBoW78mIISFU7I3z4KJM 5OzeuknefsgmS+tyTNAwPodz6apBOc3vVQeReGTJEzWAPbsa4HAo8A0+sXZKQj2fgvBl WmcgOlyrVCVYengsfkzuCyOLGMDIW3XvD+olqPuvwokj0HT2mDm2JYzJxryCRx7EJ9UB wy4P6oOr5NAbYnYFVWLkfScfG78nIWv3U0uvxzVGLMDpDUoCuSX0g2xVq7hbaOufsuzs QBCAl4TXAIyD4GbSXH1oCofwisUDzBoQd2ExhD7uxEkO+lTyQ0iT279xgOR2sPQwxs5u AbUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=cVsvxsoVNqcuIguAd+3ajaNLIlmDXtIChZ77DSh+eF4=; b=h+CQME2vAxGitlUANVABnGCMSK0ZLhxZPAcvR6NoDoy/QrQmw8zvtQFclrDZITQ72r J4ksmr8vpvS0wqV0uTFOjXtpBcw4IKYAsx35FzMB5jfFqaOWNxaRt0et4E/gNGBhRoxG Agtby3LzBJFPxMvo/6P7PdxvmaQl3pqOFzSQpgcUXbS6um1paaAE6eAdwV95ecS2o/5W +p7MPbAws/SMkv183w98M0uPfWMfkgqrXhR4QgF69d31nccCyxGgHrTGyaNtJ64BKU1D ybpuB+5GnZMNfk+e+CvLS0FQuTR/trC0q+XoRw3N0aJl5MzyqmDqo5CHJA8d0wMLbA4Y q+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=h0eUG2PG; 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 u10-v6si18698082plu.343.2018.04.26.06.26.14; Thu, 26 Apr 2018 06:26:31 -0700 (PDT) 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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=h0eUG2PG; 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 S1756139AbeDZNY6 (ORCPT + 99 others); Thu, 26 Apr 2018 09:24:58 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:45077 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754516AbeDZNY4 (ORCPT ); Thu, 26 Apr 2018 09:24:56 -0400 Received: by mail-oi0-f65.google.com with SMTP id b130-v6so5257654oif.12 for ; Thu, 26 Apr 2018 06:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cVsvxsoVNqcuIguAd+3ajaNLIlmDXtIChZ77DSh+eF4=; b=h0eUG2PGRW8U7G27quFgN/OQ0FMrDextewPaPkFbKN7CKmCxTYQw8cWxAdI5JEpdCW eMNzBgHDtaLeczGfu6hAYZLluopjOAw7esgbl91spXLTlMpHH76qVheOBpMQnGfJzdyY fNW+HPLQVL322j97pjZY7kNBJJ0Nx6WYWm2/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cVsvxsoVNqcuIguAd+3ajaNLIlmDXtIChZ77DSh+eF4=; b=I59TpRqk0p/03FmHu4nXJuhoioBREOrx3D/4vEQDZdXWPhWh9OFTERia1VPiRC4HHh oCufDvkyMQ8hUO5yiG3r5zrpDlkjc+ppAhp/E+nX8lZbDuhc3oP0YvsP295wQg5GZzg1 HsFKSi5HFAGpYn5hRrUBrbtAA2I4xTdDMdkND1MdAkMjwXTmeE3kC+7EpGnpIvt+3yDx 41oNXFpG8CxhGaCLNIYPgi68lVN2FEKTVAhQNqXmi9F5BffWD8T+PuV///pkBItARJ36 YXoqJKse1lpfGJ+eePsDEpN8qjve5iLtJYap3Ia0lbINByhXWZ0VgQl74cElcxubWXd2 we5A== X-Gm-Message-State: ALQs6tAs8MM8e2zdqb2HvWGINl2vsVWdpfFdfBVNyEKxYwOWpdh9SrRJ eEW6TM1RdjI+dkGzG6M3+u/RPz7MW94jgRUXbcetcg== X-Received: by 2002:aca:a610:: with SMTP id p16-v6mr19426598oie.149.1524749095709; Thu, 26 Apr 2018 06:24:55 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:5303:0:0:0:0:0 with HTTP; Thu, 26 Apr 2018 06:24:55 -0700 (PDT) X-Originating-IP: [176.63.54.97] In-Reply-To: <20180423172135.4050588-1-songliubraving@fb.com> References: <20180423172135.4050588-1-songliubraving@fb.com> From: Miklos Szeredi Date: Thu, 26 Apr 2018 15:24:55 +0200 Message-ID: Subject: Re: [PATCH v5 1/2] tracing: fix bad use of igrab in trace_uprobe.c To: Song Liu Cc: linux-kernel@vger.kernel.org, kernel-team , Steven Rostedt , Ingo Molnar , Howard McLauchlan , Josef Bacik , Srikar Dronamraju 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 On Mon, Apr 23, 2018 at 7:21 PM, Song Liu wrote: > As Miklos reported and suggested: > > This pattern repeats two times in trace_uprobe.c and in > kernel/events/core.c as well: > > ret = kern_path(filename, LOOKUP_FOLLOW, &path); > if (ret) > goto fail_address_parse; > > inode = igrab(d_inode(path.dentry)); > path_put(&path); > > And it's wrong. You can only hold a reference to the inode if you > have an active ref to the superblock as well (which is normally > through path.mnt) or holding s_umount. > > This way unmounting the containing filesystem while the tracepoint is > active will give you the "VFS: Busy inodes after unmount..." message > and a crash when the inode is finally put. > > Solution: store path instead of inode. > > This patch fixes two instances in trace_uprobe.c. struct path is added to > struct trace_uprobe to keep the inode and containing mount point > referenced. > > Fixes: f3f096cfedf8 ("tracing: Provide trace events interface for uprobes") > Fixes: 33ea4b24277b ("perf/core: Implement the 'perf_uprobe' PMU") > Cc: Steven Rostedt > Cc: Ingo Molnar > Cc: Howard McLauchlan > Cc: Josef Bacik > Cc: Srikar Dronamraju > Cc: Miklos Szeredi > Reported-by: Miklos Szeredi > Signed-off-by: Song Liu Acked-by: Miklos Szeredi