All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v2 1/6] KEYS: fix race between updating and finding negative key
Date: Tue, 26 Sep 2017 20:39:09 +0000	[thread overview]
Message-ID: <20170926203909.GA126069@gmail.com> (raw)
In-Reply-To: <20170926201105.126166-2-ebiggers3@gmail.com>

On Tue, Sep 26, 2017 at 01:11:00PM -0700, Eric Biggers wrote:
> +static void mark_key_instantiated(struct key *key, unsigned int reject_error)
> +{
> +	unsigned long old, new;
> +
> +	do {
> +		old = READ_ONCE(key->flags);
> +		new = (old & ~(KEY_FLAG_NEGATIVE |
> +			       KEY_FLAGS_REJECT_ERROR_MASK)) |
> +		      KEY_FLAG_INSTANTIATED |
> +		      (reject_error ? KEY_FLAG_NEGATIVE : 0) |
> +		      (reject_error << KEY_FLAGS_REJECT_ERROR_SHIFT);
> +	} while (cmpxchg_release(&key->flags, old, new) != old);
> +}

Sorry, I realized I screwed this up --- the flags like KEY_FLAG_NEGATIVE need to
be (1 << KEY_FLAG_NEGATIVE).  I'll send another version which will be better
tested...

Eric

WARNING: multiple messages have this Message-ID (diff)
From: ebiggers3@gmail.com (Eric Biggers)
To: linux-security-module@vger.kernel.org
Subject: [PATCH v2 1/6] KEYS: fix race between updating and finding negative key
Date: Tue, 26 Sep 2017 13:39:09 -0700	[thread overview]
Message-ID: <20170926203909.GA126069@gmail.com> (raw)
In-Reply-To: <20170926201105.126166-2-ebiggers3@gmail.com>

On Tue, Sep 26, 2017 at 01:11:00PM -0700, Eric Biggers wrote:
> +static void mark_key_instantiated(struct key *key, unsigned int reject_error)
> +{
> +	unsigned long old, new;
> +
> +	do {
> +		old = READ_ONCE(key->flags);
> +		new = (old & ~(KEY_FLAG_NEGATIVE |
> +			       KEY_FLAGS_REJECT_ERROR_MASK)) |
> +		      KEY_FLAG_INSTANTIATED |
> +		      (reject_error ? KEY_FLAG_NEGATIVE : 0) |
> +		      (reject_error << KEY_FLAGS_REJECT_ERROR_SHIFT);
> +	} while (cmpxchg_release(&key->flags, old, new) != old);
> +}

Sorry, I realized I screwed this up --- the flags like KEY_FLAG_NEGATIVE need to
be (1 << KEY_FLAG_NEGATIVE).  I'll send another version which will be better
tested...

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info@ http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers3@gmail.com>
To: keyrings@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	Michael Halcrow <mhalcrow@google.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@google.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/6] KEYS: fix race between updating and finding negative key
Date: Tue, 26 Sep 2017 13:39:09 -0700	[thread overview]
Message-ID: <20170926203909.GA126069@gmail.com> (raw)
In-Reply-To: <20170926201105.126166-2-ebiggers3@gmail.com>

On Tue, Sep 26, 2017 at 01:11:00PM -0700, Eric Biggers wrote:
> +static void mark_key_instantiated(struct key *key, unsigned int reject_error)
> +{
> +	unsigned long old, new;
> +
> +	do {
> +		old = READ_ONCE(key->flags);
> +		new = (old & ~(KEY_FLAG_NEGATIVE |
> +			       KEY_FLAGS_REJECT_ERROR_MASK)) |
> +		      KEY_FLAG_INSTANTIATED |
> +		      (reject_error ? KEY_FLAG_NEGATIVE : 0) |
> +		      (reject_error << KEY_FLAGS_REJECT_ERROR_SHIFT);
> +	} while (cmpxchg_release(&key->flags, old, new) != old);
> +}

Sorry, I realized I screwed this up --- the flags like KEY_FLAG_NEGATIVE need to
be (1 << KEY_FLAG_NEGATIVE).  I'll send another version which will be better
tested...

Eric

  reply	other threads:[~2017-09-26 20:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 20:10 [PATCH v2 0/6] KEYS: fix atomicity issues with key flags Eric Biggers
2017-09-26 20:10 ` Eric Biggers
2017-09-26 20:10 ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 1/6] KEYS: fix race between updating and finding negative key Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:39   ` Eric Biggers [this message]
2017-09-26 20:39     ` Eric Biggers
2017-09-26 20:39     ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 2/6] KEYS: load key flags atomically in key_is_instantiated() Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 3/6] KEYS: load key flags and expiry time atomically in key_validate() Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 4/6] KEYS: load key flags and expiry time atomically in keyring_search_iterator() Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 5/6] KEYS: load key flags and expiry time atomically in proc_keys_show() Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11 ` [PATCH v2 6/6] KEYS: remove KEY_FLAG_NEGATIVE Eric Biggers
2017-09-26 20:11   ` Eric Biggers
2017-09-26 20:11   ` Eric Biggers

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=20170926203909.GA126069@gmail.com \
    --to=ebiggers3@gmail.com \
    --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 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.