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:	Mon, 1 Feb 2016 05:47:23 +0800
From:	kbuild test robot <lkp@...el.com>
To:	Tom Herbert <tom@...bertland.com>
Cc:	kbuild-all@...org, 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

Hi Tom,

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Tom-Herbert/net-Allow-flow-dissector-to-handle-non-4-byte-aligned-headers/20160201-053832
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from arch/xtensa/include/generated/asm/bug.h:1:0,
                    from include/linux/bug.h:4,
                    from include/linux/thread_info.h:11,
                    from include/asm-generic/preempt.h:4,
                    from arch/xtensa/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/mm_types.h:8,
                    from include/linux/kmemcheck.h:4,
                    from include/linux/skbuff.h:18,
                    from net/core/flow_dissector.c:2:
   net/core/flow_dissector.c: In function '__skb_flow_dissect':
>> net/core/flow_dissector.c:148:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     if (WARN_ON(((u64)data & 0x1)))
                  ^
   include/asm-generic/bug.h:86:25: note: in definition of macro 'WARN_ON'
     int __ret_warn_on = !!(condition);    \
                            ^

vim +148 net/core/flow_dissector.c

     1	#include <linux/kernel.h>
   > 2	#include <linux/skbuff.h>
     3	#include <linux/export.h>
     4	#include <linux/ip.h>
     5	#include <linux/ipv6.h>
     6	#include <linux/if_vlan.h>
     7	#include <net/ip.h>
     8	#include <net/ipv6.h>
     9	#include <linux/igmp.h>
    10	#include <linux/icmp.h>
    11	#include <linux/sctp.h>
    12	#include <linux/dccp.h>
    13	#include <linux/if_tunnel.h>
    14	#include <linux/if_pppox.h>
    15	#include <linux/ppp_defs.h>
    16	#include <linux/stddef.h>
    17	#include <linux/if_ether.h>
    18	#include <linux/mpls.h>
    19	#include <net/flow_dissector.h>
    20	#include <scsi/fc/fc_fcoe.h>
    21	
    22	static bool dissector_uses_key(const struct flow_dissector *flow_dissector,
    23				       enum flow_dissector_key_id key_id)
    24	{
    25		return flow_dissector->used_keys & (1 << key_id);
    26	}
    27	
    28	static void dissector_set_key(struct flow_dissector *flow_dissector,
    29				      enum flow_dissector_key_id key_id)
    30	{
    31		flow_dissector->used_keys |= (1 << key_id);
    32	}
    33	
    34	static void *skb_flow_dissector_target(struct flow_dissector *flow_dissector,
    35					       enum flow_dissector_key_id key_id,
    36					       void *target_container)
    37	{
    38		return ((char *) target_container) + flow_dissector->offset[key_id];
    39	}
    40	
    41	void skb_flow_dissector_init(struct flow_dissector *flow_dissector,
    42				     const struct flow_dissector_key *key,
    43				     unsigned int key_count)
    44	{
    45		unsigned int i;
    46	
    47		memset(flow_dissector, 0, sizeof(*flow_dissector));
    48	
    49		for (i = 0; i < key_count; i++, key++) {
    50			/* User should make sure that every key target offset is withing
    51			 * boundaries of unsigned short.
    52			 */
    53			BUG_ON(key->offset > USHRT_MAX);
    54			BUG_ON(dissector_uses_key(flow_dissector,
    55						  key->key_id));
    56	
    57			dissector_set_key(flow_dissector, key->key_id);
    58			flow_dissector->offset[key->key_id] = key->offset;
    59		}
    60	
    61		/* Ensure that the dissector always includes control and basic key.
    62		 * That way we are able to avoid handling lack of these in fast path.
    63		 */
    64		BUG_ON(!dissector_uses_key(flow_dissector,
    65					   FLOW_DISSECTOR_KEY_CONTROL));
    66		BUG_ON(!dissector_uses_key(flow_dissector,
    67					   FLOW_DISSECTOR_KEY_BASIC));
    68	}
    69	EXPORT_SYMBOL(skb_flow_dissector_init);
    70	
    71	/**
    72	 * __skb_flow_get_ports - extract the upper layer ports and return them
    73	 * @skb: sk_buff to extract the ports from
    74	 * @thoff: transport header offset
    75	 * @ip_proto: protocol for which to get port offset
    76	 * @data: raw buffer pointer to the packet, if NULL use skb->data
    77	 * @hlen: packet header length, if @data is NULL use skb_headlen(skb)
    78	 *
    79	 * The function will try to retrieve the ports at offset thoff + poff where poff
    80	 * is the protocol port offset returned from proto_ports_offset
    81	 */
    82	__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
    83				    void *data, int hlen)
    84	{
    85		int poff = proto_ports_offset(ip_proto);
    86	
    87		if (!data) {
    88			data = skb->data;
    89			hlen = skb_headlen(skb);
    90		}
    91	
    92		if (poff >= 0) {
    93			__be32 *ports, _ports;
    94	
    95			ports = __skb_header_pointer(skb, thoff + poff,
    96						     sizeof(_ports), data, hlen, &_ports);
    97			if (ports)
    98				return get_unaligned_be32(ports);
    99		}
   100	
   101		return 0;
   102	}
   103	EXPORT_SYMBOL(__skb_flow_get_ports);
   104	
   105	/**
   106	 * __skb_flow_dissect - extract the flow_keys struct and return it
   107	 * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified
   108	 * @flow_dissector: list of keys to dissect
   109	 * @target_container: target structure to put dissected values into
   110	 * @data: raw buffer pointer to the packet, if NULL use skb->data
   111	 * @proto: protocol for which to get the flow, if @data is NULL use skb->protocol
   112	 * @nhoff: network header offset, if @data is NULL use skb_network_offset(skb)
   113	 * @hlen: packet header length, if @data is NULL use skb_headlen(skb)
   114	 *
   115	 * The function will try to retrieve individual keys into target specified
   116	 * by flow_dissector from either the skbuff or a raw buffer specified by the
   117	 * rest parameters.
   118	 *
   119	 * This function does not assume 4-byte alignment, but it does assume 2-byte
   120	 * alignment (false is returned for 1-byte alignment). get_unaligned_be32
   121	 * is called to get thirty-two values out of the packet.
   122	 *
   123	 * Caller must take care of zeroing target container memory.
   124	 */
   125	bool __skb_flow_dissect(const struct sk_buff *skb,
   126				struct flow_dissector *flow_dissector,
   127				void *target_container,
   128				void *data, __be16 proto, int nhoff, int hlen,
   129				unsigned int flags)
   130	{
   131		struct flow_dissector_key_control *key_control;
   132		struct flow_dissector_key_basic *key_basic;
   133		struct flow_dissector_key_addrs *key_addrs;
   134		struct flow_dissector_key_ports *key_ports;
   135		struct flow_dissector_key_tags *key_tags;
   136		struct flow_dissector_key_keyid *key_keyid;
   137		u8 ip_proto = 0;
   138		bool ret = false;
   139	
   140		if (!data) {
   141			data = skb->data;
   142			proto = skb->protocol;
   143			nhoff = skb_network_offset(skb);
   144			hlen = skb_headlen(skb);
   145		}
   146	
   147	#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 > 148		if (WARN_ON(((u64)data & 0x1)))
   149			return false;
   150	#endif
   151	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/octet-stream" (44040 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