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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 20 Mar 2015 11:27:18 +0100
From:	Michal Sekletar <msekleta@...hat.com>
To:	Alexei Starovoitov <ast@...mgrid.com>
Cc:	netdev@...r.kernel.org, Jiri Pirko <jpirko@...hat.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Russell King <linux@....linux.org.uk>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next v2] filter: introduce SKF_AD_VLAN_TPID BPF
 extension

On Thu, Mar 19, 2015 at 09:08:35AM -0700, Alexei Starovoitov wrote:
> On 3/19/15 4:10 AM, Michal Sekletar wrote:
> >If vlan offloading takes place then vlan header is removed from frame
> >and its contents, both vlan_tci and vlan_proto, is available to userspace via
> >TPACKET interface. However, only vlan_tci can be used in BPF filters.
> >
> >This commit introduces new BPF extension. It makes possible to load value of
> >vlan_proto (vlan TPID) to register A.
> 
> Agree with the idea, though we need to decide whether to do ntohs on
> vlan_proto or not. Since right now your patch makes it consistent
> on different architectures.
> 
> For arch where extended BPF jit is available the following:
> > +	case SKF_AD_OFF + SKF_AD_VLAN_TPID:
> ...
> > +		/* A = ntohs(A) [emitting a nop or swap16] */
> > +		*insn = BPF_ENDIAN(BPF_FROM_BE, BPF_REG_A, 16);
> 
> will make sure that it's doing ntohs,
> whereas arm JIT is doing normal 16-bit load.
> ppc can be both big and little, so PPC_LHZ_OFFS is incorrect.
> 
> Since it's a new field, I think it makes sense not to do ntohs at all.
> Let bpf programs do htons(PROTO_CONSTANT), since it can be done at
> compile time instead of run-time.

Doing htons is not needed for vlan_tci thus I wanted to avoid surprise for
users. But of course I'll do whatever you think is the best.

Also in v3 I will leave out all the jit bits. Once non-jit bits are merged then
I will be sending separate patches for the rest.

Hope that makes sense,

Michal

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