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
| ||
|
Date: Wed, 3 Sep 2014 19:43:10 -0700 From: Alexei Starovoitov <alexei.starovoitov@...il.com> To: Eric Dumazet <eric.dumazet@...il.com> Cc: Hannes Frederic Sowa <hannes@...essinduktion.org>, Daniel Borkmann <dborkman@...hat.com>, Eric Dumazet <edumazet@...gle.com>, Denis Kirjanov <kda@...ux-powerpc.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Markos Chandras <markos.chandras@...tec.com>, Martin Schwidefsky <schwidefsky@...ibm.com> Subject: Re: [PATCH v2 net-next] net: filter: export pkt_type_offset() helper On Wed, Sep 3, 2014 at 7:05 PM, Eric Dumazet <eric.dumazet@...il.com> wrote: > On Thu, 2014-09-04 at 03:25 +0200, Hannes Frederic Sowa wrote: > >> Can't we add an address marker to struct sk_buff? >> >> Several possibilities are available: >> >> ptrdiff_t pkt_type_offset[0] before the pkt_type flags field >> >> If one wants to make it more expressive: >> typedef struct {} mark_struct_offset; >> and add >> mark_struct_offset pkt_type_offset; >> at appropriate places >> >> Or maybe an anonymous union? >> >> pkt_type_offset would become a simple offsetof(struct sk_buff, >> pkt_type_offset) then and there is no need for BUG_ON then. > > > You can try, and make sure this works on all gcc compilers, even the one > Andrew Morton uses. > > And of course, you need to not introduce holes doing so. good points. I think Hannes's idea is the best. It will help to get rid of helper altogether. For my bpf syscall proposal I've used anonymous unions and tested them with gcc 4.2 - 4.9 on x64/i386/arm32/sparc64 and clang. All compilers were doing just fine. So it should work. -- 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