From: Colin Ian King <colin.king@canonical.com>
To: Kees Cook <keescook@chromium.org>
Cc: Ke Wu <mikewu@google.com>,
James Morris <jamorris@linux.microsoft.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
linux-security-module@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: security/loadpin: Allow to exclude specific file types
Date: Fri, 31 May 2019 15:49:17 +0100 [thread overview]
Message-ID: <c80362bd-1dec-3e4f-c3e8-1c58d3a33070@canonical.com> (raw)
In-Reply-To: <201905310740.522B3A7C1@keescook>
On 31/05/2019 15:44, Kees Cook wrote:
> On Fri, May 31, 2019 at 11:46:29AM +0100, Colin Ian King wrote:
>> Hi,
>>
>> Static analysis with Coverity on linux-next has found a potential issue
>> with the following commit:
>>
>> commit 1633a4f04cc171fc638deb5c95af96032d3c591b
>> Author: Ke Wu <mikewu@google.com>
>> Date: Thu May 30 12:22:08 2019 -0700
>>
>> security/loadpin: Allow to exclude specific file types
>>
>>
>> 209 for (j = 0; j < ARRAY_SIZE(kernel_read_file_str); j++) {
>> 210 if (strcmp(cur, kernel_read_file_str[j]) == 0) {
>> 211 pr_info("excluding: %s\n",
>> 212 kernel_read_file_str[j]);
>>
>> CID 81977 (#1 of 1): Out-of-bounds write
>> overrun-local: Overrunning array ignore_read_file_id of 8 4-byte
>> elements at element index 8 (byte offset 35) using index j (which
>> evaluates to 8).
>>
>> 213 ignore_read_file_id[j] = 1;
>>
>> According to Coverity ignore_read_file_id is an array of 8 integers.
>> However, ARRAY_SIZE(kernel_read_file_str) is 9, so we have an out of
>> bounds write on ignore_read_file[j] when j is 8.
>
> What am I missing? This doesn't fail the build:
>
> + BUILD_BUG_ON(ARRAY_SIZE(exclude_read_files) !=
> + ARRAY_SIZE(ignore_read_file_id));
>
> They have the same number of elements.
>
Yep, that's very true. I'll discuss this with Coverity as this seems
like a weird false positive.
Apologies for the noise.
Colin
next prev parent reply other threads:[~2019-05-31 14:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 10:46 security/loadpin: Allow to exclude specific file types Colin Ian King
2019-05-31 14:44 ` Kees Cook
2019-05-31 14:49 ` Colin Ian King [this message]
2019-05-31 18:03 ` Ke Wu
2019-05-31 20:33 ` Kees Cook
2019-06-04 17:01 ` Ke Wu
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=c80362bd-1dec-3e4f-c3e8-1c58d3a33070@canonical.com \
--to=colin.king@canonical.com \
--cc=jamorris@linux.microsoft.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mikewu@google.com \
--cc=serge@hallyn.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;
as well as URLs for NNTP newsgroup(s).