linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: "Thiébaud Weksteen" <tweek@google.com>
Cc: Paul Moore <paul@paul-moore.com>, Hugh Dickins <hughd@google.com>,
	 James Morris <jmorris@namei.org>,
	 Stephen Smalley <stephen.smalley.work@gmail.com>,
	 Jeff Vander Stoep <jeffv@google.com>,
	Nick Kralevich <nnk@google.com>,  Jeff Xu <jeffxu@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	 linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,  selinux@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] memfd,selinux: call security_inode_init_security_anon
Date: Tue, 16 Sep 2025 18:08:47 -0700 (PDT)	[thread overview]
Message-ID: <b266fe61-7a7a-b13f-a73c-f30f5edc22a3@google.com> (raw)
In-Reply-To: <CA+zpnLe8Z=2qY3rVCyZXyGPOaO2a0V2BVrdMkuwKs789igGCzw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

On Wed, 17 Sep 2025, Thiébaud Weksteen wrote:
> On Wed, Sep 17, 2025 at 1:26 AM Paul Moore <paul@paul-moore.com> wrote:
> > >
> > > So far as I can tell, seems okay to me:
> > > Acked-by: Hugh Dickins <hughd@google.com>
> > >
> > > If I'd responded earlier (sorry), I would have asked for it just to use
> > > &QSTR("[memfd]") directly in the call, rather than indirecting through
> > > unnecessary #define MEMFD_ANON_NAME "[memfd]"; never mind, that's all.
> > >
> 
> Thanks for the review Hugh. In our case, it is necessary to expose
> MEMFD_ANON_NAME as there is a string comparison done in
> security/selinux/hooks.c (see selinux_inode_init_security_anon
> changes).
> I would argue it is cleaner to reference the same constant. The
> alternative here would be to have 2 copies of it, with the risk of
> them being out-of-sync at some point.

Oh, I'm sorry, I simply misread your patch, and thought that the
#define MEMFD_ANON_NAME "[memfd]" came at the start of mm/memfd.c,
whereas it's in include/linux/memfd.h just before mm/memfd.c.

Yes, you're perfectly correct to do it that way then, ignore me.
(I do have to reflect on why three instances of MEMFD_ANON_NAME
are safer than two instances of "[memfd]", but you are correct.)

That does lead me to look quickly at the security/selinux/hooks.c
end of the patch: I don't particularly love what I see there, but
that's none of my business, you and Paul have constraints to meet
there which I'm entirely unfamiliar with.

Hugh

      reply	other threads:[~2025-09-17  1:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  3:18 [PATCH] memfd,selinux: call security_inode_init_security_anon Thiébaud Weksteen
2025-08-27 13:23 ` Stephen Smalley
2025-08-28 13:29   ` Stephen Smalley
2025-08-29  3:17     ` Thiébaud Weksteen
2025-08-29 10:56     ` Paul Moore
2025-09-03 16:56   ` Stephen Smalley
2025-09-03 21:26 ` Paul Moore
2025-09-16  5:06   ` Hugh Dickins
2025-09-16 15:26     ` Paul Moore
2025-09-17  0:34       ` Thiébaud Weksteen
2025-09-17  1:08         ` Hugh Dickins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b266fe61-7a7a-b13f-a73c-f30f5edc22a3@google.com \
    --to=hughd@google.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=jeffv@google.com \
    --cc=jeffxu@google.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nnk@google.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=tweek@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).