public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Sush Shringarputale <sushring@linux.microsoft.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
	linux-integrity@vger.kernel.org, peterhuewe@gmx.de,
	jarkko@kernel.org, jgg@ziepe.ca, kgold@linux.ibm.com,
	bhe@redhat.com, vgoyal@redhat.com, dyoung@redhat.com,
	kexec@lists.infradead.org, jmorris@namei.org,
	Paul Moore <paul@paul-moore.com>,
	serge@hallyn.com
Cc: code@tyhicks.com, nramas@linux.microsoft.com,
	Tushar Sugandhi <tusharsu@linux.microsoft.com>,
	linux-security-module@vger.kernel.org
Subject: Re: [RFC] IMA Log Snapshotting Design Proposal
Date: Mon, 21 Aug 2023 15:05:17 -0700	[thread overview]
Message-ID: <8bc0f024-fc12-cb32-7af0-e500948cc6db@linux.microsoft.com> (raw)
In-Reply-To: <0e1511e8819b24ab8a34a7b15821f06eff688f29.camel@linux.ibm.com>



On 8/14/2023 3:02 PM, Mimi Zohar wrote:
> On Mon, 2023-08-14 at 14:42 -0700, Sush Shringarputale wrote:
>>> This design seems overly complex and requires synchronization between
>>> the "snapshot" record and exporting the records from the measurement
>>> list.  None of this would be necessary if the measurements were copied
>>> from kernel memory to a backing file (e.g. tmpfs), as described in [1].
Even if the Kernel maintains the link between a tmpfs exported and an
in-memory IMA log - it still has to copy the tmpfs portion to the
Kernel memory during kexec soft boot.  tmpfs is cleared during kexec,
so this copying of tmpfs back to kernel memory is necessary to preserve
the integrity of the log during kexec.  But the copying would add back
the memory pressure on the node during kexec (which may result in
out-of-memory), defeating the purpose of the overall effort/feature.
Copying to a regular *persistent* protected file seems a cleaner
approach, compared to tmpfs.  We prototyped this solution, however it
does not seem to be a common pattern within the Kernel to write state
directly to files on disk file systems.  We considered two potential
options:

Option (A): (RECOMMENDED)
             Let Kernel write the file using KM file APIs
--------------------------------------------
     Use Kernel mode file APIs such as _file_open_root_, _vfs_llseek_,
     and _vfs_write_ to use a persistent file on disk.  There is not
     sufficient precedent for this pattern in the Kernel currently, so
     we need guidance from area experts on the best mechanism to
     implement this.

     As for the location of the file, we suggest setting this in
     KConfig. The file will be created by the Kernel, so it should be
     protected from UM access.  Additionally, on a full boot, the
     file should be cleared by the Kernel.

   POTENTIAL ISSUES AND MITIGATIONS
     - handling IO errors from KM

       A potential mitigation for this is to retry the failed write.
       This assumes that the vfs_write Kernel method can handle any
       failures gracefully without causing crashes.


     - using file system paths to resolve the file from KM

       Using the file_open_root seems to provide sufficient resiliency
       against this.  The file can be located at a well known location
       to minimize potential concerns.  However, any guidance in
       minimizing squatting risks would be greatly appreciated.

     - the file could be tampered by UM

       There needs to be a lock/kernel-only-permission on the file
       so that a UM process cannot tamper with the file.  A description
       on how this file would be protected was provided at [2].


Option (B): (NOT RECOMMENDED)
             Hand over the file writing to UM
--------------------------------------------
     Alternately, UM could write the file contents and decide the
     location of the file on disk.  If we want to preserve the Kernel
     behavior of rendering the IMA log as a single monolithic log on
     client (as ascii/binary_runtime_measurements file), the
     Kernel will have to read from a file written by UM and combine it
     with the remaining in-kernel-memory IMA log events.

     This approach of a Kernel reading from a UM written file as an
     IMA log violates the call stack, and thus it is not recommended.

If UM is to handle writing the IMA log to disk, the Kernel cannot read
those snapshotted events again.  Integrity of the IMA log can still be
maintained - a solution implementing this was in the original proposal
we submitted [1].

We appreciate the community's feedback on helping mold this feature to a
suitable implementation.

Thanks,
Sush and Tushar.


References:
[1]
https://lore.kernel.org/linux-integrity/c5737141-7827-1c83-ab38-0119dcfea485@linux.microsoft.com/ 


