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-next>] [day] [month] [year] [list]
Message-ID: <201708171831.UZFoxEFx%fengguang.wu@intel.com>
Date:   Thu, 17 Aug 2017 18:33:35 +0800
From:   kbuild test robot <fengguang.wu@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     kbuild-all@...org, linux-kernel@...r.kernel.org,
        tipbuild@...or.com, Ingo Molnar <mingo@...nel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: [tip:locking/core 36/40] arch/x86/include/asm/refcount.h:21:2:
 error: expected ':' or ')' before 'ASM_UNREACHABLE'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
head:   52fa5bc5cbba089f09bc2c372e3432f3f3e48051
commit: 7a46ec0e2f4850407de5e1d19a44edee6efa58ec [36/40] locking/refcounts, x86/asm: Implement fast refcount overflow protection
config: i386-tinyconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 7a46ec0e2f4850407de5e1d19a44edee6efa58ec
        # save the attached .config to linux build tree
        make ARCH=i386 

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

   In file included from include/linux/refcount.h:57:0,
                    from include/linux/kref.h:19,
                    from include/linux/kobject.h:24,
                    from include/linux/irqdesc.h:5,
                    from include/linux/irq.h:495,
                    from arch/x86/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from arch/x86/kernel/asm-offsets.c:11:
   arch/x86/include/asm/refcount.h: In function 'refcount_add':
>> arch/x86/include/asm/refcount.h:21:2: error: expected ':' or ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
>> arch/x86/include/asm/refcount.h:29:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:44:3: note: in expansion of macro 'REFCOUNT_CHECK_LT_ZERO'
      REFCOUNT_CHECK_LT_ZERO
      ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h: In function 'refcount_inc':
>> arch/x86/include/asm/refcount.h:21:2: error: expected ':' or ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
>> arch/x86/include/asm/refcount.h:29:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h:53:3: note: in expansion of macro 'REFCOUNT_CHECK_LT_ZERO'
      REFCOUNT_CHECK_LT_ZERO
      ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h: In function 'refcount_dec':
>> arch/x86/include/asm/refcount.h:21:2: error: expected ':' or ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
>> arch/x86/include/asm/refcount.h:29:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h:34:2: note: in expansion of macro 'REFCOUNT_CHECK_LT_ZERO'
     REFCOUNT_CHECK_LT_ZERO
     ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:61:3: note: in expansion of macro 'REFCOUNT_CHECK_LE_ZERO'
      REFCOUNT_CHECK_LE_ZERO
      ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h: In function 'refcount_sub_and_test':
>> arch/x86/include/asm/refcount.h:69:2: error: implicit declaration of function 'GEN_BINARY_SUFFIXED_RMWcc' [-Werror=implicit-function-declaration]
     GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl", REFCOUNT_CHECK_LT_ZERO,
     ^~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:21:2: error: expected ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
>> arch/x86/include/asm/refcount.h:29:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h:69:48: note: in expansion of macro 'REFCOUNT_CHECK_LT_ZERO'
     GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl", REFCOUNT_CHECK_LT_ZERO,
                                                   ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:71:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   arch/x86/include/asm/refcount.h: In function 'refcount_dec_and_test':
>> arch/x86/include/asm/refcount.h:75:2: error: implicit declaration of function 'GEN_UNARY_SUFFIXED_RMWcc' [-Werror=implicit-function-declaration]
     GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", REFCOUNT_CHECK_LT_ZERO,
     ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:21:2: error: expected ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
>> arch/x86/include/asm/refcount.h:29:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h:75:47: note: in expansion of macro 'REFCOUNT_CHECK_LT_ZERO'
     GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", REFCOUNT_CHECK_LT_ZERO,
                                                  ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/refcount.h:77:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   arch/x86/include/asm/refcount.h: In function 'refcount_add_not_zero':
