linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Kees Cook <keescook@chromium.org>
Cc: kbuild-all@01.org,
	syzbot+e2d6cfb305e9f3911dea@syzkaller.appspotmail.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Eric Biggers <ebiggers3@gmail.com>,
	james.morse@arm.com, keun-o.park@darkmatter.ae,
	labbott@redhat.com, linux-mm@kvack.org, mingo@kernel.org
Subject: Re: [PATCH] socket: Provide bounce buffer for constant sized put_cmsg()
Date: Fri, 2 Feb 2018 12:30:42 +0800	[thread overview]
Message-ID: <201802021254.Mc6eJJF3%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180201104143.GA10983@beast>

[-- Attachment #1: Type: text/plain, Size: 16216 bytes --]

Hi Kees,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.15 next-20180201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Kees-Cook/socket-Provide-bounce-buffer-for-constant-sized-put_cmsg/20180202-113637
config: i386-randconfig-s0-201804 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/skbuff.h:23:0,
                    from include/linux/if_ether.h:23,
                    from include/uapi/linux/ethtool.h:19,
                    from include/linux/ethtool.h:18,
                    from include/linux/netdevice.h:41,
                    from include/net/sock.h:51,
                    from include/net/bluetooth/bluetooth.h:29,
                    from net/bluetooth/hci_sock.c:32:
   net/bluetooth/hci_sock.c: In function 'hci_sock_cmsg':
>> include/linux/socket.h:355:19: error: variable or field '_val' declared void
      typeof(*(_ptr)) _val = *(_ptr);    \
                      ^
>> net/bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
>> include/linux/socket.h:355:26: warning: dereferencing 'void *' pointer
      typeof(*(_ptr)) _val = *(_ptr);    \
                             ^~~~~~~
>> net/bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
>> include/linux/socket.h:355:26: error: void value not ignored as it ought to be
      typeof(*(_ptr)) _val = *(_ptr);    \
                             ^
>> net/bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
--
   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/random.h:10,
                    from include/linux/net.h:22,
                    from net/rxrpc/recvmsg.c:14:
   In function 'rxrpc_recvmsg_new_call',
       inlined from 'rxrpc_recvmsg' at net/rxrpc/recvmsg.c:539:7:
>> include/linux/compiler.h:330:38: error: call to '__compiletime_assert_119' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (0)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
>> net/rxrpc/recvmsg.c:119:8: note: in expansion of macro 'put_cmsg'
     ret = put_cmsg(msg, SOL_RXRPC, RXRPC_NEW_CALL, 0, &tmp);
           ^~~~~~~~
   In function 'rxrpc_recvmsg_term',
       inlined from 'rxrpc_recvmsg' at net/rxrpc/recvmsg.c:562:7:
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_77' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (0)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net/rxrpc/recvmsg.c:77:10: note: in expansion of macro 'put_cmsg'
       ret = put_cmsg(msg, SOL_RXRPC, RXRPC_ACK, 0, &tmp);
             ^~~~~~~~
--
   In file included from arch/x86/include/asm/atomic.h:5:0,
                    from include/linux/atomic.h:5,
                    from include/linux/rhashtable.h:20,
                    from net/tipc/socket.c:37:
   net/tipc/socket.c: In function 'tipc_sk_anc_data_recv':
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_1565' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (8)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
>> net/tipc/socket.c:1565:9: note: in expansion of macro 'put_cmsg'
      res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data);
            ^~~~~~~~
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_1601' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (12)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net/tipc/socket.c:1601:9: note: in expansion of macro 'put_cmsg'
      res = put_cmsg(m, SOL_TIPC, TIPC_DESTNAME, 12, anc_data);
            ^~~~~~~~
--
   In file included from include/linux/skbuff.h:23:0,
                    from include/linux/if_ether.h:23,
                    from include/uapi/linux/ethtool.h:19,
                    from include/linux/ethtool.h:18,
                    from include/linux/netdevice.h:41,
                    from include/net/sock.h:51,
                    from include/net/bluetooth/bluetooth.h:29,
                    from net//bluetooth/hci_sock.c:32:
   net//bluetooth/hci_sock.c: In function 'hci_sock_cmsg':
>> include/linux/socket.h:355:19: error: variable or field '_val' declared void
      typeof(*(_ptr)) _val = *(_ptr);    \
                      ^
   net//bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
