From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: eric.dumazet@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] tc: Fix unitialized kernel memory leak
Date: Wed, 2 Sep 2009 23:34:10 -0700 [thread overview]
Message-ID: <20090902233410.19f0705b@nehalam> (raw)
In-Reply-To: <20090902.225108.168195116.davem@davemloft.net>
On Wed, 02 Sep 2009 22:51:08 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 2 Sep 2009 12:05:40 -0700
>
> > On Wed, 02 Sep 2009 14:40:09 +0200
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> >> Three bytes of uninitialized kernel memory are currently leaked to user
> >>
> >> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> >> ---
> >> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> >> index 24d17ce..fdb694e 100644
> >> --- a/net/sched/sch_api.c
> >> +++ b/net/sched/sch_api.c
> >> @@ -1456,6 +1456,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
> >> nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
> >> tcm = NLMSG_DATA(nlh);
> >> tcm->tcm_family = AF_UNSPEC;
> >> + tcm->tcm__pad1 = 0;
> >> + tcm->tcm__pad2 = 0;
> >> tcm->tcm_ifindex = qdisc_dev(q)->ifindex;
> >> tcm->tcm_parent = q->handle;
> >> tcm->tcm_handle = q->handle;
> >
> > Perhaps __nlmsg_put should just always call memset() for the whole
> > added chunk. It is not like it is critical path in any way, and
> > avoid any of this possible class of errors.
>
> Doing it in __nlmsg_put would effect a lot of code paths. I don't
> think you can say with certainty that it won't matter, tree wide.
>
> What about things like the netfilter conntrack event monitor? Doesn't
> that emit hundreds of thousands of events per second on a busy
> firewall?
I doubt it would make a noticeable performance difference because
the first memset would incur the cache penalty of the write (if any)
and later update of fields would be cached.
--
next prev parent reply other threads:[~2009-09-03 6:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 12:40 [PATCH] tc: Fix unitialized kernel memory leak Eric Dumazet
2009-09-02 18:09 ` Jiri Pirko
2009-09-03 5:51 ` David Miller
2009-09-02 19:05 ` Stephen Hemminger
2009-09-03 5:51 ` David Miller
2009-09-03 6:34 ` Stephen Hemminger [this message]
2009-09-03 6:45 ` David Miller
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=20090902233410.19f0705b@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).