Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp798904pxb; Thu, 17 Feb 2022 15:13:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN1qzC9HV/7EfFSshd+iye3VR9YObnLQ2rMHqCtgBzYb6vV0ZIYbdv6Eb+nGe4qQtPZwpE X-Received: by 2002:a17:90a:1657:b0:1b8:a705:34ff with SMTP id x23-20020a17090a165700b001b8a70534ffmr5236940pje.223.1645139599303; Thu, 17 Feb 2022 15:13:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645139599; cv=none; d=google.com; s=arc-20160816; b=hWQfi/eumMmbt+sPMOS39hqjyGOPLz0v0rG1qwRkhUSAzd/RzBfM1gTgXDnZ1ca2pu 4QaFLsnJZ9ghGkLa2HYfenCWQm5uv9ILILIpxsP4AOF6yj8FnOAZPZMmi1FBBk/tvEYO NNEuEfJ9mSD7c1MN/5a0V4e69lQT6p8Sc79Fz2BZwBKdNcSvKUKfKWAuGhWa4gVZxjZv ma5J/DN5QeRVK7QybGGrLDJ1zxvH5Zl+eAU8ScPWBAnpojPJ6sJ5a/ykJ8empvccL/3c il6CQanibW37W9jCJO1JMc5UZb9Vr3TgCsMGzDHzQ4lYxUM/R2u3PiiYXz2mDiv1xXDc Nztw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bzVS3GxQBLj2+ZoHNymWmW7fgxIcXLRqtnHSkBFdVIo=; b=N/NYXg2IOa9YTFjW5MgiekIdEx/h0EhvUy93zZpYvDO+fE2PAEzdM2MlQdL2TiuwAy prRY3j5KYPYKuJLQy7kCysT1aGgxy4Zw5FahZJEpUqHGapKEXsYIVkuqetXkch2QdpqJ aPLXsRepXynefzIzM6JuE+/gYg19mxhPiYBnWqPBlYMSzn1iKrZ43k4P/jb3dnQtKZuM U/EUAD7o/jmEJvADUDUcX2velmodgkl6oqMPcKVevlFQs9usJk0RPTYMeeTUR5/f1QpY k2YVbCBT017/n7s7fvdodrS4HhP6vsBIr8nwxaRZHu9+t2hVTx5kiZiftf54vLQ0EMjB xWEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=fYu1z8wd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s16si16840163plg.52.2022.02.17.15.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:13:19 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=fYu1z8wd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1ABBF2503B6; Thu, 17 Feb 2022 15:03:42 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343884AbiBQWdI (ORCPT + 99 others); Thu, 17 Feb 2022 17:33:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343879AbiBQWdH (ORCPT ); Thu, 17 Feb 2022 17:33:07 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE5C1688EA for ; Thu, 17 Feb 2022 14:32:52 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id f17so12266502edd.2 for ; Thu, 17 Feb 2022 14:32:52 -0800 (PST) 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=bzVS3GxQBLj2+ZoHNymWmW7fgxIcXLRqtnHSkBFdVIo=; b=fYu1z8wdXTgQuGm083cZUw7N/B0Y+YjzhkPbVyYrvjpCB7OG1Jlwq4irqtPlNwlxF5 oupo5/AMfqd0Y9DTn8VtlJj7ivOTw91JToHP0pSrnIfUp14Dm5+qB8PxSha0Jx8h1vrm 76ZdMJcWbPU78mJS6ATFwleKjMn9WMswJA/XfJOTkyOvfmqshMJHPW/jIR0mvzDAllfU uqpuHEniPhzvXYZ3iaiaInLz1By6gNH9ESuWUQL8QtW6VwxVA1DldtvbmcE26FkKlh8y eDYYGlBGZ6twfpS1bzfI01e6YJ7OywisgT/QBPrr2z8pS6E5TXCS/urpRw0FghoqKak0 gsaA== 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=bzVS3GxQBLj2+ZoHNymWmW7fgxIcXLRqtnHSkBFdVIo=; b=kORqU6t4ME4za+BIFrkGpaCkiQKG+1KJG8oN3LYD7/3LjCgdZDWrCrIFd0oAifR6tc 8/GvBnmCeyIcV9Rkx60G0QkXp7DmBxOqgjLBxBPIdBLU6I3o123ObCvfXdh83YzfOpO+ vUnEo8GMkiSOJD3VF9UwABYkHipJhp/tqbHdEBrKL6DHzMDVD38cSsgsJm+RGDL6Txt5 NSKfqwlPH8+W0PKDwRtwRZQjcWKZV5ESdsltF+hTmPyG4tosdVr4I6DxV8XtdGnvcoTv TaXi3HkN2zXHjzBWM3nUUbVv03olZXfcGgBdP90welsAu2qBgRZm68L4zKxFvMZb0jsZ F4hQ== X-Gm-Message-State: AOAM532/k1pmtuPUjaHHgEjsJ7g0ab38dJ45pvgiHZSBstdJWwnM7IRs Oeh0ruA7Y6gPreIj9lTQBtStKTgYJN8gFtrpZcrN X-Received: by 2002:a05:6402:3487:b0:40f:fa53:956c with SMTP id v7-20020a056402348700b0040ffa53956cmr5034224edc.22.1645137170677; Thu, 17 Feb 2022 14:32:50 -0800 (PST) MIME-Version: 1.0 References: <20220125143304.34628-1-cgzones@googlemail.com> In-Reply-To: From: Paul Moore Date: Thu, 17 Feb 2022 17:32:39 -0500 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@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 17, 2022 at 9:24 AM Christian G=C3=B6ttsche wrote: > On Thu, 27 Jan 2022 at 00:01, Paul Moore wrote: > > On Tue, Jan 25, 2022 at 9:33 AM Christian G=C3=B6ttsche > > wrote: > > > > > > Create a security context for the inodes created by memfd_secret(2) v= ia > > > the LSM hook inode_init_security_anon to allow a fine grained control= . > > > As secret memory areas can affect hibernation and have a global share= d > > > 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 new LSM > > > hook and e.g. for SELinux check via a new process class permission. > > > --- > > > 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 going to > > need to attach some sort of LSM state to the inode, we might as well > > use the mechanism we already have instead of inventing another one. > > 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. > 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. --=20 paul-moore.com