Re: [PATCH net-next v2 1/1] net: fastopen: robustness and endianness fixes for SipHash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ard,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Ard-Biesheuvel/net-fastopen-follow-up-tweaks-for-SipHash-switch/20190621-060434
config: i386-randconfig-x009-201924 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   net//ipv4/tcp_fastopen.c: In function 'tcp_fastopen_reset_cipher':
>> net//ipv4/tcp_fastopen.c:82:16: warning: missing braces around initializer [-Wmissing-braces]
     ctx->key[0] = (siphash_key_t){
                   ^
      get_unaligned_le64(primary_key),
      {
   net//ipv4/tcp_fastopen.c:85:2:
     };
     }
   net//ipv4/tcp_fastopen.c:87:17: warning: missing braces around initializer [-Wmissing-braces]
      ctx->key[1] = (siphash_key_t){
                    ^
       get_unaligned_le64(backup_key),
       {
   net//ipv4/tcp_fastopen.c:90:3:
      };
      }
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_add
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_inc
   Cyclomatic Complexity 2 arch/x86/include/asm/atomic.h:arch_atomic_try_cmpxchg
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_add
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_inc
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_try_cmpxchg
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__le64_to_cpup
   Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__le32_to_cpup
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/percpu-defs.h:__this_cpu_preempt_check
   Cyclomatic Complexity 5 include/linux/string.h:memcmp
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 6 arch/x86/include/asm/preempt.h:__preempt_count_add
   Cyclomatic Complexity 6 arch/x86/include/asm/preempt.h:__preempt_count_sub
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_lock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_unlock
   Cyclomatic Complexity 1 include/linux/rcutiny.h:rcu_is_watching
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/refcount.h:refcount_set
   Cyclomatic Complexity 1 include/linux/refcount.h:refcount_read
   Cyclomatic Complexity 1 include/linux/skbuff.h:skb_end_pointer
   Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_insert
   Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_before
   Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_tail
   Cyclomatic Complexity 1 include/linux/skbuff.h:skb_transport_header
   Cyclomatic Complexity 1 include/linux/skbuff.h:skb_network_header
   Cyclomatic Complexity 1 include/net/net_namespace.h:read_pnet
   Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_le64
   Cyclomatic Complexity 1 include/net/dst.h:dst_metric_raw
   Cyclomatic Complexity 1 include/net/sock.h:sk_has_account
   Cyclomatic Complexity 2 include/net/sock.h:sk_mem_charge
   Cyclomatic Complexity 1 include/net/sock.h:sock_net
   Cyclomatic Complexity 1 include/net/inet_sock.h:inet_sk
   Cyclomatic Complexity 1 include/net/inet_connection_sock.h:inet_csk
   Cyclomatic Complexity 1 include/linux/tcp.h:tcp_hdr
   Cyclomatic Complexity 1 include/linux/tcp.h:__tcp_hdrlen
   Cyclomatic Complexity 1 include/linux/tcp.h:tcp_hdrlen
   Cyclomatic Complexity 1 include/linux/tcp.h:tcp_rsk
   Cyclomatic Complexity 1 include/linux/tcp.h:tcp_sk
   Cyclomatic Complexity 1 include/linux/ipv6.h:ipv6_hdr
   Cyclomatic Complexity 1 include/linux/ip.h:ip_hdr
   Cyclomatic Complexity 4 include/net/tcp.h:tcp_fastopen_cookie_match
   Cyclomatic Complexity 1 include/net/tcp.h:tcp_fastopen_context_len
   Cyclomatic Complexity 3 include/net/tcp.h:tcp_segs_in
   Cyclomatic Complexity 8 include/net/tcp.h:tcp_fastopen_get_ctx
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_acquire
   Cyclomatic Complexity 4 include/linux/rcupdate.h:rcu_read_lock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_release
   Cyclomatic Complexity 4 include/linux/rcupdate.h:rcu_read_unlock
   Cyclomatic Complexity 1 net//ipv4/tcp_fastopen.c:tcp_fastopen_ctx_free
   Cyclomatic Complexity 1 include/linux/lockdep.h:lock_is_held
   Cyclomatic Complexity 3 include/net/sock.h:lockdep_sock_is_held
   Cyclomatic Complexity 5 include/net/sock.h:__sk_dst_get
   Cyclomatic Complexity 2 include/net/dst.h:refdst_drop
   Cyclomatic Complexity 2 include/net/dst.h:skb_dst_drop
   Cyclomatic Complexity 5 include/net/dst.h:dst_metric
   Cyclomatic Complexity 5 net//ipv4/tcp_fastopen.c:tcp_fastopen_no_cookie
   Cyclomatic Complexity 3 include/linux/atomic-fallback.h:atomic_fetch_add_unless
   Cyclomatic Complexity 1 include/linux/atomic-fallback.h:atomic_add_unless
   Cyclomatic Complexity 1 include/linux/atomic-fallback.h:atomic_inc_not_zero
   Cyclomatic Complexity 6 include/net/sock.h:sk_dst_get
   Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_pull
   Cyclomatic Complexity 2 include/linux/skbuff.h:skb_orphan
   Cyclomatic Complexity 1 include/net/sock.h:skb_set_owner_r
   Cyclomatic Complexity 2 include/net/sock.h:sock_put
   Cyclomatic Complexity 2 include/net/request_sock.h:__reqsk_free
   Cyclomatic Complexity 2 include/net/request_sock.h:reqsk_free
   Cyclomatic Complexity 2 include/net/request_sock.h:reqsk_put
   Cyclomatic Complexity 7 net//ipv4/tcp_fastopen.c:tcp_fastopen_queue_check
   Cyclomatic Complexity 11 include/linux/siphash.h:___siphash_aligned
   Cyclomatic Complexity 1 include/linux/siphash.h:siphash
   Cyclomatic Complexity 3 net//ipv4/tcp_fastopen.c:__tcp_fastopen_cookie_gen_cipher

