Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2801795ybb; Fri, 27 Mar 2020 12:18:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtBZJ7Glk5G2323P39YYqvdT4kbLPUQitL+qjH4vkJ6/IdjwN8SgQaXULo+HWsLdeXGvu0q X-Received: by 2002:aca:aa81:: with SMTP id t123mr287439oie.117.1585336731146; Fri, 27 Mar 2020 12:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585336731; cv=none; d=google.com; s=arc-20160816; b=Aqli+V7be+IO73MWNIbj0PT+jAmunxrfyyuL6SVNSyghJNE0UyYJyGY0vDuJVbyukG ujPAU3RK3qevgoVlnR/r36fNnX1Bu3woAeYYHaddfSQsAZMmEFKh18cpPbmnri6W6zpt r+0tb8+ZEY7c0D++PIi8tsO+PoWfiC205hUXfB3C+QGp5XHGnewjKBcMJRtqH/Htf7lX h1excR51Qsof0iHgppqG0TYLY2GDKLfhaZ06XgAovOQnWA5PtV9XJGp/Ji25Phz052j+ Ji2eTjtZ/ici8FaEky2Fpexa0EY6be7ZKWdmaAckmkL97yE5ThB1MWo8Eb6P3uNvAoWR 8ikw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=hh6WYJqT/M6VdZCxRRGFJ4X3bio1m9J2mQ8vyCBUNIY=; b=rCgBj6J+oJuzrlDBP5SSv0GqDe9CcvWRPDJuew8I4+zpcdFtkOH4m5LR+d0ZJi9Z/3 B3Q63COXIe1bo9ODNnxIFVQiPtmNwVBSn3GqSfRRYJW/EbSgD1tTzvDO7m8uqvT0brwO aCKzdJ0zE7sr03QJGHC73LJ1ibmrVcb/dJYxiZmdVeTVxam4h9iv/9n3d07dV12zDayz IRAfvh/DaxfZ0ZnAKZxdkxi5zEVf209KnCyhzzzeVYSh+PEyJHJVJxdpbph6T/dXLq2r Rhp/QAZec90WPO082KZkzHf1IlooQve3GcfHtW+5J2IHy4nnveWflOgTWq88g/+IdSwd Xv/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Aj5KuCp5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si2771924otn.111.2020.03.27.12.18.35; Fri, 27 Mar 2020 12:18:51 -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=@chromium.org header.s=google header.b=Aj5KuCp5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbgC0TRg (ORCPT + 99 others); Fri, 27 Mar 2020 15:17:36 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38972 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbgC0TRg (ORCPT ); Fri, 27 Mar 2020 15:17:36 -0400 Received: by mail-wr1-f65.google.com with SMTP id p10so12807236wrt.6 for ; Fri, 27 Mar 2020 12:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hh6WYJqT/M6VdZCxRRGFJ4X3bio1m9J2mQ8vyCBUNIY=; b=Aj5KuCp5rUlAQ6zF28nJ3B92q65AO0KaTlRq7Hiod12FrJbTDddzKrzAevJvITTfmr tSOgGVEdlR8yytc4R3UmpYwQ3nAisNYbKiSV98g3m+K8js1jSHsICGH+oZDRLvLutkB4 W1Kg+U/SFAKQNWSdnCyBeag5nqvbfKf4rlZrU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=hh6WYJqT/M6VdZCxRRGFJ4X3bio1m9J2mQ8vyCBUNIY=; b=i9neEEeKb38/5ywOla9uB1dO+FcBKzdOEolqmKaSOKxlI8FWJnP4m4l3Fu0Qok9tDj H2DLWSrvBLtK8yeSq9Hpz35yZQdt9eWJucyUMuP+sw57D8wdvCvM6Q2KJYu58BJmIgtG MUNknLiVCFlQVPs1ceYXSECtigLhynbFPoYG0vLh/vxCKIaJm9/+z/XzFdqf7P/PdjPC rFcm6zMbcZGXDuRCiTKFoFc0JSfZ0qWs+tSXK7kfB1U0ffg9lxZ1YaZvAxWXsi/GTdJp O63fs1Mx5PLS5rBQYXrCEbrU6ZnThDxb8AbZMpM8ZnLJD0pAQySj5xOpcFy8fY/qvtLw CzEg== X-Gm-Message-State: ANhLgQ28rP3VBNCPR44G/GSOBOiTW7Bpa/RZ5AylOf5Z6+PiGMBst4UM 1uoamU+F2phyhWkHcbYqrsTHrQ== X-Received: by 2002:a5d:4305:: with SMTP id h5mr935606wrq.69.1585336654111; Fri, 27 Mar 2020 12:17:34 -0700 (PDT) Received: from chromium.org (77-56-209-237.dclient.hispeed.ch. [77.56.209.237]) by smtp.gmail.com with ESMTPSA id d6sm9333648wrw.10.2020.03.27.12.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 12:17:33 -0700 (PDT) From: KP Singh X-Google-Original-From: KP Singh Date: Fri, 27 Mar 2020 20:17:31 +0100 To: Kees Cook , James Morris Cc: Casey Schaufler , Stephen Smalley , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman , Paul Moore Subject: Re: [PATCH bpf-next v7 4/8] bpf: lsm: Implement attach, detach and execution Message-ID: <20200327191731.GA9419@chromium.org> References: <20200326142823.26277-1-kpsingh@chromium.org> <20200326142823.26277-5-kpsingh@chromium.org> <2241c806-65c9-68f5-f822-9a245ecf7ba0@tycho.nsa.gov> <20200327124115.GA8318@chromium.org> <14ff822f-3ca5-7ebb-3df6-dd02249169d2@tycho.nsa.gov> <202003271143.71E0C591C1@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202003271143.71E0C591C1@keescook> 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 27-M?r 11:59, Kees Cook wrote: > On Fri, Mar 27, 2020 at 09:36:15AM -0700, Casey Schaufler wrote: > > On 3/27/2020 6:43 AM, Stephen Smalley wrote: > > > On 3/27/20 8:41 AM, KP Singh wrote: > > >> On 27-M?r 08:27, Stephen Smalley wrote: > > >>>>> +??????? return -EPERM; [...] > > > > > > I would favor removing the CAP_MAC_ADMIN check here, and implementing it in a bpf_prog hook for Smack and AppArmor if they want that.? SELinux would implement its own check in its existing bpf_prog hook. > > > > > The whole notion of one security module calling into another for permission > > to do something still gives me the heebee jeebees, but if more nimble minds > > than mine think this is a good idea I won't nack it. > > Well, it's a hook into BPF prog creation, not the BPF LSM specifically, > so that's why I think it's general enough control without it being > directly weird. :) > > As far as dropping CAP_MAC_ADMIN, yeah, that should be fine. Creating LSM > BPF programs already requires CAP_SYS_ADMIN, so for SELinux-less systems, > that's likely fine. If we need to change the BPF program creation access > control in the future we can revisit it then. Sounds good, I will send out v8 carrying James and Andri's Acks/Review tags, CAP_MAC_ADMIN check removed and some other minor fixes. - KP > > -- > Kees Cook