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] [day] [month] [year] [list]
Date:   Sun, 26 Nov 2023 08:29:08 +0800
From:   Guo Ren <guoren@...nel.org>
To:     kernel test robot <lkp@...el.com>
Cc:     mark.rutland@....com, peterz@...radead.org, keescook@...omium.org,
        paulmck@...nel.org, ubizjak@...il.com, tglx@...utronix.de,
        oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH V2] locking/atomic: scripts: Increase template priority in
 order variants

On Sat, Nov 25, 2023 at 5:11 PM kernel test robot <lkp@...el.com> wrote:
>
> Hi,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on kees/for-next/pstore]
> [also build test WARNING on kees/for-next/kspp]
> [cannot apply to linus/master v6.7-rc2 next-20231124]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/guoren-kernel-org/locking-atomic-scripts-Increase-template-priority-in-order-variants/20231125-093207
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
> patch link:    https://lore.kernel.org/r/20231125013025.3620560-1-guoren%40kernel.org
> patch subject: [PATCH V2] locking/atomic: scripts: Increase template priority in order variants
> config: i386-defconfig (https://download.01.org/0day-ci/archive/20231125/202311251711.9SeU47cN-lkp@intel.com/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/202311251711.9SeU47cN-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311251711.9SeU47cN-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>    In file included from arch/x86/include/asm/atomic.h:8:0,
>                     from include/linux/atomic.h:7,
>                     from include/linux/cpumask.h:13,
>                     from arch/x86/include/asm/cpumask.h:5,
>                     from arch/x86/include/asm/msr.h:11,
>                     from arch/x86/include/asm/processor.h:23,
>                     from arch/x86/include/asm/timex.h:5,
>                     from include/linux/timex.h:67,
>                     from include/linux/time32.h:13,
>                     from include/linux/time.h:60,
>                     from include/linux/compat.h:10,
>                     from kernel/futex/core.c:34:
>    kernel/futex/core.c: In function 'raw_atomic64_cmpxchg_relaxed':
> >> arch/x86/include/asm/cmpxchg.h:130:2: warning: '__ret' is used uninitialized in this function [-Wuninitialized]
>      __ret;        \
>      ^~~~~
>    arch/x86/include/asm/cmpxchg.h:87:21: note: '__ret' was declared here
>      __typeof__(*(ptr)) __ret;     \
>                         ^
>    arch/x86/include/asm/cmpxchg.h:134:2: note: in expansion of macro '__raw_cmpxchg'
>      __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
>      ^~~~~~~~~~~~~
>    arch/x86/include/asm/cmpxchg.h:149:2: note: in expansion of macro '__cmpxchg'
>      __cmpxchg(ptr, old, new, sizeof(*(ptr)))
>      ^~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
>     #define raw_cmpxchg_relaxed arch_cmpxchg
>                                 ^~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:4107:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>      return raw_cmpxchg_relaxed(&v->counter, old, new);
>             ^~~~~~~~~~~~~~~~~~~
>    In function 'raw_atomic64_cmpxchg_relaxed',
>        inlined from 'get_inode_sequence_number' at include/linux/atomic/atomic-instrumented.h:2817:9,
>        inlined from 'get_futex_key' at kernel/futex/core.c:387:23:
>    arch/x86/include/asm/cmpxchg.h:128:3: error: call to '__cmpxchg_wrong_size' declared with attribute error: Bad argument size for cmpxchg
Gcc is okay, but Clang failed. I would dig it out.

>       __cmpxchg_wrong_size();     \
>       ^~~~~~~~~~~~~~~~~~~~~~
>    arch/x86/include/asm/cmpxchg.h:134:2: note: in expansion of macro '__raw_cmpxchg'
>      __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
>      ^~~~~~~~~~~~~
>    arch/x86/include/asm/cmpxchg.h:149:2: note: in expansion of macro '__cmpxchg'
>      __cmpxchg(ptr, old, new, sizeof(*(ptr)))
>      ^~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
>     #define raw_cmpxchg_relaxed arch_cmpxchg
>                                 ^~~~~~~~~~~~
>    include/linux/atomic/atomic-arch-fallback.h:4107:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>      return raw_cmpxchg_relaxed(&v->counter, old, new);
>             ^~~~~~~~~~~~~~~~~~~
>
>
> vim +/__ret +130 arch/x86/include/asm/cmpxchg.h
>
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   79
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   80  /*
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   81   * Atomic compare and exchange.  Compare OLD with MEM, if identical,
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   82   * store NEW in MEM.  Return the initial value in MEM.  Success is
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   83   * indicated by comparing RETURN with OLD.
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   84   */
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   85  #define __raw_cmpxchg(ptr, old, new, size, lock)                    \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   86  ({                                                                  \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   87      __typeof__(*(ptr)) __ret;                                       \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   88      __typeof__(*(ptr)) __old = (old);                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   89      __typeof__(*(ptr)) __new = (new);                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   90      switch (size) {                                                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   91      case __X86_CASE_B:                                              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   92      {                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   93              volatile u8 *__ptr = (volatile u8 *)(ptr);              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   94              asm volatile(lock "cmpxchgb %2,%1"                      \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   95                           : "=a" (__ret), "+m" (*__ptr)              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   96                           : "q" (__new), "0" (__old)                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   97                           : "memory");                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   98              break;                                                  \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18   99      }                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  100      case __X86_CASE_W:                                              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  101      {                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  102              volatile u16 *__ptr = (volatile u16 *)(ptr);            \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  103              asm volatile(lock "cmpxchgw %2,%1"                      \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  104                           : "=a" (__ret), "+m" (*__ptr)              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  105                           : "r" (__new), "0" (__old)                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  106                           : "memory");                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  107              break;                                                  \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  108      }                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  109      case __X86_CASE_L:                                              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  110      {                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  111              volatile u32 *__ptr = (volatile u32 *)(ptr);            \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  112              asm volatile(lock "cmpxchgl %2,%1"                      \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  113                           : "=a" (__ret), "+m" (*__ptr)              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  114                           : "r" (__new), "0" (__old)                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  115                           : "memory");                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  116              break;                                                  \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  117      }                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  118      case __X86_CASE_Q:                                              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  119      {                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  120              volatile u64 *__ptr = (volatile u64 *)(ptr);            \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  121              asm volatile(lock "cmpxchgq %2,%1"                      \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  122                           : "=a" (__ret), "+m" (*__ptr)              \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  123                           : "r" (__new), "0" (__old)                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  124                           : "memory");                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  125              break;                                                  \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  126      }                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  127      default:                                                        \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  128              __cmpxchg_wrong_size();                                 \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  129      }                                                               \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18 @130      __ret;                                                          \
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  131  })
> e9826380d83d1b Jeremy Fitzhardinge 2011-08-18  132
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki



-- 
Best Regards
 Guo Ren

Powered by blists - more mailing lists