Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1758115pxj; Wed, 19 May 2021 13:13:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoSS0cHQR6q5eDqZ5RZcFQuWde/EBPtw4aaNz+w7Msg4X4QjpZa1nA4yeSzej2Yq81EO+U X-Received: by 2002:a92:ddc6:: with SMTP id d6mr792071ilr.51.1621455218232; Wed, 19 May 2021 13:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455218; cv=none; d=google.com; s=arc-20160816; b=LIGp7KLjLzJwPYm9nhBwituqVxuMVNqfNqaT2mfwGlc/2Qj3b46lH8kdYZtGUKqaU/ gXeBVj5T9RO0cXEYDEaF/PH+0VeFiBNuvw5aB0jZzMBEzbGIGwnG62N+763ukWvqjSwy kqrtpo7i3BS8yHr2Ys3dW3YhxFk6rofApHwZP8dj1QeKi+t5z47fkpL79eHUBqNEYCyq 5rII5zqoFb8a5qtoDF7a9weJ0e66wSXPkN7BU+llSsci7btGIkWusS6I1H5ZbigkRZMf aJqZC0fPo4xtkhTLjx/KItAq54kCoS7DWBSn77cloZ2hgKLOOzjkxvRnkb62/SLi9gOV JrFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2kcMHiUdBh2RX9lqzPjQo7AnDIczfIylBe4oy/anXE4=; b=bFMusDPnVs1DIk1IaijEDbw/oX1jolY5kiCufcRB7L9Glof7pKo6UM6PKVmRBcW+ST Kd1ceEAKAW02nqmnlInypMopwla3Yz/GFtMArj2cKqngnBcVWxJRj0JgtTKwk5Hcptuv CKkWzkcqvWiRRH/r6d3AwDMOSl45iFm7K9ILpDW1kzofFSmFw1zd7ZaXbgLMI/mrrC4+ /2QsLKCdhlxmnSoakFeZy6Dqi+s0bvNmN+9C2+mcP2z/ZhBpA0AxRJz4QxiBO8ecBNEo 3qhLWCTWvq8KUDpf3gWE89WGT+zE/Fg/jxlbKDFCDUyx0PAbLe4z+6TDmTYyOMp05qXe PHeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Ozr9QX2v; 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 z13si752576ilu.28.2021.05.19.13.13.25; Wed, 19 May 2021 13:13:38 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Ozr9QX2v; 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 S241893AbhESPY2 (ORCPT + 99 others); Wed, 19 May 2021 11:24:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346703AbhESPYY (ORCPT ); Wed, 19 May 2021 11:24:24 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD42C061761 for ; Wed, 19 May 2021 08:23:04 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id l4so20522536ejc.10 for ; Wed, 19 May 2021 08:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2kcMHiUdBh2RX9lqzPjQo7AnDIczfIylBe4oy/anXE4=; b=Ozr9QX2vejijzqnJiHLv3IEed5XqEa5tCvrp4GWhBWSBVsToH+RmYdiIwm3uQ8Rd1+ J9PuijBn2eRbEI1jVMnt5WZfi9ziUoMOy8uc2Q3VD6SCdOC3t9t8qoBn2Q44BZ7jr48e F892B/DS76Lcor5RWCGtbq2A8vth6kTdpxuk/rjirPcFFbSRhoZN8miOTdA1a4gxo1zI Cj8Wp039/MPhSS4QXTAfFJLdQCGuF65cX8GOrtTFFgaoqT21vCWGJW9hqVlc89YiWNgq sj8FkAItA82GtRljXobNcFgKBEJsiwslTzt1OKqLOCeZnCjIHmQN8zEvGocBnYyFVZfL 5u+A== 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; bh=2kcMHiUdBh2RX9lqzPjQo7AnDIczfIylBe4oy/anXE4=; b=eZCjVOPpkgzjwpjy/HqhgX0RGnRr1vGVflirmEnrPVhMfve/iDypXLvAN96sMiw49Z Hy95NSpUUASPb1xSzYoyxTZ8YL6z6qYlkFYpGcEENmeb7BFJu0Qd2pq86Sup8ifL4UKX BdTUj44wqmqvv/Udg8vWcorlCXWcg65wghJ4epv8leJtIXY76dIwHrK46PYCBiNJUsQk xIFYKfFBzBwI1yxCpE3xxlBB7cEcC0UQ8e/Fb9e9vEGhYlIKHM6/r6bPOzhjNYy9ajQH 2al42tgEsc5RiS/pZxgju29qw7YlpTKQ1sdxquH1uJDmlaPJhoA9rqcebZx0bkrTFVFS as0w== X-Gm-Message-State: AOAM5305cN1D7JMpS3zXgkpIGKCa+Tkq0b7Ug/QTB+o7FFDt9oJeqhSo NjXeWMQjMgEQArXN6AounNzZLdo2lerzD0eTdUbd X-Received: by 2002:a17:906:840c:: with SMTP id n12mr13191151ejx.431.1621437782490; Wed, 19 May 2021 08:23:02 -0700 (PDT) MIME-Version: 1.0 References: <20210519113058.1979817-1-memxor@gmail.com> <20210519113058.1979817-2-memxor@gmail.com> In-Reply-To: <20210519113058.1979817-2-memxor@gmail.com> From: Paul Moore Date: Wed, 19 May 2021 11:22:51 -0400 Message-ID: Subject: Re: [PATCH 1/2] fs: anon_inodes: export anon_inode_getfile_secure helper To: Kumar Kartikeya Dwivedi Cc: io-uring@vger.kernel.org, Pavel Emelyanov , Alexander Viro , Jens Axboe , Pavel Begunkov , Lokesh Gidra , Eric Biggers , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 19, 2021 at 7:37 AM Kumar Kartikeya Dwivedi wrote: > > This is the non-fd installing analogue of anon_inode_getfd_secure. In > addition to allowing LSMs to attach policy to the distinct inode, this > is also needed for checkpoint restore of an io_uring instance where a > mapped region needs to mapped back to the io_uring fd by CRIU. This is > currently not possible as all anon_inodes share a single inode. > > Signed-off-by: Kumar Kartikeya Dwivedi > --- > fs/anon_inodes.c | 9 +++++++++ > include/linux/anon_inodes.h | 4 ++++ > 2 files changed, 13 insertions(+) [NOTE: dropping dancol@google as that email is bouncy] > diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c > index a280156138ed..37032786b211 100644 > --- a/fs/anon_inodes.c > +++ b/fs/anon_inodes.c > @@ -148,6 +148,15 @@ struct file *anon_inode_getfile(const char *name, > } > EXPORT_SYMBOL_GPL(anon_inode_getfile); This function should have a comment block at the top similar to anon_inode_getfile(); in fact you can likely copy-n-paste the bulk of it to use as a start. If you don't want to bother respinning, I've got this exact patch (+comments) in my patchset that I'll post later and I'm happy to give/share credit if that is important to you. > +struct file *anon_inode_getfile_secure(const char *name, > + const struct file_operations *fops, > + void *priv, int flags, > + const struct inode *context_inode) > +{ > + return __anon_inode_getfile(name, fops, priv, flags, context_inode, true); > +} > +EXPORT_SYMBOL_GPL(anon_inode_getfile_secure); -- paul moore www.paul-moore.com