From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Patrick Callaghan <patrickc@linux.vnet.ibm.com>,
Mimi Zohar <zohar@linux.ibm.com>,
Patrick Callaghan <patrickc@linux.ibm.com>,
linux-integrity@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH] ima: avoid appraise error for hash calc interrupt
Date: Thu, 14 Nov 2019 10:45:06 -0800 [thread overview]
Message-ID: <4e1c0c6b-a5e1-a95a-8a0b-c5a7f0a253cf@linux.microsoft.com> (raw)
In-Reply-To: <abdf66fb39d4c8ee08e0b52c34fb81b93bd33006.camel@linux.vnet.ibm.com>
On 11/14/19 5:55 AM, Patrick Callaghan wrote:
Hi Patrick,
> Hello Laks,
> You suggested that the if statement of the patch change to the
> following:
>
> if ((rbuf_len == 0) || (offset + rbuf_len >= i_size)) {
>
> Unless the file size changed between the time that i_size was set in
> ima_calc_file_hash_tfm() and an i_size_read() call was subsequently
> issued in a function downstream of the integrity_kernel_read() call,
> the rbuf_len returned on the integrity_kernel_read() call will not be
> more than i_size - offset. I do not think that it is possible for the
> file size to change during this window but nonetheless, if it can, this
> would be a different problem and I would not want to include this in my
> patch. That said, I do appreciate you taking time to review this patch.
You are right - unless the file size changes between the calls this
problem would not occur. I agree - that issue, even if it can occur,
should be addressed separately.
Another one (again - am not saying this needs to be addressed in this
patch, but just wanted to point out)
rbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
...
rbuf_len = integrity_kernel_read(file, offset, rbuf, PAGE_SIZE);
...
rc = crypto_shash_update(shash, rbuf, rbuf_len);
rbuf is of size PAGE_SIZE, but rbuf_len, returned by
integrity_kernel_read() is passed as buffer size to
crypto_shash_update() without any validation (rbuf_len <= PAGE_SIZE)
It is assumed here that integrity_kernel_read() would not return a
length greater than rbuf size and hence crypto_shash_update() would
never access beyond the given buffer.
thanks,
-lakshmi
next prev parent reply other threads:[~2019-11-14 18:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 19:23 Patrick Callaghan
2019-11-11 22:29 ` Lakshmi Ramasubramanian
2019-11-12 17:14 ` Mimi Zohar
2019-11-12 17:33 ` Lakshmi Ramasubramanian
2019-11-12 18:12 ` Mimi Zohar
2019-11-14 13:55 ` Patrick Callaghan
2019-11-14 18:45 ` Lakshmi Ramasubramanian [this message]
2019-11-15 15:25 ` Patrick Callaghan
2019-11-15 20:34 ` Lakshmi Ramasubramanian
2019-11-13 7:52 ` Sascha Hauer
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=4e1c0c6b-a5e1-a95a-8a0b-c5a7f0a253cf@linux.microsoft.com \
--to=nramas@linux.microsoft.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrickc@linux.ibm.com \
--cc=patrickc@linux.vnet.ibm.com \
--cc=s.hauer@pengutronix.de \
--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
Powered by JetHome