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:	Sun, 31 Jan 2016 23:06:06 +0100
From:	Florian Westphal <fw@...len.de>
To:	Tom Herbert <tom@...bertland.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	sowmini.varadhan@...cle.com, kernel-team@...com
Subject: Re: [PATCH net] net: Allow flow dissector to handle non 4-byte
 aligned headers

Tom Herbert <tom@...bertland.com> wrote:
> Call get_unaligned_be32 when we access 32-bit fields in
> __skb_flow_dissect. At the beginning check for unlikely case of
> 1-byte aligned packet.
> 
> Note that flow_dissector may be asked to parse packet unaligned
> fields in two instances:
> 
> 1) Packet from a driver which is aligned to Ethernet header
>    (2-byte alignment)
> 2) Parsing inner headers of a received GRE-TEB packet
> 
> Testing: Ran super_netperf tests did not see a regression. This was on
> x86 which does not have problems with unaligned data.
> 
> Signed-off-by: Tom Herbert <tom@...bertland.com>
> ---
>  net/core/flow_dissector.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index d79699c..1c64a1a 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -95,7 +95,7 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
>  		ports = __skb_header_pointer(skb, thoff + poff,
>  					     sizeof(_ports), data, hlen, &_ports);
>  		if (ports)
> -			return *ports;
> +			return get_unaligned_be32(ports);

This adds an ntohl(), is that intended (same for other places)?

> +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> +	if (WARN_ON(((u64)data & 0x1)))
> +		return false;
> +#endif

WARN_ON_ONCE ?

Powered by blists - more mailing lists