All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KEYS: reuse keyring_index_key::desc_len in lookup_user_key()
@ 2018-11-03  2:10 Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2018-11-03  2:10 UTC (permalink / raw)
  To: keyrings

From: Eric Biggers <ebiggers@google.com>

When lookup_user_key() checks whether the key is possessed, it should
use the key's existing index_key including the 'desc_len' field, rather
than recomputing the 'desc_len'.  This shouldn't cause any observable
behavior change; this way is just simpler and faster.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 security/keys/process_keys.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index d5b25e535d3a5..3bea09e7176d7 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -688,9 +688,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
 		key_ref = make_key_ref(key, 0);
 
 		/* check to see if we possess the key */
-		ctx.index_key.type		= key->type;
-		ctx.index_key.description	= key->description;
-		ctx.index_key.desc_len		= strlen(key->description);
+		ctx.index_key			= key->index_key;
 		ctx.match_data.raw_data		= key;
 		kdebug("check possessed");
 		skey_ref = search_process_keyrings(&ctx);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KEYS: reuse keyring_index_key::desc_len in lookup_user_key()
@ 2019-01-10 20:28 Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2019-01-10 20:28 UTC (permalink / raw)
  To: keyrings

On Fri, Nov 02, 2018 at 07:10:49PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> When lookup_user_key() checks whether the key is possessed, it should
> use the key's existing index_key including the 'desc_len' field, rather
> than recomputing the 'desc_len'.  This shouldn't cause any observable
> behavior change; this way is just simpler and faster.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  security/keys/process_keys.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> index d5b25e535d3a5..3bea09e7176d7 100644
> --- a/security/keys/process_keys.c
> +++ b/security/keys/process_keys.c
> @@ -688,9 +688,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
>  		key_ref = make_key_ref(key, 0);
>  
>  		/* check to see if we possess the key */
> -		ctx.index_key.type		= key->type;
> -		ctx.index_key.description	= key->description;
> -		ctx.index_key.desc_len		= strlen(key->description);
> +		ctx.index_key			= key->index_key;
>  		ctx.match_data.raw_data		= key;
>  		kdebug("check possessed");
>  		skey_ref = search_process_keyrings(&ctx);
> -- 
> 2.19.1
> 

Ping.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KEYS: reuse keyring_index_key::desc_len in lookup_user_key()
@ 2019-02-07 23:36 Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2019-02-07 23:36 UTC (permalink / raw)
  To: keyrings

On Thu, Jan 10, 2019 at 12:28:38PM -0800, Eric Biggers wrote:
> On Fri, Nov 02, 2018 at 07:10:49PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > When lookup_user_key() checks whether the key is possessed, it should
> > use the key's existing index_key including the 'desc_len' field, rather
> > than recomputing the 'desc_len'.  This shouldn't cause any observable
> > behavior change; this way is just simpler and faster.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > ---
> >  security/keys/process_keys.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> > index d5b25e535d3a5..3bea09e7176d7 100644
> > --- a/security/keys/process_keys.c
> > +++ b/security/keys/process_keys.c
> > @@ -688,9 +688,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
> >  		key_ref = make_key_ref(key, 0);
> >  
> >  		/* check to see if we possess the key */
> > -		ctx.index_key.type		= key->type;
> > -		ctx.index_key.description	= key->description;
> > -		ctx.index_key.desc_len		= strlen(key->description);
> > +		ctx.index_key			= key->index_key;
> >  		ctx.match_data.raw_data		= key;
> >  		kdebug("check possessed");
> >  		skey_ref = search_process_keyrings(&ctx);
> > -- 
> > 2.19.1
> > 
> 
> Ping.

Ping.  David, are you planning to apply this?

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KEYS: reuse keyring_index_key::desc_len in lookup_user_key()
@ 2019-03-18 17:28 Eric Biggers
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2019-03-18 17:28 UTC (permalink / raw)
  To: keyrings

On Thu, Feb 07, 2019 at 03:36:14PM -0800, Eric Biggers wrote:
> On Thu, Jan 10, 2019 at 12:28:38PM -0800, Eric Biggers wrote:
> > On Fri, Nov 02, 2018 at 07:10:49PM -0700, Eric Biggers wrote:
> > > From: Eric Biggers <ebiggers@google.com>
> > > 
> > > When lookup_user_key() checks whether the key is possessed, it should
> > > use the key's existing index_key including the 'desc_len' field, rather
> > > than recomputing the 'desc_len'.  This shouldn't cause any observable
> > > behavior change; this way is just simpler and faster.
> > > 
> > > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > > ---
> > >  security/keys/process_keys.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> > > index d5b25e535d3a5..3bea09e7176d7 100644
> > > --- a/security/keys/process_keys.c
> > > +++ b/security/keys/process_keys.c
> > > @@ -688,9 +688,7 @@ key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
> > >  		key_ref = make_key_ref(key, 0);
> > >  
> > >  		/* check to see if we possess the key */
> > > -		ctx.index_key.type		= key->type;
> > > -		ctx.index_key.description	= key->description;
> > > -		ctx.index_key.desc_len		= strlen(key->description);
> > > +		ctx.index_key			= key->index_key;
> > >  		ctx.match_data.raw_data		= key;
> > >  		kdebug("check possessed");
> > >  		skey_ref = search_process_keyrings(&ctx);
> > > -- 
> > > 2.19.1
> > > 
> > 
> > Ping.
> 
> Ping.  David, are you planning to apply this?
> 
> - Eric

Ping.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-18 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 23:36 [PATCH] KEYS: reuse keyring_index_key::desc_len in lookup_user_key() Eric Biggers
  -- strict thread matches above, loose matches on Subject: below --
2019-03-18 17:28 Eric Biggers
2019-01-10 20:28 Eric Biggers
2018-11-03  2:10 Eric Biggers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.