Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4694447pxj; Wed, 12 May 2021 11:03:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVmYf8PzQ4kPaOyS7JIegyqzFWHQ2oUfnlf7FglXfQht1UEoxic37h7G2L7QL+lYl+fhL1 X-Received: by 2002:a9d:6255:: with SMTP id i21mr28378752otk.284.1620842633523; Wed, 12 May 2021 11:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842633; cv=none; d=google.com; s=arc-20160816; b=Wrz12ttzfpT9Xkg0gC855x9Ychsb9lhSi4n1vTuule5U1CEgPyFMuLKDruNsYi95O1 lgxpdw+Am+BMqNd8mucQJZje/Eu2Nlq+ERd26v4QDh24pi38kKKIEqCDkXQuItK+1z/S uKPsPkBFyrs04/aDrHxxwjBQmlq6NSYJoJnS209YhcHyLiQPpai+fREvde/tudWtyEYc XmTFDJl5dADQLMg29jZpaa1PB0tDEolPR6/wAxkCAZ3UF0s4EPSZ3mPO8PniqcWIrEVR M7CD/xWf9d1BLWJuLKpZP03UrlK/xlojockBnSi2QRlLXI5hbQ0OJgPDQZN9l+/x6jtp HXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=sTgvXuL0QyV3DWP7rJnz73UM1noGLdd9LQiIFFkdesM=; b=ZN/rYjD4MnX3y7qq1mbqyZnnZ42wl9kCb2GxnVAhFV6XQluE7vqjX7qemzq/wkTggG VbmhJ+j8JKOSH/H/4jbW9/Vr5rVvOf209NHSHrD8hPGVFhdgQEDX+NBlBhZqSQWo9Yg2 aPX3JrJ2IXmYU8GhQGFHSlXCWXeSVuPJfpjniRntGT3fFdQy125Xq4qOk90xTT0EADlh CGXSZd/dZdQCFLum+CGeIqqokuzGDzkpK7tJQAepCp4cGCGRv6jmdQqd1xUfWY4zf/hr Evi1kpp2AZV8UjrfiiFxsQ5OxPLTxmzns6dkXc2w2pm9/OYnwChXRmeIwnu6a742rM3t jAkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="ILRKGl/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si440431otq.248.2021.05.12.11.03.30; Wed, 12 May 2021 11:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="ILRKGl/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243469AbhELRuF (ORCPT + 99 others); Wed, 12 May 2021 13:50:05 -0400 Received: from sonic317-38.consmr.mail.ne1.yahoo.com ([66.163.184.49]:38607 "EHLO sonic317-38.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234046AbhELQTC (ORCPT ); Wed, 12 May 2021 12:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1620836274; bh=sTgvXuL0QyV3DWP7rJnz73UM1noGLdd9LQiIFFkdesM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject:Reply-To; b=ILRKGl/EIHUvQjhp8Z/kl2sjgVpMP1RDKh3CuccfjslVJQYHnqHtTNkeTHiVJkR9cQnbDdC3HL9+DLoQfJhcjCB6ocDEXTAh9l0rBArFe08jlwrZeWYEUMcEmNjI+dm2xQ4gbM0m/s2NCRJpIoWD/9pHs+CwJfc5A/ZIGE4DaAcDy/MpZtk7Eby1BT9GjOqNvpN2f/1tJ32fPyC6h2rw2Mkj8PQgGIeqJxKvP845zI4BIJVW9Vt/iHHzamwT/VM7JfVfD9BpzP2hR6s8tFf8fX7rD61FH/J0t2rwecGyZy8ZCb6ud3t0pizN0wQ4Z9KQ5m/e4gMmZ2hf+vSKFUtIFA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1620836274; bh=9zkzFpJhpAtKSS7dp81m3gO08jVTWzIIU41o5cVd1QD=; h=X-Sonic-MF:Subject:To:From:Date:From:Subject; b=riO/9yTMWiAOR3F2VfwmHuf8wv+kL1VYCecGPju58EecHRAs9CywkyiQGXWCP4opx4XrozrDbWCNKCN8c3AvVkJed71MregD+4Plpy4564hcezqKYdS/8Dz/QRFu712Mxn+N5apkd3VW4RqY06028meNsJ930KSRAZ7QWhktNwqL/e1IpM1d8lXZn+14Ht+Fz1bgHZVn2V1+7CMWpF4O+OPmY6Nb9zSIaap3K1FL0vxRmOnZCqwZPOaLgYfzlPam4W1Ty0esh1IJxfzSYz3mEaLc8BoNwanI/3gX4hpzkaCkG+pHd62RtWaNuTa8pkrv5cPjDsRTpz1dydbyBdMirg== X-YMail-OSG: u3eIsq0VM1mrdWqd1ddc3yi2FSJAQ4ntlInGeECmzJrk_SDLHdW6J_k8ZCquxd7 OiYa2lX6SplN0e2K9uf4CqoloD2.5_D5zwfJAcWjJAmAFq_I84XSvl.77YdT9abn2hvpYoa8.ch9 jaiJg5aqvOFCiWKdn_.BsERkiiqL16HqSVhYX.1CXskeVX5.0Zgo.74vkVLxKHvcELAg2nOHDQDy BdeexdMuHABDfG0wVOBFgTuS.VpFcMcYh70AHl2bN6vy8QfUaamWMGHjwuXY1kspO8lr_exoj0vG Mp.HZRJ7gMra3c6stz.XSR6K32tQNckEFyVZDdGkBBnoSXINRnk1UhJNyqXAPnvF05f6oj1orQHA NO59mWNhg1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-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Wed, 12 May 2021 16:17:54 +0000 Received: by kubenode575.mail-prod1.omega.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID aeedecbba43991c93baefb338f58092f; Wed, 12 May 2021 16:17:51 +0000 (UTC) Subject: Re: [PATCH] lockdown,selinux: fix bogus SELinux lockdown permission checks To: Ondrej Mosnacek Cc: Linux Security Module list , James Morris , Steven Rostedt , Ingo Molnar , Stephen Smalley , SElinux list , linuxppc-dev@lists.ozlabs.org, Linux FS Devel , bpf , network dev , Linux kernel mailing list , Casey Schaufler References: <20210507114048.138933-1-omosnace@redhat.com> From: Casey Schaufler Message-ID: <24a61ff1-e415-adf8-17e8-d212364d4b97@schaufler-ca.com> Date: Wed, 12 May 2021 09:17:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Mailer: WebService/1.1.18295 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/16) Content-Length: 2056 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/12/2021 6:21 AM, Ondrej Mosnacek wrote: > On Sat, May 8, 2021 at 12:17 AM Casey Schaufler wrote: >> On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: >>> Commit 59438b46471a ("security,lockdown,selinux: implement SELinux >>> lockdown") added an implementation of the locked_down LSM hook to >>> SELinux, with the aim to restrict which domains are allowed to perform >>> operations that would breach lockdown. >>> >>> However, in several places the security_locked_down() hook is called in >>> situations where the current task isn't doing any action that would >>> directly breach lockdown, leading to SELinux checks that are basically >>> bogus. >>> >>> Since in most of these situations converting the callers such that >>> security_locked_down() is called in a context where the current task >>> would be meaningful for SELinux is impossible or very non-trivial (and >>> could lead to TOCTOU issues for the classic Lockdown LSM >>> implementation), fix this by adding a separate hook >>> security_locked_down_globally() >> This is a poor solution to the stated problem. Rather than adding >> a new hook you should add the task as a parameter to the existing hook >> and let the security modules do as they will based on its value. >> If the caller does not have an appropriate task it should pass NULL. >> The lockdown LSM can ignore the task value and SELinux can make its >> own decision based on the task value passed. > The problem with that approach is that all callers would then need to > be updated and I intended to keep the patch small as I'd like it to go > to stable kernels as well. > > But it does seem to be a better long-term solution - would it work for > you (and whichever maintainer would be taking the patch(es)) if I just > added another patch that refactors it to use the task parameter? I can't figure out what you're suggesting. Are you saying that you want to add a new hook *and* add the task parameter? > > -- > Ondrej Mosnacek > Software Engineer, Linux Security - SELinux kernel > Red Hat, Inc. >