Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5100614ybb; Tue, 24 Mar 2020 10:58:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsX2Hndv5oRxjq/oSx/lorxmn8fOZW+URebN8wyzNM5HZnhxGkitOJcNlFdo9B740ZHgPVn X-Received: by 2002:aca:5444:: with SMTP id i65mr4145745oib.101.1585072726747; Tue, 24 Mar 2020 10:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585072726; cv=none; d=google.com; s=arc-20160816; b=rIQk1VB2mkFMs3ZzjIkPiTpSlqREs6dMH82MoOqj0v8QDdowOectIe3IL+1F+hY1tc jtN/BubOZX4tRmtguPsCLBwgAvQ9QdLotBB/VOKtDhVv/NuXlr0vCyOI9WNYhhgwMbqv tziySXRdMvFRdyoAe5XdQyp2Rwl9dyyDQ3zE3emWYfpowLbFsoj721XuPL2A9dSN6u1c 8meqBFLm/6wx4Oe3e0n60nJrv2z/n3kX2NrNVU8MjtTPUNAF8Y45P0x8OlP4J1mqzNlf J7u3BlH39y7GHgs/EZZseXs4S7lqFKGJ4CPQ2bE6lg7qXU39anTNho0UDv/HmtZRpGSj VPuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JOJivn/BftzEZ5IpmOaohAsBUyD+vjO3m8vH92Fp/Bo=; b=kShC77mS7/sWc9TyAe4EuXE6Pp3bh1mGhzRmWJseTLW9DXFOPuJRWk2C335yLX8+Xw qJfH+VU7pEZ92UjaLd64cbWEC72T+LRaWYsnJ95GeoZRxGunWAHhME1+yxI1syDTSz8b 4Gxxjnp42cumxahHvkwrNs+2pj5T59jX/VQz0H1FgsMVEV0aXymSwfzY3G53khlvWSoR KkWUXQo6jKTYcF3AX/YtWqQO4WE94CvH1Yh8bi5UNuSECG1M462zwKzrfAw68Ext44jw 3d50MssWUoHhfX1+2A/L9c1BaSbZV3Z7BVNnLMO035evMoxh/7h5iAn5XfrVSkMYTqt1 /v6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A7eeA9ij; 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 g22si9519891otn.56.2020.03.24.10.58.34; Tue, 24 Mar 2020 10:58:46 -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=A7eeA9ij; 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 S1727903AbgCXR5t (ORCPT + 99 others); Tue, 24 Mar 2020 13:57:49 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41762 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727257AbgCXR5t (ORCPT ); Tue, 24 Mar 2020 13:57:49 -0400 Received: by mail-pf1-f193.google.com with SMTP id z65so9672657pfz.8 for ; Tue, 24 Mar 2020 10:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=JOJivn/BftzEZ5IpmOaohAsBUyD+vjO3m8vH92Fp/Bo=; b=A7eeA9ijeTau3nSmfOv/vILZI4/00pn6laDCAOb2Arw/2gf6gTqgjGnsrE+FigWfTx OfmC8WZBDn6Er2e6pPSl5GPWfxWF040jR6ZWhQCaqfOIY4l38DEKzI2ZTFuuFC2ZqlxH C3F1G8U5/B4fUtZn9hTCrn/vYp7NW9LCDRWS4= 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:content-transfer-encoding :in-reply-to; bh=JOJivn/BftzEZ5IpmOaohAsBUyD+vjO3m8vH92Fp/Bo=; b=Gt9ICaDCE3OnlQyQrMRj2BgXv7Sx8Bv5rs4Zq+RH3K+kdfNW7qAo0ywhePAyh6mR0c ZJS4PhGYo4eEuXDmeUX+NTSA7p9fnSAwd2VdSdeKi5wOa/v3FnzzLuxL90n/LJjrWALb j6JssebtbkDsDu+xNJ7zQonDAiUH4DLlhbASYRtQNO9ZqABokF6n2v2hAbiYZK/im+Gd 7zByf6mQpU1yy63UEZNUXq3W9qf5TSTNrpNDGVsjl38/89G7XlIqIG797n77IyQiVgKO gQaSVjsU2nnUBrGKfZc1mLqkk1OCEa7JcRTvFucHkT15/cujHQ4pdGOrzdtpqdwJLgDl HjUg== X-Gm-Message-State: ANhLgQ2ot638N4IrVgDF8jrGrb58XfwOPSxK5s4nirnElW/z+/hk2lsf 2fbFdOjSr1a/d8XJ5sBSjty0pA== X-Received: by 2002:a63:ce42:: with SMTP id r2mr29908453pgi.106.1585072667397; Tue, 24 Mar 2020 10:57:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k3sm15204752pgh.34.2020.03.24.10.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:57:46 -0700 (PDT) Date: Tue, 24 Mar 2020 10:57:45 -0700 From: Kees Cook To: KP Singh Cc: Stephen Smalley , Casey Schaufler , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, LSM List , Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , James Morris , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman Subject: Re: [PATCH bpf-next v5 5/7] bpf: lsm: Initialize the BPF LSM hooks Message-ID: <202003241056.C28E520@keescook> 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> <20200324145155.GB2685@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200324145155.GB2685@chromium.org> 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 03:51:55PM +0100, KP Singh wrote: > On 24-M?r 10:51, Stephen Smalley wrote: > > On Tue, Mar 24, 2020 at 10:42 AM KP Singh wrote: > > > > > > On 24-M?r 10:37, Stephen Smalley wrote: > > > > On Mon, Mar 23, 2020 at 9:52 PM KP Singh wrote: > > > > > > > > > > On 23-M?r 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= 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 worse... > > Yeah, we do add BPF as the last LSM in the default list. So, I will > avoid adding LSM_ORDER_LAST for now. FWIW, this is my preference as well. If there ends up being a stronger need, then we can implement LSM_ORDER_LAST at that time. -- Kees Cook