Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5084441imu; Tue, 8 Jan 2019 11:11:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN7R2/hjEx2ryTvJZ5tJmdprWvYJACQtJi7bZalfz9lurga/n512WR/3DA62ROL0Mr2Vv3tU X-Received: by 2002:a62:5716:: with SMTP id l22mr3049758pfb.16.1546974698927; Tue, 08 Jan 2019 11:11:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546974698; cv=none; d=google.com; s=arc-20160816; b=ZD7wVAOUHbDJ6E/6mGXZDgi63uuJ30UZOBdjAE5MiztqckShERYxkbFJ8TGXOrEOAi rbefnkXiZL0FkCK1OFFC4zeMlPZ4UPYUe2e+GAXd45Nn0DgJDbqgguHYTEFLgkA+ImpU x7lNKQCUQak1S4W6ZaOUYjRlrM4v8ngla0VFNsUiG+Oit6AwaggeO1qnYK6rmXuV89k+ 9r8jsX5zV7IuOFloYkIvraR/p85aNTlThtYPybZYqZIVDzg0vhhMRReC563SmJ8jtkNu rDVntMqRKsn/wEm7dwRnK+6udNEs9zFHti8CWDt8kBuFKYVedupwqqQTB9QgX4vnMAG4 +PNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=k3q5e+E94nl+9Epjzj2dLoN5vF7c1pT+UyEjHMtEg1c=; b=UOIGxEAvyBiw45EI5G6WaAeDzyZyAedA3eoeDfVNvPYqOn2t1KVsGmU100uLpDX5r4 6LJ6jOAUX6ioy36XUC1q/hQvYV3NAB0rW0X/frOpXSAbcKhOblVeiRa6lfkfXjXUXC3J E6VZytpMyz0+1mhd0KsfGjiLmXTbEFJyWbvdD8lZquD1GwF+OZUORbDDuOBBjXYSrFXK qdtEOlC+ZVQYwhxDhsROY7+xYhyQIBBV32GSQ0k9i80qPfQ+9wFBrQrwLpWw0Y4a6QO4 FAY00x3ceHwb6DdMTKv2HFuVQAaOJKgASvu8NmfGAD0Y5tYP4clwQLG82AbMY82gq+1H 0luA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=o9QtRb9T; 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 y141si7108274pfc.180.2019.01.08.11.11.23; Tue, 08 Jan 2019 11:11:38 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=o9QtRb9T; 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 S1729565AbfAHSlV (ORCPT + 99 others); Tue, 8 Jan 2019 13:41:21 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:47898 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727484AbfAHSlV (ORCPT ); Tue, 8 Jan 2019 13:41:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k3q5e+E94nl+9Epjzj2dLoN5vF7c1pT+UyEjHMtEg1c=; b=o9QtRb9TzNzRBp2YEnjkrlSGS lcRjB/tqOuUZsOZUL7q82G7xCsxPukyzD7OoMme0i9GXQ5n7b9DEZ+yMi7PD/2LLxanfS3ZUoNtTq geS4gfI9v5UoqWTSgCXqDJjFYL+d8MePYDXKX1odQZKjW3A7+T7Ff6vH0esYJdBT44j/UIEBKzFsW vyCLXtu/9QyTQEFYr/rI/oByEcPg/jF77U9CdJGfo/ESkhpWFRtcKaOpBLDQzxhaIU5MX3AJUGddH 2urlwrxozCwbxokc7bvKXfAg6buEf6kxrbdFXvqJfTjSZzsBzNjH8zmgw6EtMj/D5wpLkgo/QUISX vvtFxlkEw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggwJS-0005fZ-5L; Tue, 08 Jan 2019 18:41:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A3B12202943F4; Tue, 8 Jan 2019 19:41:16 +0100 (CET) Date: Tue, 8 Jan 2019 19:41:16 +0100 From: Peter Zijlstra To: Song Liu Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, acme@kernel.org, ast@kernel.org, daniel@iogearbox.net, kernel-team@fb.com Subject: Re: [PATCH v5 perf, bpf-next 3/7] perf, bpf: introduce PERF_RECORD_BPF_EVENT Message-ID: <20190108184116.GC30894@hirez.programming.kicks-ass.net> References: <20181220182904.4193196-1-songliubraving@fb.com> <20181220182904.4193196-4-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181220182904.4193196-4-songliubraving@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 20, 2018 at 10:29:00AM -0800, Song Liu wrote: > @@ -986,9 +987,35 @@ enum perf_event_type { > */ > PERF_RECORD_KSYMBOL = 17, > > + /* > + * Record bpf events: > + * enum perf_bpf_event_type { > + * PERF_BPF_EVENT_UNKNOWN = 0, > + * PERF_BPF_EVENT_PROG_LOAD = 1, > + * PERF_BPF_EVENT_PROG_UNLOAD = 2, > + * }; > + * > + * struct { > + * struct perf_event_header header; > + * u16 type; > + * u16 flags; > + * u32 id; > + * u8 tag[BPF_TAG_SIZE]; > + * struct sample_id sample_id; > + * }; > + */ > + PERF_RECORD_BPF_EVENT = 18, > + Elsewhere today, I raised the point that by the time (however short interval) userspace gets around to reading this event, the actual program could be gone again. In this case the program has been with us for a very short period indeed; but it could still have generated some samples or otherwise generated trace data. It was suggested to allow pinning modules/programs to avoid this situation, but that of course has other undesirable effects, such as a trivial DoS. A truly horrible hack would be to include an open filedesc in the event that needs closing to release the resource, but I'm sorry for even suggesting that **shudder**. Do we have any sane ideas?