>> include/linux/socket.h:355:26: warning: dereferencing 'void *' pointer
      typeof(*(_ptr)) _val = *(_ptr);    \
                             ^~~~~~~
   net//bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
>> include/linux/socket.h:355:26: error: void value not ignored as it ought to be
      typeof(*(_ptr)) _val = *(_ptr);    \
                             ^
   net//bluetooth/hci_sock.c:1406:3: note: in expansion of macro 'put_cmsg'
      put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
      ^~~~~~~~
--
   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/random.h:10,
                    from include/linux/net.h:22,
                    from net//rxrpc/recvmsg.c:14:
   In function 'rxrpc_recvmsg_new_call',
       inlined from 'rxrpc_recvmsg' at net//rxrpc/recvmsg.c:539:7:
>> include/linux/compiler.h:330:38: error: call to '__compiletime_assert_119' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (0)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net//rxrpc/recvmsg.c:119:8: note: in expansion of macro 'put_cmsg'
     ret = put_cmsg(msg, SOL_RXRPC, RXRPC_NEW_CALL, 0, &tmp);
           ^~~~~~~~
   In function 'rxrpc_recvmsg_term',
       inlined from 'rxrpc_recvmsg' at net//rxrpc/recvmsg.c:562:7:
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_77' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (0)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net//rxrpc/recvmsg.c:77:10: note: in expansion of macro 'put_cmsg'
       ret = put_cmsg(msg, SOL_RXRPC, RXRPC_ACK, 0, &tmp);
             ^~~~~~~~
--
   In file included from arch/x86/include/asm/atomic.h:5:0,
                    from include/linux/atomic.h:5,
                    from include/linux/rhashtable.h:20,
                    from net//tipc/socket.c:37:
   net//tipc/socket.c: In function 'tipc_sk_anc_data_recv':
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_1565' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (8)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net//tipc/socket.c:1565:9: note: in expansion of macro 'put_cmsg'
      res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data);
            ^~~~~~~~
   include/linux/compiler.h:330:38: error: call to '__compiletime_assert_1601' declared with attribute error: BUILD_BUG_ON failed: sizeof(_val) != (12)
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                         ^
   include/linux/compiler.h:310:4: note: in definition of macro '__compiletime_assert'
       prefix ## suffix();    \
       ^~~~~~
   include/linux/compiler.h:330:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:47:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:71:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
     ^~~~~~~~~~~~~~~~
>> include/linux/socket.h:356:3: note: in expansion of macro 'BUILD_BUG_ON'
      BUILD_BUG_ON(sizeof(_val) != (_len));   \
      ^~~~~~~~~~~~
   net//tipc/socket.c:1601:9: note: in expansion of macro 'put_cmsg'
      res = put_cmsg(m, SOL_TIPC, TIPC_DESTNAME, 12, anc_data);
            ^~~~~~~~

vim +/_val +355 include/linux/socket.h

   343	
   344	extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
   345	extern int __put_cmsg(struct msghdr*, int level, int type, int len, void *data);
   346	/*
   347	 * Provide a bounce buffer for copying cmsg data to userspace when the size
   348	 * is constant. Without this, hardened usercopy will see the dynamic size
   349	 * calculation in __put_cmsg and try to block it. Constant sized copies
   350	 * should not trigger hardened usercopy checks.
   351	 */
   352	#define put_cmsg(_msg, _level, _type, _len, _ptr) ({			\
   353		int _rc;							\
   354		if (__builtin_constant_p(_len)) {				\
 > 355			typeof(*(_ptr)) _val = *(_ptr);				\
 > 356			BUILD_BUG_ON(sizeof(_val) != (_len));			\
   357			_rc = __put_cmsg(_msg, _level, _type, sizeof(_val), &_val); \
   358		} else {							\
   359			_rc = __put_cmsg(_msg, _level, _type, _len, _ptr);	\
   360		}								\
   361		_rc;})
   362	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30983 bytes --]

  reply	other threads:[~2018-02-02  4:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 10:41 Kees Cook
2018-02-02  4:30 ` kbuild test robot [this message]
2018-02-02  6:34 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201802021254.Mc6eJJF3%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=ebiggers3@gmail.com \
    --cc=james.morse@arm.com \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=keun-o.park@darkmatter.ae \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+e2d6cfb305e9f3911dea@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox