From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753300AbbE1Bov (ORCPT ); Wed, 27 May 2015 21:44:51 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35121 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbbE1Bog (ORCPT ); Wed, 27 May 2015 21:44:36 -0400 Date: Wed, 27 May 2015 18:44:33 -0700 From: Alexei Starovoitov To: Wang Nan Cc: paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v4 06/29] bpf tools: Open eBPF object file and do basic validation Message-ID: <20150528014432.GA20764@Alexeis-MacBook-Pro.local> References: <1432704004-171454-1-git-send-email-wangnan0@huawei.com> <1432704004-171454-7-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432704004-171454-7-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2015 at 05:19:41AM +0000, Wang Nan wrote: > This patch defines basic interface of libbpf. 'struct bpf_object' will > be the handler of each object file. Its internal structure is hide to > user. eBPF object files are compiled by LLVM as ELF format. In this > patch, libelf is used to open those files, read EHDR and do basic > validation according to e_type and e_machine. > > All elf related staffs are grouped together and reside in efile field of > 'struct bpf_object'. bpf_object__elf_finish() is introduced to clear it. > > After all eBPF programs in an object file are loaded, related ELF > information is useless. Close the object file and free those memory. > > zfree() and zclose() are introduced to ensure setting NULL pointers and > negative file descriptors after resources are released. > > Signed-off-by: Wang Nan the __ notation actually looks good in this context. Acked-by: Alexei Starovoitov btw, you didn't cc me on this set, luckily I found it on lkml.