Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2452664ybl; Thu, 9 Jan 2020 13:03:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwSaynB/MbGqxgaz8xQ12HwrLbHgs2sb29b/Bt2JzdH4C/yU1L7ORrv5D6QylrHPNgZVm4n X-Received: by 2002:aca:ab50:: with SMTP id u77mr4600497oie.36.1578603791789; Thu, 09 Jan 2020 13:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578603791; cv=none; d=google.com; s=arc-20160816; b=rP4s+tjeevDVzOFqhmAAIJHzgkPYK290hEwF4ZPfmzGd+7bgA64IGSEF6Kssya+lZC GXZaKVdeKC9OvY/hQ+hPMncikssxYoizaymJ1Aj8gV8XknHx0282t4YEkFlMoTqSPPv3 NndTGwmpTU4eRLrCJDzFjcDtz9JybGwJBvD4VGHc+wbtmDw0CJ+ksZQMPSWq0/qiFeIN FfsWQ/C3tZlE+g9xW+06lABnCOALvyXwUjiFBISrLMUHKzjOHB+VkKGj8g91LDtgUmu0 wSPPQAaQriuwKG4Yit6zMMdlmIbRGe4OxRKldKKBq09jb0ormt7DZFIrAHOWkOu1c/pj jLxQ== 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:date:from:dkim-signature; bh=VCnERlNOb8YhgeYQ/pqHHRSiRgRe3Wo0NvX3JaaKcS8=; b=D4GsMNGrR3g6MKp+s0MfHFNe2UpwJkHEjLmmgSFTu43prn89cNNggPvna74Oxdfy85 oR5ZNVWH5zh8I3yusqOR5StQhH5y0qXixqIDgXyjVR+9ejHjeg8PsxDFFl1DTgiKtLXq 7hQ7GCiIGbTD1fKgqiWQk59Dj3JngShg/9VR1CMhwWSWU98r+eNgR4F4ZJHrcd7gNcdg vKBInVceTa4ick5kldCp5uqOofZU5Uj64RBaFBP0pw2Yr+O18pyGHfYBwAYs8hwAH6Q6 TdRIGhg13bZ8weC2bnEN4Gz+fCUaHxv0NVeT8PcGigmkBcK9tyH9mqiv++tQN4D+rcdz b+QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DhUG7DVS; 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 p20si4952773otk.73.2020.01.09.13.02.59; Thu, 09 Jan 2020 13:03:11 -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=pass header.i=@chromium.org header.s=google header.b=DhUG7DVS; 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 S2388743AbgAITLf (ORCPT + 99 others); Thu, 9 Jan 2020 14:11:35 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46760 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388682AbgAITLf (ORCPT ); Thu, 9 Jan 2020 14:11:35 -0500 Received: by mail-wr1-f67.google.com with SMTP id z7so8523308wrl.13 for ; Thu, 09 Jan 2020 11:11:33 -0800 (PST) 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:in-reply-to:user-agent; bh=VCnERlNOb8YhgeYQ/pqHHRSiRgRe3Wo0NvX3JaaKcS8=; b=DhUG7DVSwPgwTWwTuQqa+9ac/15/zkq8KDq1LyXt9P2r/hB4jgPF/wdkpAwwitW1w/ Yw1ncdxhj1h1xmR3bnTVGYgx9vqeZ9TOp8Q5YfaeApe9I12PJZzgFMURzpY+OPgI15a4 Fexvw8F5wcZmKpTYiVdv+PZVy/+Kym+/wM6Mo= 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:in-reply-to:user-agent; bh=VCnERlNOb8YhgeYQ/pqHHRSiRgRe3Wo0NvX3JaaKcS8=; b=PH9NgD2nQ70TiSnqj8FASn+yeJX7cHnozqF9iLG6TBweda5FC7g+a7nHECcRfhertd 9GLoxRIdCjYf2Bvy6xeHi16q+AbetJct4gdOtRg3U8rWcNLIFfOrColOrF34mZTpMtzU hu1n7wH6u2x1n4maosUenMgncf3ciWqR9IcOZGdMH+dMIolPnMKYqOe9n/FaMs57KA0+ t4xZmzGSjz1ZWsW4n/7BBeRv2+uB+VEmDabU1pC7NC6ZbTkMkO+j4MA22eoXq5fNoMNk PI0ReGJ5fasgVaYI6NRMEwfk4n5SwjzojThwalDMMwwIS5GmXhbPpwP5IraKDIsmhu0s 8PUg== X-Gm-Message-State: APjAAAVxoSA/uXCmlDPgynJ9QNgCIAzNhVZszc9jOxwPEU1RaR9Dtdrh X1bq6cZvKopBX5PK4RAbltDp4Q== X-Received: by 2002:adf:f5cb:: with SMTP id k11mr11962302wrp.71.1578597092527; Thu, 09 Jan 2020 11:11:32 -0800 (PST) Received: from chromium.org (77-56-209-237.dclient.hispeed.ch. [77.56.209.237]) by smtp.gmail.com with ESMTPSA id q3sm3689862wmc.47.2020.01.09.11.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 11:11:31 -0800 (PST) From: KP Singh X-Google-Original-From: KP Singh Date: Thu, 9 Jan 2020 20:11:48 +0100 To: James Morris Cc: Stephen Smalley , Kees Cook , Casey Schaufler , open list , bpf , linux-security-module@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Thomas Garnier , Michael Halcrow , Paul Turner , Brendan Gregg , Jann Horn , Matthew Garrett , Christian Brauner , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Florent Revest , Brendan Jackman , Martin KaFai Lau , Song Liu , Yonghong Song , "Serge E. Hallyn" , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Nicolas Ferre , Stanislav Fomichev , Quentin Monnet , Andrey Ignatov , Joe Stringer , Paul Moore Subject: Re: [PATCH bpf-next v1 00/13] MAC and Audit policy using eBPF (KRSI) Message-ID: <20200109191148.GA1894@chromium.org> References: <20191220154208.15895-1-kpsingh@chromium.org> <95036040-6b1c-116c-bd6b-684f00174b4f@schaufler-ca.com> <201912301112.A1A63A4@keescook> 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 10-Jan 05:11, James Morris wrote: > On Wed, 8 Jan 2020, Stephen Smalley wrote: > > > The cover letter subject line and the Kconfig help text refer to it as a > > BPF-based "MAC and Audit policy". It has an enforce config option that > > enables the bpf programs to deny access, providing access control. IIRC, in > > the earlier discussion threads, the BPF maintainers suggested that Smack and > > other LSMs could be entirely re-implemented via it in the future, and that > > such an implementation would be more optimal. > > In this case, the eBPF code is similar to a kernel module, rather than a > loadable policy file. It's a loadable mechanism, rather than a policy, in > my view. > > This would be similar to the difference between iptables rules and > loadable eBPF networking code. I'd be interested to know how the > eBPF networking scenarios are handled wrt kernel ABI. > > > > Again, not arguing for or against, but wondering if people fully understand > > the implications. If it ends up being useful, people will build access > > control systems with it, and it directly exposes a lot of kernel internals to > > userspace. There was a lot of concern originally about the LSM hook interface > > becoming a stable ABI and/or about it being misused. Exposing that interface > > along with every kernel data structure exposed through it to userspace seems > > like a major leap. > > Agreed this is a leap, although I'm not sure I'd characterize it as > exposure to userspace -- it allows dynamic extension of the LSM API from > userland, but the code is executed in the kernel. > > KP: One thing I'd like to understand better is the attack surface > introduced by this. IIUC, the BTF fields are read only, so the eBPF code > should not be able to modify any LSM parameters, correct? > That's correct, the verifier does not allow writes to BTF types: from kernel/bpf/verifier.c: case PTR_TO_BTF_ID: if (type == BPF_WRITE) { verbose(env, "Writes through BTF pointers are not allowed\n"); return -EINVAL; } We can also add additional checks on top of those added by the verifier using the verifier_ops that each BPF program type can define. - KP > > > Even if the mainline kernel doesn't worry about any kind > > of stable interface guarantees for it, the distros might be forced to provide > > some kABI guarantees for it to appease ISVs and users... > > How is this handled currently for other eBPF use-cases? > > -- > James Morris > >