Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4928185ybb; Tue, 24 Mar 2020 07:52:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuh2r39Qg6p6muBzpWFHDqokmxi5qaHllrmWwrRoAdlZrxFarcaB6VtyPLwJz2Di6rVaXrQ X-Received: by 2002:aca:646:: with SMTP id 67mr3530235oig.4.1585061553775; Tue, 24 Mar 2020 07:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585061553; cv=none; d=google.com; s=arc-20160816; b=oAqZ2EBAFgBrswdecD9HkXPlxZMfsS72uoP+Da6RPa/ClLUCm791gTfA/k3M3xm09a p1zn3/lIi7dsCdPzYM17A5LqkeTpCUNJigt3PCYVApiXkg4QQw7nTv+Y2RVSsbps25Lw WhbyzM6YmkY+N8UQ8qhbiBudghxyHIWHyLbSePmF5IeItKZz22e6HI0uCdI3BlHEjNRX 0ChiNlILu1yon4qJdzCnjn6gV/cs5o53JkwglOYGsF/XPADcHY9NRbJFMpGfYOBc5JbL 1+WcntU4585X2EeleqR0ND10lh8Wza8OB697drLtQouBw7S46l4yt+DjFrqkKmh4UQQQ tnjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vPW3tS8ZdMqCvi7XvsqrZo8CXz6jQvmwEfRH7GXH4C4=; b=ZG1voJtVQaYCY4TiVLzd8R4uIuqYYhEVyJ/YweYTiIdynsEELsUorEQVkzFjph39K2 x8CYFZ5LKVOJn/Xy4E++crRXvjstDXBgOnTDBd4kE08K113coKfUMXVTYOKz6bz93aRP tyJQBkS0hYtd4hJHbrXHfBgsJARWEGkZYUqKw6ip+fBh99flQeh5WaIqGyrnhjGgozKi E7rBLp+ryHmUVf95Xf/zRKlER6/CO0Qq2cTHu3IZTh6lxU3aFTMUfNyRPUgylhWUbw/t GUHAvV+rcu+tx1uVP0VzXeMzHi46AiMgsETxRaSRPNshqCf8P/n0l1DtY4+qNkSO/eQc s4sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="tuKVjZX/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94si8880104otb.114.2020.03.24.07.52.21; Tue, 24 Mar 2020 07:52:33 -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=@gmail.com header.s=20161025 header.b="tuKVjZX/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbgCXOuZ (ORCPT + 99 others); Tue, 24 Mar 2020 10:50:25 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:41375 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbgCXOuY (ORCPT ); Tue, 24 Mar 2020 10:50:24 -0400 Received: by mail-ot1-f66.google.com with SMTP id f52so273887otf.8; Tue, 24 Mar 2020 07:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vPW3tS8ZdMqCvi7XvsqrZo8CXz6jQvmwEfRH7GXH4C4=; b=tuKVjZX/5WKnCjHFD8Z3PwFFqG2Acy1CnjbEMB1kkgc509hAf4q25KWhwp5sWFT9IC 3l6wPcqGdMkc1pCKLTVjsuKVhkmbbJ1TkKtwhp5kCVwrDu91CmRMnsE5hxf7Rsb8DN7X 3Z9SRAhha2FvxA0nRxIPy4sJLdvIqy5TGh7zzo4CwKDEo3uzeWtQFH8i377KKb8tnj27 0LwrEDK2IvdQiMDYaaGd/CT8ux2lVhJbP6z2jCyE4oyfL53BEi9b7wWLmvUgT21pCnBb N+90Q+dTTqS2K1PUk1SD09J2S4gHqhxhDKNoxhu82QBoto470UqRSr03PMMTOOoAYePl a84Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vPW3tS8ZdMqCvi7XvsqrZo8CXz6jQvmwEfRH7GXH4C4=; b=mHfMWzO7GA26ml95TkvXcVQCNul3OC5ATecU8kDGgYDDR3jQE4l1nFBcjTWU26gEYT GU52GnEZPpR/+gw0SVqupHTXS9lbW8GLyyzLfdPlFWmAqbFG9xhS5+GZzMxfwEiBYH2C pkLJqOUn0MOBArh/PX2KM+Qit9cFq6WnzAI92P9NXKMSsrXL6oaxPybxllGVI6KV3MY8 MI28Z9tULxV/xZ+PnKQHklp43rL0dkeWuk/i7Fhy+2VuP9Vjs1TeZyVgBqU3Orfxr7vF zESmsE0x2cd8UB55QieHjXgDlVi4bS0XmwSWF5jI1R0TYCT1uE5qmG7T+WFZR/peaCIK ++lw== X-Gm-Message-State: ANhLgQ39a0ToDQ9/q9bROcceY0TgWpfEhvNg5i8uKwQ3NZyqkOmMQeWI Hf4rVF+GaxJXpcj+064JWVJO2KnWz2BHELcNRmU= X-Received: by 2002:a9d:7dc4:: with SMTP id k4mr21005538otn.89.1585061424075; Tue, 24 Mar 2020 07:50:24 -0700 (PDT) MIME-Version: 1.0 References: <20200323164415.12943-1-kpsingh@chromium.org> <20200323164415.12943-6-kpsingh@chromium.org> <6d45de0d-c59d-4ca7-fcc5-3965a48b5997@schaufler-ca.com> <20200324015217.GA28487@chromium.org> <20200324144214.GA1040@chromium.org> In-Reply-To: <20200324144214.GA1040@chromium.org> From: Stephen Smalley Date: Tue, 24 Mar 2020 10:51:32 -0400 Message-ID: Subject: Re: [PATCH bpf-next v5 5/7] bpf: lsm: Initialize the BPF LSM hooks To: KP Singh Cc: Casey Schaufler , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, LSM List , Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , James Morris , Kees Cook , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2020 at 10:42 AM KP Singh wrote: > > On 24-M=C3=A4r 10:37, Stephen Smalley wrote: > > On Mon, Mar 23, 2020 at 9:52 PM KP Singh wrote: > > > > > > On 23-M=C3=A4r 18:13, Casey Schaufler wrote: > > > > Have you given up on the "BPF must be last" requirement? > > > > > > Yes, we dropped it for as the BPF programs require CAP_SYS_ADMIN > > > anwyays so the position ~shouldn't~ matter. (based on some of the > > > discussions we had on the BPF_MODIFY_RETURN patches). > > > > > > However, This can be added later (in a separate patch) if really > > > deemed necessary. > > > > It matters for SELinux, as I previously explained. A process that has > > CAP_SYS_ADMIN is not assumed to be able to circumvent MAC policy. > > And executing prior to SELinux allows the bpf program to access and > > potentially leak to userspace information that wouldn't be visible to > > the > > process itself. However, I thought you were handling the order issue > > by putting it last in the list of lsms? > > We can still do that if it does not work for SELinux. > > Would it be okay to add bpf as LSM_ORDER_LAST? > > LSMs like Landlock can then add LSM_ORDER_UNPRIVILEGED to even end up > after bpf? I guess the question is whether we need an explicit LSM_ORDER_LAST or can just handle it via the default values for the lsm=3D parameter, where you are already placing bpf last IIUC? If someone can mess with the kernel boot parameters, they already have options to mess with SELinux, so it is no wor= se...