[2]
https://lore.kernel.org/linux-integrity/CAOQ4uxiBAGKco1BKgyLOMY54r_Ck2jnvz8RCFODD-V87CGqLEw@mail.gmail.com/ 

>>>
>>> What is the real problem - kernel memory pressure, memory pressure in
>>> general, or disk space?  Is the intention to remove or offload the
>>> exported measurements?
>> The main concern is the memory pressure on both the kernel and the
>> attestation client
>> when it sends the request.  The concern you bring up is valid and we are
>> working on
>> creating a prototype.  There is no intention to remove the exported
>> measurements.
> Glad to hear that you're not intending to remove the exported
> measurements.
>
> Defining and including a new record in the measurement list measurement
> is fine, if it helps with attestation and doesn't require pausing the
> measurements.
>


  reply	other threads:[~2023-08-21 22:05 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 19:12 [RFC] IMA Log Snapshotting Design Proposal Sush Shringarputale
2023-08-01 21:21 ` James Bottomley
2023-08-07 22:49   ` Stefan Berger
2023-08-08 12:35     ` James Bottomley
2023-08-08 13:31       ` Stefan Berger
2023-08-08 18:26         ` James Bottomley
2023-08-08 20:09           ` Stefan Berger
2023-08-08 21:41             ` James Bottomley
2023-08-10  4:43               ` Tushar Sugandhi
2023-08-10 11:43                 ` James Bottomley
2023-08-11 15:48                   ` Tushar Sugandhi
2023-08-10  4:31           ` Tushar Sugandhi
2023-08-10  4:29         ` Tushar Sugandhi
2023-08-10  1:23       ` Tushar Sugandhi
2023-08-10  1:15     ` Tushar Sugandhi
2023-08-10 14:12       ` Stefan Berger
2023-08-11 15:57         ` Tushar Sugandhi
2023-08-11 18:16           ` Stefan Berger
2023-08-10  1:03   ` Tushar Sugandhi
2023-08-11 13:14 ` Mimi Zohar
2023-08-14 21:42   ` Sush Shringarputale
2023-08-14 22:02     ` Mimi Zohar
2023-08-21 22:05       ` Sush Shringarputale [this message]
2023-08-21 23:07         ` Mimi Zohar
2023-08-29 19:34           ` Paul Moore
2023-08-29 21:03             ` Mimi Zohar
2023-08-29 21:30               ` Paul Moore
2023-08-29 21:54                 ` Mimi Zohar
2023-08-29 23:15                   ` Paul Moore
2023-08-30 20:25                     ` Mimi Zohar
2023-08-30 20:47                       ` Paul Moore
2023-08-30 21:50                         ` Mimi Zohar
2023-08-30 22:21                           ` Paul Moore
2023-08-30 22:23                             ` Paul Moore
2023-08-30 23:06                               ` Mimi Zohar
2023-08-30 23:22                                 ` Paul Moore
2023-08-31 14:01                                   ` Mimi Zohar
2023-08-31 14:43                                     ` Paul Moore
2023-08-31 16:46                                   ` Dr. Greg
2023-08-31 17:56                                     ` Paul Moore
2023-08-30 18:06 ` [RFC] IMA Log Snapshotting Design Proposal - network bandwidth Ken Goldman
2023-09-01 21:20   ` Tushar Sugandhi
2023-09-06 20:20     ` Ken Goldman
2023-09-07 20:40       ` Paul Moore
2023-08-30 18:12 ` [RFC] IMA Log Snapshotting Design Proposal - aggregate Ken Goldman
2023-09-01 22:06   ` Tushar Sugandhi
2023-09-06 20:49     ` Ken Goldman
2023-09-07 21:02       ` Paul Moore
2023-08-30 19:12 ` [RFC] IMA Log Snapshotting Design Proposal - unseal Ken Goldman
2023-08-31 15:54   ` Dr. Greg
2023-09-01 21:22   ` Tushar Sugandhi
2023-09-06 20:13     ` Ken Goldman

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=8bc0f024-fc12-cb32-7af0-e500948cc6db@linux.microsoft.com \
    --to=sushring@linux.microsoft.com \
    --cc=bhe@redhat.com \
    --cc=code@tyhicks.com \
    --cc=dyoung@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jmorris@namei.org \
    --cc=kexec@lists.infradead.org \
    --cc=kgold@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nramas@linux.microsoft.com \
    --cc=paul@paul-moore.com \
    --cc=peterhuewe@gmx.de \
    --cc=serge@hallyn.com \
    --cc=tusharsu@linux.microsoft.com \
    --cc=vgoyal@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox