Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2440735ybb; Fri, 27 Mar 2020 05:42:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv5SNWvx8QX6XjctKNHEiZzsH2Q91cnkr6CEwPP7o65iut3U/B1Mv3KSx3bw4DpN9NBrQHS X-Received: by 2002:a9d:6457:: with SMTP id m23mr3663115otl.162.1585312947133; Fri, 27 Mar 2020 05:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585312947; cv=none; d=google.com; s=arc-20160816; b=gFIrHA85Nf7z9w3fHJRsJ4yjh7Bh7jIojEeu7JQHRn8BC+TZSZivuXxxeNhGP5DcEd u5H0gUz8NPaKAiFZAdwc5CuiPs0Ro9V495qIPiJ9EoAlfSvYN+ALon2WF1h7+FvbSYaW 7gefQeylMoqJtWOJ5w0tSFKo3TpmUfHG6xuIU/7DnLSjAfvIiTuwacg9Lk5FXgieJbAR cAOhhPFuIXLzNjb3PJNlfKz5zWsJJSkc4MfmEVhHpveo2qvovV64KAhxLzTowBbnWqMK kL2+4kPeyvpl+W+LtIsNNBqOZSVo0eO9J2jMXz8F34oGxqRITih6NXtXy+rGwwTTD2M6 Fiag== 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=HnVDDDsqTX8MxfeqmFfp9Tn3o5KLZ/pppfNiIQGaWUU=; b=nFwt0JVP0J+xslL/FTzB8xLitPY3WEMGJNcLWiQTXVSWjCPa1pEzyIQVKa36/TOXk9 tETgfh9SA7GHYIxqUXebhXQ8z5QF6BNRhVIV60wn5y6jAc4WbZrkex2wLvpq2MQhM+BO d+akbR9l5cMxSTm7Q8IdYlTRCBFU26rWg1fgjM6c7vGE1l6qxPNBWWMw0T8NahmwIs+d M9TwMljrKxyw2FZsG39i4ceBjiBPx9mJk3tdd1tlcu7vgXARNj0EGJyhkjynR4/McAoH ymt+3mu/Xzpc2UfYI6TpMTiV/1ab0xDt9hR+Z1EE5ExZGZtj4YxQoRFWwSPEOsyPMStr 7sZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A8KkiHIx; 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 h192si2336802oib.166.2020.03.27.05.42.14; Fri, 27 Mar 2020 05:42:27 -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=A8KkiHIx; 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 S1727560AbgC0MlV (ORCPT + 99 others); Fri, 27 Mar 2020 08:41:21 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36628 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbgC0MlV (ORCPT ); Fri, 27 Mar 2020 08:41:21 -0400 Received: by mail-wm1-f65.google.com with SMTP id g62so12188291wme.1 for ; Fri, 27 Mar 2020 05:41:19 -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=HnVDDDsqTX8MxfeqmFfp9Tn3o5KLZ/pppfNiIQGaWUU=; b=A8KkiHIxW5mfnjqo0cLZcZh8IfHn7HLznrdYV7aPqFFm15SFa0UTabygnJhHemRtBH s7dZz7uQCAPVqinpRuTEDU1qFyzXTRK/c9ia70ebmPLz2klt3qGR7SxPqroVkxADCJ4k VEnM1FoM+w6QnEqnBfT5qMalW89SrTK1R6AuE= 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=HnVDDDsqTX8MxfeqmFfp9Tn3o5KLZ/pppfNiIQGaWUU=; b=Sdb8/cJ8AvVmO9+3nB8mQK1mZpcnrQdfPvdY9k55jBqtCCcaITlDiNImk+GouIHTrD pl0yUvkUrK6RjPIoHkW0sUx58//yLPMmHOYCUOZeUw8qiOeTNEnrMMxXgFStbBfaXAqm jBTz7GWsB4C/QsKu7GBMF3sKVaFErxd0S0ClrR9pgFNtz+pO/W7hihzVFp/qyawm3JUQ 2uFv0cFKcE4uhbUqnBaNur6sKYUNrfeMMEVzsqIM9kfLl+nxhd4yd0B3GdOshXQL2ol+ YifnTJ9sdOS+nFkqtBiG+2RtVruh2X+Xge+T2jltTWDm2tkk9FHZrC0X2rvwMy3+yeZC AQwg== X-Gm-Message-State: ANhLgQ3J8OsVr1LDVWLBt9IsmfI13w0zX0dO7TaI+0YOHpBxmpRyGZ1B 0+JMRaRlBS/UctGdv//CmK0XkdHUefY= X-Received: by 2002:a1c:9a8d:: with SMTP id c135mr5381550wme.183.1585312878062; Fri, 27 Mar 2020 05:41:18 -0700 (PDT) Received: from chromium.org (77-56-209-237.dclient.hispeed.ch. [77.56.209.237]) by smtp.gmail.com with ESMTPSA id u11sm8075975wrt.29.2020.03.27.05.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 05:41:17 -0700 (PDT) From: KP Singh X-Google-Original-From: KP Singh Date: Fri, 27 Mar 2020 13:41:15 +0100 To: Stephen Smalley Cc: James Morris , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , Kees Cook , 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: <20200327124115.GA8318@chromium.org> References: <20200326142823.26277-1-kpsingh@chromium.org> <20200326142823.26277-5-kpsingh@chromium.org> <2241c806-65c9-68f5-f822-9a245ecf7ba0@tycho.nsa.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2241c806-65c9-68f5-f822-9a245ecf7ba0@tycho.nsa.gov> 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 08:27, Stephen Smalley wrote: > On 3/26/20 8:24 PM, James Morris wrote: > > On Thu, 26 Mar 2020, KP Singh wrote: > > > > > +int bpf_lsm_verify_prog(struct bpf_verifier_log *vlog, > > > + const struct bpf_prog *prog) > > > +{ > > > + /* Only CAP_MAC_ADMIN users are allowed to make changes to LSM hooks > > > + */ > > > + if (!capable(CAP_MAC_ADMIN)) > > > + return -EPERM; > > > + > > > > Stephen, can you confirm that your concerns around this are resolved > > (IIRC, by SELinux implementing a bpf_prog callback) ? > > I guess the only residual concern I have is that CAP_MAC_ADMIN means > something different to SELinux (ability to get/set file security contexts > unknown to the currently loaded policy), so leaving the CAP_MAC_ADMIN check > here (versus calling a new security hook here and checking CAP_MAC_ADMIN in > the implementation of that hook for the modules that want that) conflates > two very different things. Prior to this patch, there are no users of > CAP_MAC_ADMIN outside of individual security modules; it is only checked in > module-specific logic within apparmor, safesetid, selinux, and smack, so the > meaning was module-specific. As we had discussed, We do have a security hook as well: https://lore.kernel.org/bpf/20200324180652.GA11855@chromium.org/ The bpf_prog hook which can check for BPF_PROG_TYPE_LSM and implement module specific logic for LSM programs. I thougt that was okay? Kees was in favor of keeping the CAP_MAC_ADMIN check here: https://lore.kernel.org/bpf/202003241133.16C02BE5B@keescook If you feel strongly and Kees agrees, we can remove the CAP_MAC_ADMIN check here, but given that we already have a security hook that meets the requirements, we probably don't need another one. - KP > > > >