Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1627731ybp; Wed, 9 Oct 2019 17:46:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJnTWSj+A9Lf66l9h1pyIbCGhUw+tHtPMt+iKyzMyk/xt2a2jc7NZJHt0X0858TcO9C90f X-Received: by 2002:a17:906:364f:: with SMTP id r15mr5622731ejb.194.1570668404870; Wed, 09 Oct 2019 17:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570668404; cv=none; d=google.com; s=arc-20160816; b=NF9FBSXsk1lbf6ePOtzlQU8mcg/WmtOBFIy+QRTSIinZQyYqZZXF8w97yWr0U+78RF 8vmuxRnkB2O8Uy6uNmR7lyVc31qky5Tx8dM39GLqQ2fyi1nB9UgW351HqeThAPtuRm9u +UMOrVdnrew3PcOT5qxv6Mdk98BJUoJpPSzN7y73Oq8Wkh1h6di1Ekmg8O3/iCBWJGsj od/qYUVYydFuMJdObPZ8c0x3SR+WOgXTdu+Zsn7wN/4Vin1x5rvBnPGgbFirLBEdt14R O7VUA24iGRxiViE9dWh1zmBajUoDIwR7mPdBfFxX0ZAPi0XGIL1pzRk5FsPlQgorSSgl L71g== 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=XTaq5/1iuX7y8HNzbxl3CPoidWluv+Gq3TUzaOzRrgc=; b=HgudW5HmppVFvVtlxEb2O5PvZx4XqByQeXiUhT/HwnLvLw3555lbth8orYwz+8HXLa 9SHQvFAduUfUMemCwK6hgMo1AJxECWuWl5PGHXCZ5uk56138VwYaB/LNJv16PtkI/zMq 47aTfXG5JII6Ii1HdZvjhc5QyOuPJLl8juPxj+vggsEwkxMqtWTf57AWvQHqgkz4OXxW 9lZejwkPOHw/Ut46tRHBFSNevnJTEa9Sumg04F24eCL+EILuVxBQRaDuHdwmw1jlmVQK 8gMMolVl5/9Ksz7/teeD3X0djpogzMMI6oRKpgUng1zOHgkE8SLi9XVeZoOsy9UTwDdc /vIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=m4iCbyyu; 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 ck7si2155340ejb.250.2019.10.09.17.46.21; Wed, 09 Oct 2019 17:46:44 -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=pass header.i=@joelfernandes.org header.s=google header.b=m4iCbyyu; 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 S1732578AbfJJAnz (ORCPT + 99 others); Wed, 9 Oct 2019 20:43:55 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35544 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732555AbfJJAnz (ORCPT ); Wed, 9 Oct 2019 20:43:55 -0400 Received: by mail-pl1-f195.google.com with SMTP id c3so1903425plo.2 for ; Wed, 09 Oct 2019 17:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XTaq5/1iuX7y8HNzbxl3CPoidWluv+Gq3TUzaOzRrgc=; b=m4iCbyyuGcBMekG4jEeTZ+JSwscPAmHNJrKiyykzCU1YYzbgLoypNsggMRiKoIm+nq S94I27UoURdArgHG6X2igS+CAXa4Fex07lm5t/Gak6VIgPLHp4AhbQBSr1I9gD/yScq1 sX3jOQ4l8OhZyiYgWGZ3s2KKWz5jWGoWQdUfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XTaq5/1iuX7y8HNzbxl3CPoidWluv+Gq3TUzaOzRrgc=; b=bzx11+dkbo6NTcdqoLdW2dOQ46jP1Oam/X7cAQENk/kF9bLS0LHzteRrwGKqjCcdMz eC6tiem+9UGujMumbPmdHwNFKyQ/U8ImCuu1KEeja7RoY6ocgZfUTnPEkIB6eZECXKlI btGll4jNq2B4yt7h1UGszK0hocCa9CgOjhfh4Hpf14hFQlPK4iRPtG6zFGUZlZhX8qTD s8Fz7Rkr/s6m3Kj77X5SAfFerEonc421tR1bMgf7wp+XZbonzGQRXDd8IgupntWlMQTN 0AxaHuhcosiXA2NPRnosONm7rE54aI4ukvBBLv411dssKsjmi2dcfJ3FacKn6w38xt/s RMkQ== X-Gm-Message-State: APjAAAXH9zHDFtmpJdXD5Tr5zqP46wvMdkk0yX/Cu6YdE32jf90Guedr 9beVHV4pvrmp9hmfGYDVp1m2eQ== X-Received: by 2002:a17:902:524:: with SMTP id 33mr6045429plf.123.1570668234782; Wed, 09 Oct 2019 17:43:54 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id d76sm3624114pfd.185.2019.10.09.17.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 17:43:54 -0700 (PDT) Date: Wed, 9 Oct 2019 20:43:53 -0400 From: Joel Fernandes To: James Morris Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , rostedt@goodmis.org, primiano@google.com, rsavitski@google.com, jeffv@google.com, kernel-team@android.com, Alexei Starovoitov , Arnaldo Carvalho de Melo , bpf@vger.kernel.org, Daniel Borkmann , Ingo Molnar , Jiri Olsa , Kees Cook , linux-security-module@vger.kernel.org, Matthew Garrett , Namhyung Kim , selinux@vger.kernel.org, Song Liu , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Yonghong Song Subject: Re: [PATCH RFC] perf_event: Add support for LSM and SELinux checks Message-ID: <20191010004353.GD96813@google.com> References: <20191009203657.6070-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Oct 10, 2019 at 09:11:39AM +1100, James Morris wrote: > On Wed, 9 Oct 2019, Joel Fernandes (Google) wrote: > > > > > +#ifdef CONFIG_SECURITY > > + err = security_perf_event_alloc(event); > > + if (err) > > + goto err_security; > > +#endif > > You should not need this ifdef. Fixed. > > diff --git a/security/security.c b/security/security.c > > index 1bc000f834e2..7639bca1db59 100644 > > --- a/security/security.c > > +++ b/security/security.c > > @@ -2373,26 +2373,32 @@ int security_bpf(int cmd, union bpf_attr *attr, unsigned int size) > > { > > return call_int_hook(bpf, 0, cmd, attr, size); > > } > > + > > int security_bpf_map(struct bpf_map *map, fmode_t fmode) > > { > > return call_int_hook(bpf_map, 0, map, fmode); > > } > > + > > int security_bpf_prog(struct bpf_prog *prog) > > { > > return call_int_hook(bpf_prog, 0, prog); > > } > > + > > int security_bpf_map_alloc(struct bpf_map *map) > > { > > return call_int_hook(bpf_map_alloc_security, 0, map); > > } > > + > > int security_bpf_prog_alloc(struct bpf_prog_aux *aux) > > { > > return call_int_hook(bpf_prog_alloc_security, 0, aux); > > } > > + > > void security_bpf_map_free(struct bpf_map *map) > > { > > call_void_hook(bpf_map_free_security, map); > > } > > + > > void security_bpf_prog_free(struct bpf_prog_aux *aux) > > { > > call_void_hook(bpf_prog_free_security, aux); > > @@ -2404,3 +2410,30 @@ int security_locked_down(enum lockdown_reason what) > > return call_int_hook(locked_down, 0, what); > > } > > EXPORT_SYMBOL(security_locked_down); > > Please avoid unrelated whitespace changes. The author of the BPF security hooks forgot to add a newline between function definitions and I was just cleaning the style issue since it is very close to the parts I touched. But I will drop it from the patch per your suggestion. thanks, - Joel