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]
Message-ID: <201710210027.nxMZ7dfs%fengguang.wu@intel.com>
Date:   Sat, 21 Oct 2017 00:53:17 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     kbuild-all@...org, David Miller <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>, edumazet@...gle.com
Subject: Re: [PATCH net] dccp/tcp: fix ireq->opt races

Hi Eric,

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/dccp-tcp-fix-ireq-opt-races/20171021-001234
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/uapi/asm/intrinsics.h:21:0,
                    from arch/ia64/include/asm/intrinsics.h:10,
                    from arch/ia64/include/asm/atomic.h:17,
                    from include/linux/atomic.h:4,
                    from include/linux/rcupdate.h:38,
                    from net/ipv4/cipso_ipv4.c:40:
   net/ipv4/cipso_ipv4.c: In function 'cipso_v4_req_setattr':
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/cmpxchg.h:56:16: note: in definition of macro 'xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                   ^~~
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/cmpxchg.h:33:10: note: in definition of macro '__xchg'
     switch (size) {       \
             ^~~~
>> net/ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   In file included from arch/ia64/include/asm/gcc_intrin.h:9:0,
                    from arch/ia64/include/uapi/asm/intrinsics.h:19,
                    from arch/ia64/include/asm/intrinsics.h:10,
                    from arch/ia64/include/asm/atomic.h:17,
                    from include/linux/atomic.h:4,
                    from include/linux/rcupdate.h:38,
                    from net/ipv4/cipso_ipv4.c:40:
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:279:40: note: in definition of macro 'ia64_xchg1'
            : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \
                                           ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
>> net/ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:287:16: note: in definition of macro 'ia64_xchg2'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
>> net/ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:295:16: note: in definition of macro 'ia64_xchg4'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
>> net/ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net/ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:303:16: note: in definition of macro 'ia64_xchg8'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
>> net/ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net/ipv4/cipso_ipv4.c: In function 'cipso_v4_req_delattr':
   net/ipv4/cipso_ipv4.c:2073:16: error: 'struct inet_request_sock' has no member named 'opt'
     opt = req_inet->opt;
                   ^~
   net/ipv4/cipso_ipv4.c:2077:27: error: 'struct inet_request_sock' has no member named 'opt'
     cipso_v4_delopt(&req_inet->opt);
                              ^~
--
   In file included from arch/ia64/include/uapi/asm/intrinsics.h:21:0,
                    from arch/ia64/include/asm/intrinsics.h:10,
                    from arch/ia64/include/asm/atomic.h:17,
                    from include/linux/atomic.h:4,
                    from include/linux/rcupdate.h:38,
                    from net//ipv4/cipso_ipv4.c:40:
   net//ipv4/cipso_ipv4.c: In function 'cipso_v4_req_setattr':
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/cmpxchg.h:56:16: note: in definition of macro 'xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                   ^~~
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/cmpxchg.h:33:10: note: in definition of macro '__xchg'
     switch (size) {       \
             ^~~~
   net//ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   In file included from arch/ia64/include/asm/gcc_intrin.h:9:0,
                    from arch/ia64/include/uapi/asm/intrinsics.h:19,
                    from arch/ia64/include/asm/intrinsics.h:10,
                    from arch/ia64/include/asm/atomic.h:17,
                    from include/linux/atomic.h:4,
                    from include/linux/rcupdate.h:38,
                    from net//ipv4/cipso_ipv4.c:40:
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:279:40: note: in definition of macro 'ia64_xchg1'
            : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \
                                           ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
   net//ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:287:16: note: in definition of macro 'ia64_xchg2'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
   net//ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:295:16: note: in definition of macro 'ia64_xchg4'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
   net//ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net//ipv4/cipso_ipv4.c:1954:22: error: 'struct inet_request_sock' has no member named 'opt'
     opt = xchg(&req_inet->opt, opt);
                         ^
   arch/ia64/include/uapi/asm/gcc_intrin.h:303:16: note: in definition of macro 'ia64_xchg8'
            : "r" (ptr), "r" (x) : "memory");   \
                   ^~~
>> arch/ia64/include/uapi/asm/cmpxchg.h:56:23: note: in expansion of macro '__xchg'
    ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
                          ^~~~~~
   net//ipv4/cipso_ipv4.c:1954:8: note: in expansion of macro 'xchg'
     opt = xchg(&req_inet->opt, opt);
           ^~~~
   net//ipv4/cipso_ipv4.c: In function 'cipso_v4_req_delattr':
   net//ipv4/cipso_ipv4.c:2073:16: error: 'struct inet_request_sock' has no member named 'opt'
     opt = req_inet->opt;
                   ^~
   net//ipv4/cipso_ipv4.c:2077:27: error: 'struct inet_request_sock' has no member named 'opt'
     cipso_v4_delopt(&req_inet->opt);
                              ^~

vim +/xchg +1954 net/ipv4/cipso_ipv4.c

446fda4f2 Paul Moore       2006-08-03  1898  
446fda4f2 Paul Moore       2006-08-03  1899  /**
389fb800a Paul Moore       2009-03-27  1900   * cipso_v4_req_setattr - Add a CIPSO option to a connection request socket
389fb800a Paul Moore       2009-03-27  1901   * @req: the connection request socket
389fb800a Paul Moore       2009-03-27  1902   * @doi_def: the CIPSO DOI to use
389fb800a Paul Moore       2009-03-27  1903   * @secattr: the specific security attributes of the socket
014ab19a6 Paul Moore       2008-10-10  1904   *
014ab19a6 Paul Moore       2008-10-10  1905   * Description:
389fb800a Paul Moore       2009-03-27  1906   * Set the CIPSO option on the given socket using the DOI definition and
389fb800a Paul Moore       2009-03-27  1907   * security attributes passed to the function.  Returns zero on success and
389fb800a Paul Moore       2009-03-27  1908   * negative values on failure.
014ab19a6 Paul Moore       2008-10-10  1909   *
014ab19a6 Paul Moore       2008-10-10  1910   */
389fb800a Paul Moore       2009-03-27  1911  int cipso_v4_req_setattr(struct request_sock *req,
389fb800a Paul Moore       2009-03-27  1912  			 const struct cipso_v4_doi *doi_def,
389fb800a Paul Moore       2009-03-27  1913  			 const struct netlbl_lsm_secattr *secattr)
014ab19a6 Paul Moore       2008-10-10  1914  {
389fb800a Paul Moore       2009-03-27  1915  	int ret_val = -EPERM;
389fb800a Paul Moore       2009-03-27  1916  	unsigned char *buf = NULL;
389fb800a Paul Moore       2009-03-27  1917  	u32 buf_len;
389fb800a Paul Moore       2009-03-27  1918  	u32 opt_len;
f6d8bd051 Eric Dumazet     2011-04-21  1919  	struct ip_options_rcu *opt = NULL;
389fb800a Paul Moore       2009-03-27  1920  	struct inet_request_sock *req_inet;
014ab19a6 Paul Moore       2008-10-10  1921  
389fb800a Paul Moore       2009-03-27  1922  	/* We allocate the maximum CIPSO option size here so we are probably
389fb800a Paul Moore       2009-03-27  1923  	 * being a little wasteful, but it makes our life _much_ easier later
389fb800a Paul Moore       2009-03-27  1924  	 * on and after all we are only talking about 40 bytes. */
389fb800a Paul Moore       2009-03-27  1925  	buf_len = CIPSO_V4_OPT_LEN_MAX;
389fb800a Paul Moore       2009-03-27  1926  	buf = kmalloc(buf_len, GFP_ATOMIC);
51456b291 Ian Morris       2015-04-03  1927  	if (!buf) {
389fb800a Paul Moore       2009-03-27  1928  		ret_val = -ENOMEM;
389fb800a Paul Moore       2009-03-27  1929  		goto req_setattr_failure;
389fb800a Paul Moore       2009-03-27  1930  	}
389fb800a Paul Moore       2009-03-27  1931  
389fb800a Paul Moore       2009-03-27  1932  	ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);
389fb800a Paul Moore       2009-03-27  1933  	if (ret_val < 0)
389fb800a Paul Moore       2009-03-27  1934  		goto req_setattr_failure;
389fb800a Paul Moore       2009-03-27  1935  	buf_len = ret_val;
389fb800a Paul Moore       2009-03-27  1936  
389fb800a Paul Moore       2009-03-27  1937  	/* We can't use ip_options_get() directly because it makes a call to
389fb800a Paul Moore       2009-03-27  1938  	 * ip_options_get_alloc() which allocates memory with GFP_KERNEL and
389fb800a Paul Moore       2009-03-27  1939  	 * we won't always have CAP_NET_RAW even though we _always_ want to
389fb800a Paul Moore       2009-03-27  1940  	 * set the IPOPT_CIPSO option. */
389fb800a Paul Moore       2009-03-27  1941  	opt_len = (buf_len + 3) & ~3;
389fb800a Paul Moore       2009-03-27  1942  	opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC);
51456b291 Ian Morris       2015-04-03  1943  	if (!opt) {
389fb800a Paul Moore       2009-03-27  1944  		ret_val = -ENOMEM;
389fb800a Paul Moore       2009-03-27  1945  		goto req_setattr_failure;
389fb800a Paul Moore       2009-03-27  1946  	}
f6d8bd051 Eric Dumazet     2011-04-21  1947  	memcpy(opt->opt.__data, buf, buf_len);
f6d8bd051 Eric Dumazet     2011-04-21  1948  	opt->opt.optlen = opt_len;
f6d8bd051 Eric Dumazet     2011-04-21  1949  	opt->opt.cipso = sizeof(struct iphdr);
389fb800a Paul Moore       2009-03-27  1950  	kfree(buf);
389fb800a Paul Moore       2009-03-27  1951  	buf = NULL;
389fb800a Paul Moore       2009-03-27  1952  
389fb800a Paul Moore       2009-03-27  1953  	req_inet = inet_rsk(req);
389fb800a Paul Moore       2009-03-27 @1954  	opt = xchg(&req_inet->opt, opt);
f6d8bd051 Eric Dumazet     2011-04-21  1955  	if (opt)
4f9c8c1b0 Paul E. McKenney 2012-01-06  1956  		kfree_rcu(opt, rcu);
389fb800a Paul Moore       2009-03-27  1957  
389fb800a Paul Moore       2009-03-27  1958  	return 0;
389fb800a Paul Moore       2009-03-27  1959  
389fb800a Paul Moore       2009-03-27  1960  req_setattr_failure:
389fb800a Paul Moore       2009-03-27  1961  	kfree(buf);
389fb800a Paul Moore       2009-03-27  1962  	kfree(opt);
389fb800a Paul Moore       2009-03-27  1963  	return ret_val;
389fb800a Paul Moore       2009-03-27  1964  }
389fb800a Paul Moore       2009-03-27  1965  

:::::: The code at line 1954 was first introduced by commit
:::::: 389fb800ac8be2832efedd19978a2b8ced37eb61 netlabel: Label incoming TCP connections correctly in SELinux

:::::: TO: Paul Moore <paul.moore@...com>
:::::: CC: James Morris <jmorris@...ei.org>

---
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/gzip" (48800 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