vim +82 net//ipv4/tcp_fastopen.c

    68	
    69	int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk,
    70				      void *primary_key, void *backup_key)
    71	{
    72		struct tcp_fastopen_context *ctx, *octx;
    73		struct fastopen_queue *q;
    74		int err = 0;
    75	
    76		ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
    77		if (!ctx) {
    78			err = -ENOMEM;
    79			goto out;
    80		}
    81	
  > 82		ctx->key[0] = (siphash_key_t){
    83			get_unaligned_le64(primary_key),
    84			get_unaligned_le64(primary_key + 8)
    85		};
    86		if (backup_key) {
    87			ctx->key[1] = (siphash_key_t){
    88				get_unaligned_le64(backup_key),
    89				get_unaligned_le64(backup_key + 8)
    90			};
    91			ctx->num = 2;
    92		} else {
    93			ctx->num = 1;
    94		}
    95	
    96		spin_lock(&net->ipv4.tcp_fastopen_ctx_lock);
    97		if (sk) {
    98			q = &inet_csk(sk)->icsk_accept_queue.fastopenq;
    99			octx = rcu_dereference_protected(q->ctx,
   100				lockdep_is_held(&net->ipv4.tcp_fastopen_ctx_lock));
   101			rcu_assign_pointer(q->ctx, ctx);
   102		} else {
   103			octx = rcu_dereference_protected(net->ipv4.tcp_fastopen_ctx,
   104				lockdep_is_held(&net->ipv4.tcp_fastopen_ctx_lock));
   105			rcu_assign_pointer(net->ipv4.tcp_fastopen_ctx, ctx);
   106		}
   107		spin_unlock(&net->ipv4.tcp_fastopen_ctx_lock);
   108	
   109		if (octx)
   110			call_rcu(&octx->rcu, tcp_fastopen_ctx_free);
   111	out:
   112		return err;
   113	}
   114	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux