From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CF4BC43334 for ; Mon, 13 Jun 2022 18:17:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0F3A8D01B4; Mon, 13 Jun 2022 14:17:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBECF8D01A1; Mon, 13 Jun 2022 14:17:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D87AA8D01B4; Mon, 13 Jun 2022 14:17:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C95328D01A1 for ; Mon, 13 Jun 2022 14:17:55 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9B34980B8C for ; Mon, 13 Jun 2022 18:17:55 +0000 (UTC) X-FDA: 79574021310.23.31BC2E2 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf27.hostedemail.com (Postfix) with ESMTP id 2F89D4008E for ; Mon, 13 Jun 2022 18:17:55 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id i1so5762719plg.7 for ; Mon, 13 Jun 2022 11:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=THDzxPXwnrXgbH5TVo5+XbAuUhPSiF5R1K9yx5fzgl4=; b=I9R3QCS8x2h9rOtgVNPZ+kQdPg0f1EhqgoMkf4TTQQXrzl/+IrBZA+lY4Wj9oyvAsO 3G7QqjbjT9sZWOuyhBAQ8XiYweHVz3mMo7ntib1AkO0DABvSHHMbP7GIQosE3IXbSLoH IMSdXELOOafuDokRP60++MMSuMhPbciV2uTumfENBfPvCLKuWFyO+yabUB0Qz9l0R+Bh FtmUid8oGTVMZVzxe3wzlWfcXqrRKp46yFaXq5vlpoDhxCC+AJqft5hi91L5eCGptyqm LWRMAsniyXmkW709BmrIwNv08RcRcUzjFn0UtdHGPu49vqEiweDeTnnWReDEmwxOGAqy ez2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=THDzxPXwnrXgbH5TVo5+XbAuUhPSiF5R1K9yx5fzgl4=; b=QpJtT+GPiOSS1h4f3+gcEklNGA5Wz0gqlDfA8FRUg70TsOzjpM46/PDACRd/kI8ROY iywUOCPM///yNOUqy/3SasR22jUZvDmvyv/68KkZ9hJXrz6/OIsAo6SNlZgi0BtuopfO kAUjDGWHlSEBkRHQFY0ERam8ee/g2o1fapCAkdcWwLhP27uCwerwTe99RBDzoFolloYY uYpCg5oC6AGLQNvwjsTnfJHEbockLPTDQG6WUWe83n76Tmm8rr4yv2u+GkKcV/guAUhI UcV4mPysxmO/Dg99qBa5+bC6VRfxOFHIC8FqruOtIm+uPBjOrZ3K4USE6utIg41wH5s+ YE4A== X-Gm-Message-State: AJIora8/B6V55USWNT+j2SM9SiWK4H22K+c0aZKPeqG5fwKvo5KM0kN8 +vOrCWkDU0AKFEuPp/n4IEhqYzT9CccD25Mxzpxv X-Google-Smtp-Source: ABdhPJxr+HkD+ptO5rppukZz7x6VARn4tsHmirXuW0Vt35nic5PNRbZOk9JJnwL2Pb76zYiZ3aCUbShyIS74UydsHIk= X-Received: by 2002:a17:902:ef43:b0:168:dbf0:bc47 with SMTP id e3-20020a170902ef4300b00168dbf0bc47mr587340plx.6.1655144273994; Mon, 13 Jun 2022 11:17:53 -0700 (PDT) MIME-Version: 1.0 References: <20220125143304.34628-1-cgzones@googlemail.com> In-Reply-To: From: Paul Moore Date: Mon, 13 Jun 2022 14:17:43 -0400 Message-ID: Subject: Re: [RFC PATCH] mm: create security context for memfd_secret inodes To: =?UTF-8?Q?Christian_G=C3=B6ttsche?= Cc: SElinux list , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, Stephen Smalley , Eric Paris , Andrew Morton , linux-mm@kvack.org, Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655144275; a=rsa-sha256; cv=none; b=Ssb1NzuPLMHxTRaOtboRQvBUbzv/mPQrALLoMEh07d+dlJxIovlVNbudad3ZMR4lXGkXre ASf0XiUtgmOppt96pVUXSmfMbWkxH4kQQrxaj5O5SuBcnlB0FXlFWU9iBZW6psXNveY8qn 637F3PqM0lwJyCna/YUa0Wj/S1aNwfg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=I9R3QCS8; spf=none (imf27.hostedemail.com: domain of paul@paul-moore.com has no SPF policy when checking 209.85.214.180) smtp.mailfrom=paul@paul-moore.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655144275; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=THDzxPXwnrXgbH5TVo5+XbAuUhPSiF5R1K9yx5fzgl4=; b=P4zjoG86fWvZEqB71LzrFT/a22Qv40V5tmwnTe9rW31BYP6Zyb5kYO28DeU8zlwUDvPc2p LwOO4FEqBcDyaNRQDS41N2/Rit8qvfwrDg6R4/JPZAuqzQklv3rHAL4zkoyM6SKE1CYt4Q zPGCmZxkyIszCYeo3+3nqH0lyWXe2G4= X-Stat-Signature: 86dy7htst1zdxjbby3kc4h8nc6e3px9e X-Rspamd-Queue-Id: 2F89D4008E Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=I9R3QCS8; spf=none (imf27.hostedemail.com: domain of paul@paul-moore.com has no SPF policy when checking 209.85.214.180) smtp.mailfrom=paul@paul-moore.com; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1655144275-35871 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 7, 2022 at 4:10 PM Paul Moore wrote: > On Mon, May 2, 2022 at 9:45 AM Christian G=C3=B6ttsche > wrote: > > On Thu, 17 Feb 2022 at 23:32, Paul Moore wrote: > > > On Thu, Feb 17, 2022 at 9:24 AM Christian G=C3=B6ttsche > > > wrote: > > > > On Thu, 27 Jan 2022 at 00:01, Paul Moore wrot= e: > > > > > On Tue, Jan 25, 2022 at 9:33 AM Christian G=C3=B6ttsche > > > > > wrote: > > > > > > > > > > > > Create a security context for the inodes created by memfd_secre= t(2) via > > > > > > the LSM hook inode_init_security_anon to allow a fine grained c= ontrol. > > > > > > As secret memory areas can affect hibernation and have a global= shared > > > > > > limit access control might be desirable. > > > > > > > > > > > > Signed-off-by: Christian G=C3=B6ttsche > > > > > > --- > > > > > > An alternative way of checking memfd_secret(2) is to create a n= ew LSM > > > > > > hook and e.g. for SELinux check via a new process class permiss= ion. > > > > > > --- > > > > > > mm/secretmem.c | 9 +++++++++ > > > > > > 1 file changed, 9 insertions(+) > > > > > > > > > > This seems reasonable to me, and I like the idea of labeling the = anon > > > > > inode as opposed to creating a new set of LSM hooks. If we want = to > > > > > apply access control policy to the memfd_secret() fds we are goin= g to > > > > > need to attach some sort of LSM state to the inode, we might as w= ell > > > > > use the mechanism we already have instead of inventing another on= e. > > > > > > > > Any further comments (on design or implementation)? > > > > > > > > Should I resend a non-rfc? > > > > > > I personally would really like to see a selinux-testsuite for this so > > > that we can verify it works not just now but in the future too. I > > > think having a test would also help demonstrate the usefulness of the > > > additional LSM controls. > > > > > > > Any comments (especially from the mm people)? > > > > Draft SELinux testsuite patch: > > https://github.com/SELinuxProject/selinux-testsuite/pull/80 > > > > > > One naming question: > > > > Should the anonymous inode class be named "[secretmem]", like > > > > "[userfaultfd]", or "[secret_mem]" similar to "[io_uring]"? > > > > > > The pr_fmt() string in mm/secretmem.c uses "secretmem" so I would > > > suggest sticking with "[secretmem]", although that is question best > > > answered by the secretmem maintainer. > > I think this patchset has been posted for long enough with no > comments, and no objections, that I can pull this into the > selinux/next tree. However, I'll give it until the end of this week > just to give folks one last chance to comment. If I don't hear any > objections by the end of day on Friday, June 10th I'll go ahead and > merge this. I didn't see any comments so I just merged this into selinux/next. Thanks for your patience Christian. --=20 paul-moore.com