linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "David Howells" <dhowells@redhat.com>
Cc: <keyrings@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/7] keys: Out of line key_is_dead() so it can have tracepoints added in
Date: Tue, 27 Aug 2024 21:22:19 +0300	[thread overview]
Message-ID: <D3QWIW0EZK6J.180CPCNSOPTCN@kernel.org> (raw)
In-Reply-To: <20240821123616.60401-2-dhowells@redhat.com>

On Wed Aug 21, 2024 at 3:36 PM EEST, David Howells wrote:
> Move key_is_dead() out of line so that tracepoints can be added in to it
> without incurring circular #includes.  Also, it is only used from the file
> it is moved into.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jarkko Sakkinen <jarkko@kernel.org>
> cc: keyrings@vger.kernel.org
> cc: linux-security-module@vger.kernel.org
> ---
>  security/keys/internal.h | 20 --------------------
>  security/keys/keyring.c  | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/security/keys/internal.h b/security/keys/internal.h
> index 2cffa6dc8255..8ba87127e446 100644
> --- a/security/keys/internal.h
> +++ b/security/keys/internal.h
> @@ -211,26 +211,6 @@ extern struct key *request_key_auth_new(struct key *target,
>  
>  extern struct key *key_get_instantiation_authkey(key_serial_t target_id);
>  
> -/*
> - * Determine whether a key is dead.
> - */
> -static inline bool key_is_dead(const struct key *key, time64_t limit)
> -{
> -	time64_t expiry = key->expiry;
> -
> -	if (expiry != TIME64_MAX) {
> -		if (!(key->type->flags & KEY_TYPE_INSTANT_REAP))
> -			expiry += key_gc_delay;
> -		if (expiry <= limit)
> -			return true;
> -	}
> -
> -	return
> -		key->flags & ((1 << KEY_FLAG_DEAD) |
> -			      (1 << KEY_FLAG_INVALIDATED)) ||
> -		key->domain_tag->removed;
> -}
> -
>  /*
>   * keyctl() functions
>   */
> diff --git a/security/keys/keyring.c b/security/keys/keyring.c
> index 4448758f643a..0eed018448cb 100644
> --- a/security/keys/keyring.c
> +++ b/security/keys/keyring.c
> @@ -1687,6 +1687,26 @@ static void keyring_revoke(struct key *keyring)
>  	}
>  }
>  
> +/*
> + * Determine whether a key is dead.
> + */
> +static bool key_is_dead(const struct key *key, time64_t limit)
> +{
> +	time64_t expiry = key->expiry;
> +
> +	if (expiry != TIME64_MAX) {
> +		if (!(key->type->flags & KEY_TYPE_INSTANT_REAP))
> +			expiry += key_gc_delay;
> +		if (expiry <= limit)
> +			return true;
> +	}
> +
> +	return
> +		key->flags & ((1 << KEY_FLAG_DEAD) |
> +			      (1 << KEY_FLAG_INVALIDATED)) ||
> +		key->domain_tag->removed;
> +}
> +
>  static bool keyring_gc_select_iterator(void *object, void *iterator_data)
>  {
>  	struct key *key = keyring_ptr_to_key(object);

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

  reply	other threads:[~2024-08-27 18:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 12:36 [PATCH 0/7] keys: Add tracepoints David Howells
2024-08-21 12:36 ` [PATCH 1/7] keys: Out of line key_is_dead() so it can have tracepoints added in David Howells
2024-08-27 18:22   ` Jarkko Sakkinen [this message]
2024-08-21 12:36 ` [PATCH 2/7] keys: Extract struct key_user to its own header for tracing purposes David Howells
2024-08-27 18:23   ` Jarkko Sakkinen
2024-08-21 12:36 ` [PATCH 3/7] keys: Move key_get() out of line so a tracepoint can be added David Howells
2024-08-27 18:23   ` Jarkko Sakkinen
2024-08-21 12:36 ` [PATCH 4/7] keys: Add a key_ref_get() wrapper David Howells
2024-08-27 18:23   ` Jarkko Sakkinen
2024-08-21 12:36 ` [PATCH 5/7] keys: Use key_get() instead of __key_get() David Howells
2024-08-27 18:24   ` Jarkko Sakkinen
2024-08-21 12:36 ` [PATCH 6/7] keys: Provide a key_try_get() function and use it David Howells
2024-08-27 18:24   ` Jarkko Sakkinen
2024-08-21 12:36 ` [PATCH 7/7] keys: Add tracepoints for the keyrings facility David Howells
2024-08-27 18:27   ` Jarkko Sakkinen
2024-09-28  2:03   ` Justin Stitt

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=D3QWIW0EZK6J.180CPCNSOPTCN@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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).