All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tc: Fix unitialized kernel memory leak
@ 2009-09-02 12:40 Eric Dumazet
  2009-09-02 18:09 ` Jiri Pirko
  2009-09-02 19:05 ` Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Dumazet @ 2009-09-02 12:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

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;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2009-09-02 18:09 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List

Wed, Sep 02, 2009 at 02:40:09PM CEST, 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>

Reviewed-by: Jiri Pirko <jpirko@redhat.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;
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  2009-09-02 12:40 [PATCH] tc: Fix unitialized kernel memory leak Eric Dumazet
  2009-09-02 18:09 ` Jiri Pirko
@ 2009-09-02 19:05 ` Stephen Hemminger
  2009-09-03  5:51   ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2009-09-02 19:05 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  2009-09-02 19:05 ` Stephen Hemminger
@ 2009-09-03  5:51   ` David Miller
  2009-09-03  6:34     ` Stephen Hemminger
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-09-03  5:51 UTC (permalink / raw)
  To: shemminger; +Cc: eric.dumazet, netdev

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  2009-09-02 18:09 ` Jiri Pirko
@ 2009-09-03  5:51   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2009-09-03  5:51 UTC (permalink / raw)
  To: jpirko; +Cc: eric.dumazet, netdev

From: Jiri Pirko <jpirko@redhat.com>
Date: Wed, 2 Sep 2009 20:09:36 +0200

> Wed, Sep 02, 2009 at 02:40:09PM CEST, 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>
> 
> Reviewed-by: Jiri Pirko <jpirko@redhat.com>

I'll apply this to net-2.6, thanks everyone.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  2009-09-03  5:51   ` David Miller
@ 2009-09-03  6:34     ` Stephen Hemminger
  2009-09-03  6:45       ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2009-09-03  6:34 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, netdev

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.

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tc: Fix unitialized kernel memory leak
  2009-09-03  6:34     ` Stephen Hemminger
@ 2009-09-03  6:45       ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2009-09-03  6:45 UTC (permalink / raw)
  To: shemminger; +Cc: eric.dumazet, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 2 Sep 2009 23:34:10 -0700

> 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.

Indeed, but it also means your store buffer usage is half as effective.
And when writing a ton of messages that might be important.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-09-03  6:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-09-03  6:45       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.