From: David Howells <dhowells@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: dhowells@redhat.com, keyrings@vger.kernel.org,
Jarkko Sakkinen <jarkko@kernel.org>,
Steve French <sfrench@samba.org>,
Chuck Lever <chuck.lever@oracle.com>,
Mimi Zohar <zohar@linux.ibm.com>,
Paulo Alcantara <pc@manguebit.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Jeffrey Altman <jaltman@auristor.com>,
hch@infradead.org, linux-afs@lists.infradead.org,
linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-crypto@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] Keyrings: How to make them more useful
Date: Thu, 12 Jun 2025 21:36:18 +0100 [thread overview]
Message-ID: <473711.1749760578@warthog.procyon.org.uk> (raw)
In-Reply-To: <2dc7318d6c74b27a49b4c64b513f3da13d980473.camel@HansenPartnership.com>
James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> One of the problems I keep tripping over is different special casing
> for user keyrings (which are real struct key structures) and system
> keyrings which are special values of the pointer in struct key *.
It's meant to be like that. The trusted system keyrings are static within
system_keyring.c and not so easily accessible by kernel modules for
direct modification, bypassing the security checks.
Obviously this is merely a bit of obscurity and enforcement isn't possible
against kernel code that is determined to modify those keyrings or otherwise
interfere in the verification process.
> For examples of what this special handling does, just look at things
> like bpf_trace.c:bpf_lookup_{user|system}_key
>
> Since the serial allocation code has a hard coded not less than 3
> (which looks for all the world like it was designed to mean the two
> system keyring id's were never used as user serial numbers)
That's just a coincidence. The <3 thing predates the advent of those system
keyring magic pointers.
> I think we could simply allow the two system keyring ids to be passed into
> lookup_user_key() (which now might be a bit misnamed) and special case not
> freeing it in put_key().
If you want to make lookup_user_key() provide access to specific keyrings like
this, just use the next negative numbers - it's not like we're likely to run
out soon.
But I'd rather not let lookup_user_key() return pointers to these keyrings...
David
next prev parent reply other threads:[~2025-06-12 20:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 12:36 [RFC] Keyrings: How to make them more useful David Howells
2025-06-12 14:10 ` Benjamin Coddington
2025-06-12 18:27 ` James Bottomley
2025-06-12 20:36 ` David Howells [this message]
2025-06-13 15:40 ` James Bottomley
2025-06-16 20:30 ` Mimi Zohar
2025-06-17 13:54 ` Jarkko Sakkinen
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=473711.1749760578@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=chuck.lever@oracle.com \
--cc=hch@infradead.org \
--cc=herbert@gondor.apana.org.au \
--cc=jaltman@auristor.com \
--cc=jarkko@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pc@manguebit.org \
--cc=sfrench@samba.org \
--cc=zohar@linux.ibm.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