From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
syzbot+f0bbb2287b8993d4fa74@syzkaller.appspotmail.com,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>, Jakub Kicinski <kuba@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: memory leak in tcindex_set_parms
Date: Tue, 4 Feb 2020 15:40:26 -0800 [thread overview]
Message-ID: <787030ee-ff3e-8eae-3526-24aa8251bcc6@gmail.com> (raw)
In-Reply-To: <CAM_iQpVE=B+LDpG=DpiHh_ydUxxhTj_ge-20zgdB4J1OqAfCtQ@mail.gmail.com>
On 2/4/20 2:26 PM, Cong Wang wrote:
> On Tue, Feb 4, 2020 at 1:22 PM David Miller <davem@davemloft.net> wrote:
>>
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Tue, 4 Feb 2020 10:03:16 -0800
>>
>>>
>>>
>>> On 2/4/20 9:58 AM, syzbot wrote:
>>>> Hello,
>>>>
>>>> syzbot found the following crash on:
>>>>
>>>> HEAD commit: 322bf2d3 Merge branch 'for-5.6' of git://git.kernel.org/pu..
>>>> git tree: upstream
>>>> console output: https://syzkaller.appspot.com/x/log.txt?x=1111f8e6e00000
>>>> kernel config: https://syzkaller.appspot.com/x/.config?x=8d0490614a000a37
>>>> dashboard link: https://syzkaller.appspot.com/bug?extid=f0bbb2287b8993d4fa74
>>>> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>>>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17db90f6e00000
>>>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13a94511e00000
>>>>
>>>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>>>> Reported-by: syzbot+f0bbb2287b8993d4fa74@syzkaller.appspotmail.com
>>>>
>>>>
>>>
>>> Might have been fixed already ?
>>>
>>> commit 599be01ee567b61f4471ee8078870847d0a11e8e net_sched: fix an OOB access in cls_tcindex
>>
>> My reaction was actually that this bug is caused by this commit :)
>
> I think it is neither of the cases, I will test the following change:
>
> diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
> index 09b7dc5fe7e0..2495b15ca78c 100644
> --- a/net/sched/cls_tcindex.c
> +++ b/net/sched/cls_tcindex.c
> @@ -454,6 +454,7 @@ tcindex_set_parms(struct net *net, struct
> tcf_proto *tp, unsigned long base,
> oldp = p;
> r->res = cr;
> tcf_exts_change(&r->exts, &e);
> + tcf_exts_destroy(&e);
>
The only thing the repro fires for me on latest net tree is an UBSAN warning about a silly ->shift
I have not tried it on the old kernel.
[ 170.331009] UBSAN: Undefined behaviour in net/sched/cls_tcindex.c:239:29
[ 170.337729] shift exponent 19375 is too large for 32-bit type 'int'
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 0323aee03de7efbb99c7943be078765c74dfdf2e..42436ae61b7a64a7244a9df03dc397e5aa103a86 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -339,9 +339,13 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
if (tb[TCA_TCINDEX_MASK])
cp->mask = nla_get_u16(tb[TCA_TCINDEX_MASK]);
- if (tb[TCA_TCINDEX_SHIFT])
+ if (tb[TCA_TCINDEX_SHIFT]) {
cp->shift = nla_get_u32(tb[TCA_TCINDEX_SHIFT]);
-
+ if (cp->shift > 16) {
+ err = -EINVAL;
+ goto errout;
+ }
+ }
if (!cp->hash) {
/* Hash not specified, use perfect hash if the upper limit
* of the hashing index is below the threshold.
next prev parent reply other threads:[~2020-02-04 23:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 17:58 syzbot
2020-02-04 18:03 ` Eric Dumazet
2020-02-04 21:22 ` David Miller
2020-02-04 22:26 ` Cong Wang
2020-02-04 23:40 ` Eric Dumazet [this message]
2020-02-05 0:41 ` Cong Wang
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=787030ee-ff3e-8eae-3526-24aa8251bcc6@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzbot+f0bbb2287b8993d4fa74@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=xiyou.wangcong@gmail.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
all inboxes | Powered by JetHome®