From: Daiki Ueno <dueno@redhat.com>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org
Subject: Re: [PATCH] IMA: make runtime measurement list pollable
Date: Thu, 07 Oct 2021 10:38:26 +0200 [thread overview]
Message-ID: <87fstdb56l.fsf-dueno@redhat.com> (raw)
In-Reply-To: <6ade3979fd113902aadf48eb97a15f86e19bf86f.camel@linux.ibm.com> (Mimi Zohar's message of "Wed, 06 Oct 2021 19:18:38 -0400")
Hello Mimi,
Mimi Zohar <zohar@linux.ibm.com> writes:
> Hi Daiki,
>
> On Tue, 2021-10-05 at 16:44 +0200, Daiki Ueno wrote:
>> The IMA runtime measurement list exposed on securityfs is currently
>> not pollable, so applications that incrementally verify the
>> measurements have to monitor the file periodically. This patch makes
>> it possible to poll the file in a similar fashion to the sysfs files,
>> i.e., POLLPRI will be signalled on any changes to the list.
>>
>> Signed-off-by: Daiki Ueno <dueno@redhat.com>
>
> With the sample code in the poll man page and without this patch, the
> ascii measurement list is pollable. I must be missing something.
The sample code polls with POLLIN, so every poll() call returns
immediately, even if there is no change in the measurement list. That
is not ideal in some scenarios[1], and could be a CPU hog as the calling
process never sleeps.
With this patch, poll() behaves the same for POLLIN, while the user
program is also able to wait for actual changes to the measurement list,
with POLLPRI.
> The call to wake_up_interruptible() probably should not be here, but in
> the caller after the TPM is extended. With that change, you would be
> able to differentiate between restoring the measurement list after
> kexec and regular additional measurements.
Thank you for the suggestion; I will test that change and get it back to
you soon.
Regards,
Footnotes:
[1] https://github.com/keylime/keylime/blob/master/keylime/cmd/ima_emulator_adapter.py#L95
Currently the poll() in the loop is no-op and it would spin if
there is no time.sleep()
--
Daiki Ueno
next prev parent reply other threads:[~2021-10-07 8:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 14:44 [PATCH] IMA: make runtime measurement list pollable Daiki Ueno
2021-10-06 23:18 ` Mimi Zohar
2021-10-07 8:38 ` Daiki Ueno [this message]
2021-10-08 6:53 ` [PATCH v2] " Daiki Ueno
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=87fstdb56l.fsf-dueno@redhat.com \
--to=dueno@redhat.com \
--cc=linux-integrity@vger.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.