lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 03 Mar 2015 06:07:44 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	'Florian Westphal' <fw@...len.de>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] net: bridge: add compile-time assert for cb struct
 size

On Tue, 2015-03-03 at 13:50 +0000, David Laight wrote:
> From: Florian Westphal
> > make build fail if structure no longer fits into ->cb storage.
> > 
> > Signed-off-by: Florian Westphal <fw@...len.de>
> > ---
> >  Change since v1: use FIELD_SIZEOF
> > 
> >  checkpatch complains about >80 chars, but line break is ugly here.
> > 
> > diff --git a/net/bridge/br.c b/net/bridge/br.c
> > index fb57ab6..02c24cf 100644
> > --- a/net/bridge/br.c
> > +++ b/net/bridge/br.c
> > @@ -190,6 +190,8 @@ static int __init br_init(void)
> >  {
> >  	int err;
> > 
> > +	BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
> > +
> 
> What about using something based on:
> #define GET_CB(skb, type) ((type *)((skb)->cb + (sizeof (char[(sizeof (type) <= sizeof (skb->cb)) ? 1 : -1] - 1)))
> to access skb->sb?
> 
> Then all invalid uses are likely to be picked up.

We want a build error, not a runtime one.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