>> arch/x86/include/asm/refcount.h:21:2: error: expected ':' or ')' before 'ASM_UNREACHABLE'
     ASM_UNREACHABLE     \
     ^
   arch/x86/include/asm/refcount.h:39:2: note: in expansion of macro '_REFCOUNT_EXCEPTION'
     _REFCOUNT_EXCEPTION
     ^~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/refcount.h:93:17: note: in expansion of macro 'REFCOUNT_ERROR'
       asm volatile(REFCOUNT_ERROR
                    ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +21 arch/x86/include/asm/refcount.h

     8	
     9	/*
    10	 * This is the first portion of the refcount error handling, which lives in
    11	 * .text.unlikely, and is jumped to from the CPU flag check (in the
    12	 * following macros). This saves the refcount value location into CX for
    13	 * the exception handler to use (in mm/extable.c), and then triggers the
    14	 * central refcount exception. The fixup address for the exception points
    15	 * back to the regular execution flow in .text.
    16	 */
    17	#define _REFCOUNT_EXCEPTION				\
    18		".pushsection .text.unlikely\n"			\
    19		"111:\tlea %[counter], %%" _ASM_CX "\n"		\
    20		"112:\t" ASM_UD0 "\n"				\
  > 21		ASM_UNREACHABLE					\
    22		".popsection\n"					\
    23		"113:\n"					\
    24		_ASM_EXTABLE_REFCOUNT(112b, 113b)
    25	
    26	/* Trigger refcount exception if refcount result is negative. */
    27	#define REFCOUNT_CHECK_LT_ZERO				\
    28		"js 111f\n\t"					\
  > 29		_REFCOUNT_EXCEPTION
    30	
    31	/* Trigger refcount exception if refcount result is zero or negative. */
    32	#define REFCOUNT_CHECK_LE_ZERO				\
    33		"jz 111f\n\t"					\
  > 34		REFCOUNT_CHECK_LT_ZERO
    35	
    36	/* Trigger refcount exception unconditionally. */
    37	#define REFCOUNT_ERROR					\
    38		"jmp 111f\n\t"					\
    39		_REFCOUNT_EXCEPTION
    40	
    41	static __always_inline void refcount_add(unsigned int i, refcount_t *r)
    42	{
    43		asm volatile(LOCK_PREFIX "addl %1,%0\n\t"
  > 44			REFCOUNT_CHECK_LT_ZERO
    45			: [counter] "+m" (r->refs.counter)
    46			: "ir" (i)
    47			: "cc", "cx");
    48	}
    49	
    50	static __always_inline void refcount_inc(refcount_t *r)
    51	{
    52		asm volatile(LOCK_PREFIX "incl %0\n\t"
    53			REFCOUNT_CHECK_LT_ZERO
    54			: [counter] "+m" (r->refs.counter)
    55			: : "cc", "cx");
    56	}
    57	
    58	static __always_inline void refcount_dec(refcount_t *r)
    59	{
    60		asm volatile(LOCK_PREFIX "decl %0\n\t"
  > 61			REFCOUNT_CHECK_LE_ZERO
    62			: [counter] "+m" (r->refs.counter)
    63			: : "cc", "cx");
    64	}
    65	
    66	static __always_inline __must_check
    67	bool refcount_sub_and_test(unsigned int i, refcount_t *r)
    68	{
  > 69		GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl", REFCOUNT_CHECK_LT_ZERO,
    70					  r->refs.counter, "er", i, "%0", e);
  > 71	}
    72	
    73	static __always_inline __must_check bool refcount_dec_and_test(refcount_t *r)
    74	{
  > 75		GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", REFCOUNT_CHECK_LT_ZERO,
    76					 r->refs.counter, "%0", e);
    77	}
    78	
    79	static __always_inline __must_check
    80	bool refcount_add_not_zero(unsigned int i, refcount_t *r)
    81	{
    82		int c, result;
    83	
    84		c = atomic_read(&(r->refs));
    85		do {
    86			if (unlikely(c == 0))
    87				return false;
    88	
    89			result = c + i;
    90	
    91			/* Did we try to increment from/to an undesirable state? */
    92			if (unlikely(c < 0 || c == INT_MAX || result < c)) {
  > 93				asm volatile(REFCOUNT_ERROR
    94					     : : [counter] "m" (r->refs.counter)
    95					     : "cc", "cx");
    96				break;
    97			}
    98	
    99		} while (!atomic_try_cmpxchg(&(r->refs), &c, result));
   100	
   101		return c != 0;
   102	}
   103	

---
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" (6670 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