From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Jann Horn <jannh@google.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Network Development <netdev@vger.kernel.org>,
kernel list <linux-kernel@vger.kernel.org>,
intel-wired-lan@lists.osuosl.org,
linux-hardening@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH][next] ixgbe: Fix out-of-bounds warning in ixgbe_host_interface_command()
Date: Wed, 17 Mar 2021 14:04:06 -0500 [thread overview]
Message-ID: <03c013b8-4ddb-8e9f-af86-3c43cd746dbb@embeddedor.com> (raw)
In-Reply-To: <CAG48ez2jr_8MbY_sNXfwvs7WsF-5f9j=U4-66dTcgXd2msr39A@mail.gmail.com>
On 3/17/21 13:57, Jann Horn wrote:
>>>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
>>>> index 62ddb452f862..bff3dc1af702 100644
>>>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
>>>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
>>>> @@ -3679,7 +3679,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, void *buffer,
>>>> u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
>>>> union {
>>>> struct ixgbe_hic_hdr hdr;
>>>> - u32 u32arr[1];
>>>> + u32 *u32arr;
>>>> } *bp = buffer;
>>>> u16 buf_len, dword_len;
>>>> s32 status;
>>>
>>> This looks bogus. An array is inline, a pointer points elsewhere -
>>> they're not interchangeable.
>>
>> Yep; but in this case these are the only places in the code where _u32arr_ is
>> being used:
>>
>> 3707 /* first pull in the header so we know the buffer length */
>> 3708 for (bi = 0; bi < dword_len; bi++) {
>> 3709 bp->u32arr[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
>> 3710 le32_to_cpus(&bp->u32arr[bi]);
>> 3711 }
>
> So now line 3709 means: Read a pointer from bp->u32arr (the value
> being read from there is not actually a valid pointer), and write to
> that pointer at offset `bi`. I don't see how that line could execute
> without crashing.
Yeah; you're right. I see my confusion now. Apparently, there is no escape
from allocating heap memory to fix this issue, as I was proposing in my
last email.
I really appreciate the feedback. Thanks!
--
Gustavo
next prev parent reply other threads:[~2021-03-17 20:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 6:41 Gustavo A. R. Silva
2021-03-17 17:11 ` Jann Horn
2021-03-17 17:27 ` [Intel-wired-lan] " Gustavo A. R. Silva
2021-03-17 18:57 ` Jann Horn
2021-03-17 19:04 ` Gustavo A. R. Silva [this message]
2021-03-17 20:10 ` Jann Horn
2021-03-17 19:50 ` Gustavo A. R. Silva
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=03c013b8-4ddb-8e9f-af86-3c43cd746dbb@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=davem@davemloft.net \
--cc=gustavoars@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jannh@google.com \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®