All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
	James.Bottomley@HansenPartnership.com,
	linux-integrity@vger.kernel.org
Cc: eric.snowberg@oracle.com, dhowells@redhat.com,
	mathew.j.martineau@linux.intel.com, matthewgarrett@google.com,
	sashal@kernel.org, jamorris@linux.microsoft.com,
	linux-kernel@vger.kernel.org, keyrings@vger.kernel.org
Subject: Re: [PATCH v5 1/2] IMA: Define workqueue for early boot "key" measurements
Date: Thu, 19 Dec 2019 16:55:38 +0000	[thread overview]
Message-ID: <503845c9-beeb-b520-ec3f-af5fa7d2b91f@linux.microsoft.com> (raw)
In-Reply-To: <1576761104.4579.426.camel@linux.ibm.com>

On 12/19/19 5:11 AM, Mimi Zohar wrote:

> 
> Getting rid of the temporary list is definitely a big improvement.  As
> James suggested, using test_and_set_bit() and test_bit() would improve
> this code even more.  I think, James correct me if I'm wrong, you
> would be able to get rid of both the mutex and "process".
> 
> Mimi

I am not sure if the mutex can be removed.

In ima_queue_key() we need to test the flag and add the key to the list 
as an atomic operation:

  if (!test_bit())
     insert_key_to_list

Suppose the if condition is true, but before we could insert the key to 
the list, ima_process_queued_keys() runs and processes queued keys we'll 
add the key to the list and never process it.

Is there an API in the kernel to test and add an entry to a list 
atomically?

thanks,
  -lakshmi

WARNING: multiple messages have this Message-ID (diff)
From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
	James.Bottomley@HansenPartnership.com,
	linux-integrity@vger.kernel.org
Cc: eric.snowberg@oracle.com, dhowells@redhat.com,
	mathew.j.martineau@linux.intel.com, matthewgarrett@google.com,
	sashal@kernel.org, jamorris@linux.microsoft.com,
	linux-kernel@vger.kernel.org, keyrings@vger.kernel.org
Subject: Re: [PATCH v5 1/2] IMA: Define workqueue for early boot "key" measurements
Date: Thu, 19 Dec 2019 08:55:38 -0800	[thread overview]
Message-ID: <503845c9-beeb-b520-ec3f-af5fa7d2b91f@linux.microsoft.com> (raw)
In-Reply-To: <1576761104.4579.426.camel@linux.ibm.com>

On 12/19/19 5:11 AM, Mimi Zohar wrote:

> 
> Getting rid of the temporary list is definitely a big improvement.  As
> James suggested, using test_and_set_bit() and test_bit() would improve
> this code even more.  I think, James correct me if I'm wrong, you
> would be able to get rid of both the mutex and "process".
> 
> Mimi

I am not sure if the mutex can be removed.

In ima_queue_key() we need to test the flag and add the key to the list 
as an atomic operation:

  if (!test_bit())
     insert_key_to_list

Suppose the if condition is true, but before we could insert the key to 
the list, ima_process_queued_keys() runs and processes queued keys we'll 
add the key to the list and never process it.

Is there an API in the kernel to test and add an entry to a list 
atomically?

thanks,
  -lakshmi


  reply	other threads:[~2019-12-19 16:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 16:44 [PATCH v5 0/2] IMA: Deferred measurement of keys Lakshmi Ramasubramanian
2019-12-18 16:44 ` Lakshmi Ramasubramanian
2019-12-18 16:44 ` [PATCH v5 1/2] IMA: Define workqueue for early boot "key" measurements Lakshmi Ramasubramanian
2019-12-18 16:44   ` Lakshmi Ramasubramanian
2019-12-19 13:11   ` Mimi Zohar
2019-12-19 13:11     ` Mimi Zohar
2019-12-19 16:55     ` Lakshmi Ramasubramanian [this message]
2019-12-19 16:55       ` Lakshmi Ramasubramanian
2019-12-20 12:53       ` Mimi Zohar
2019-12-20 12:53         ` Mimi Zohar
2019-12-18 16:44 ` [PATCH v5 2/2] IMA: Call workqueue functions to measure queued keys Lakshmi Ramasubramanian
2019-12-18 16:44   ` Lakshmi Ramasubramanian
2019-12-20 19:01 ` [PATCH v5 0/2] IMA: Deferred measurement of keys Mimi Zohar
2019-12-20 19:01   ` Mimi Zohar
2019-12-20 19:25   ` Lakshmi Ramasubramanian
2019-12-20 19:25     ` Lakshmi Ramasubramanian
2019-12-20 19:36     ` Mimi Zohar
2019-12-20 19:36       ` Mimi Zohar
2019-12-20 20:50       ` Lakshmi Ramasubramanian
2019-12-20 20:50         ` Lakshmi Ramasubramanian

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=503845c9-beeb-b520-ec3f-af5fa7d2b91f@linux.microsoft.com \
    --to=nramas@linux.microsoft.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dhowells@redhat.com \
    --cc=eric.snowberg@oracle.com \
    --cc=jamorris@linux.microsoft.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=matthewgarrett@google.com \
    --cc=sashal@kernel.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 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.