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>] [day] [month] [year] [list]
Message-ID: <202108180817.bwSgjaxK-lkp@intel.com>
Date:   Wed, 18 Aug 2021 08:12:23 +0800
From:   kernel test robot <lkp@...el.com>
To:     Scott Wood <swood@...hat.com>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: [linux-rt-devel:linux-5.14.y-rt-rebase 194/245]
 kernel/rcu/rcutorture.c:1525:16: warning: Value stored to 'preempts_irq'
 during its initialization is never read [clang-analyzer-deadcode.DeadStores]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.14.y-rt-rebase
head:   0eead4e5a60cb716ec911a552787a69332cf6943
commit: 32a3c5313cce130c4526507975314b84714b043a [194/245] rcutorture: Avoid problematic critical section nesting on RT
config: mips-randconfig-c004-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?id=32a3c5313cce130c4526507975314b84714b043a
        git remote add linux-rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
        git fetch --no-tags linux-rt-devel linux-5.14.y-rt-rebase
        git checkout 32a3c5313cce130c4526507975314b84714b043a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


clang-analyzer warnings: (new ones prefixed by >>)
                   ^
   kernel/rcu/rcutorture.c:1734:9: note: Calling 'timer_pending'
                           if (!timer_pending(&t))
                                ^~~~~~~~~~~~~~~~~
   include/linux/timer.h:168:10: note: Calling 'hlist_unhashed_lockless'
           return !hlist_unhashed_lockless(&timer->entry);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:821:10: note: Left side of '||' is false
           return !READ_ONCE(h->pprev);
                   ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/list.h:821:10: note: Left side of '||' is false
           return !READ_ONCE(h->pprev);
                   ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/list.h:821:10: note: Left side of '||' is true
           return !READ_ONCE(h->pprev);
                   ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:291:28: note: expanded from macro '__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   include/linux/list.h:821:10: note: Taking false branch
           return !READ_ONCE(h->pprev);
                   ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
           ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/list.h:821:10: note: Loop condition is false.  Exiting loop
           return !READ_ONCE(h->pprev);
                   ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
           ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   include/linux/list.h:821:2: note: Undefined or garbage value returned to caller
           return !READ_ONCE(h->pprev);
           ^      ~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:387:3: warning: Value stored to 'started' is never read [clang-analyzer-deadcode.DeadStores]
                   started = cur_ops->get_gp_seq();
                   ^         ~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:387:3: note: Value stored to 'started' is never read
                   started = cur_ops->get_gp_seq();
                   ^         ~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:388:3: warning: Value stored to 'ts' is never read [clang-analyzer-deadcode.DeadStores]
                   ts = rcu_trace_clock_local();
                   ^    ~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:388:3: note: Value stored to 'ts' is never read
                   ts = rcu_trace_clock_local();
                   ^    ~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:393:3: warning: Value stored to 'completed' is never read [clang-analyzer-deadcode.DeadStores]
                   completed = cur_ops->get_gp_seq();
                   ^           ~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:393:3: note: Value stored to 'completed' is never read
                   completed = cur_ops->get_gp_seq();
                   ^           ~~~~~~~~~~~~~~~~~~~~~
>> kernel/rcu/rcutorture.c:1525:16: warning: Value stored to 'preempts_irq' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
                         ^~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1525:16: note: Value stored to 'preempts_irq' during its initialization is never read
           unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
                         ^~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1634:2: warning: Value stored to 'ts' is never read [clang-analyzer-deadcode.DeadStores]
           ts = rcu_trace_clock_local();
           ^    ~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1634:2: note: Value stored to 'ts' is never read
           ts = rcu_trace_clock_local();
           ^    ~~~~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1667:13: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
                   WARN_ONCE(cur_ops->poll_gp_state(cookie),
                             ^
   include/asm-generic/bug.h:150:18: note: expanded from macro 'WARN_ONCE'
           DO_ONCE_LITE_IF(condition, WARN, 1, format)
                           ^~~~~~~~~
   include/linux/once_lite.h:15:27: note: expanded from macro 'DO_ONCE_LITE_IF'
                   bool __ret_do_once = !!(condition);                     \
                                           ^~~~~~~~~
   kernel/rcu/rcutorture.c:1615:2: note: 'cookie' declared without an initial value
           unsigned long cookie;
           ^~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1628:2: note: '__ret_do_once' is false
           WARN_ON_ONCE(!rcu_is_watching());
           ^
   include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
           DO_ONCE_LITE_IF(condition, WARN_ON, 1)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/once_lite.h:17:16: note: expanded from macro 'DO_ONCE_LITE_IF'
                   if (unlikely(__ret_do_once && !__already_done)) {       \
                                ^~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   kernel/rcu/rcutorture.c:1628:2: note: Left side of '&&' is false
           WARN_ON_ONCE(!rcu_is_watching());
           ^
   include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
           DO_ONCE_LITE_IF(condition, WARN_ON, 1)
           ^
   include/linux/once_lite.h:17:30: note: expanded from macro 'DO_ONCE_LITE_IF'
                   if (unlikely(__ret_do_once && !__already_done)) {       \
                                              ^
   kernel/rcu/rcutorture.c:1628:2: note: Taking false branch
           WARN_ON_ONCE(!rcu_is_watching());
           ^
   include/asm-generic/bug.h:146:2: note: expanded from macro 'WARN_ON_ONCE'
           DO_ONCE_LITE_IF(condition, WARN_ON, 1)
           ^
   include/linux/once_lite.h:17:3: note: expanded from macro 'DO_ONCE_LITE_IF'
                   if (unlikely(__ret_do_once && !__already_done)) {       \
                   ^
   kernel/rcu/rcutorture.c:1631:6: note: Assuming field 'get_gp_state' is null
           if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
               ^~~~~~~~~~~~~~~~~~~~~
   kernel/rcu/rcutorture.c:1631:28: note: Left side of '&&' is false
           if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
                                     ^
   kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is false
           p = rcu_dereference_check(rcu_torture_current,
               ^
   include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:403:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is false
           p = rcu_dereference_check(rcu_torture_current,
               ^
   include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
           ^
   include/linux/rcupdate.h:403:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   kernel/rcu/rcutorture.c:1635:6: note: Left side of '||' is true
           p = rcu_dereference_check(rcu_torture_current,
               ^
   include/linux/rcupdate.h:542:2: note: expanded from macro 'rcu_dereference_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)

vim +/preempts_irq +1525 kernel/rcu/rcutorture.c

  1516	
  1517	/* Return a random protection state mask, but with at least one bit set. */
  1518	static int
  1519	rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp)
  1520	{
  1521		int mask = rcutorture_extend_mask_max();
  1522		unsigned long randmask1 = torture_random(trsp) >> 8;
  1523		unsigned long randmask2 = randmask1 >> 3;
  1524		unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED;
> 1525		unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
  1526		unsigned long nonatomic_bhs = RCUTORTURE_RDR_BH | RCUTORTURE_RDR_RBH;
  1527		unsigned long atomic_bhs = RCUTORTURE_RDR_ATOM_BH |
  1528					   RCUTORTURE_RDR_ATOM_RBH;
  1529		unsigned long tmp;
  1530	
  1531		WARN_ON_ONCE(mask >> RCUTORTURE_RDR_SHIFT);
  1532		/* Mostly only one bit (need preemption!), sometimes lots of bits. */
  1533		if (!(randmask1 & 0x7))
  1534			mask = mask & randmask2;
  1535		else
  1536			mask = mask & (1 << (randmask2 % RCUTORTURE_RDR_NBITS));
  1537	
  1538		/*
  1539		 * Can't enable bh w/irq disabled.
  1540		 */
  1541		tmp = atomic_bhs | nonatomic_bhs;
  1542		if (mask & RCUTORTURE_RDR_IRQ)
  1543			mask |= oldmask & tmp;
  1544	
  1545		/*
  1546		 * Ideally these sequences would be detected in debug builds
  1547		 * (regardless of RT), but until then don't stop testing
  1548		 * them on non-RT.
  1549		 */
  1550		if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
  1551			/*
  1552			 * Can't release the outermost rcu lock in an irq disabled
  1553			 * section without preemption also being disabled, if irqs
  1554			 * had ever been enabled during this RCU critical section
  1555			 * (could leak a special flag and delay reporting the qs).
  1556			 */
  1557			if ((oldmask & RCUTORTURE_RDR_RCU) &&
  1558			    (mask & RCUTORTURE_RDR_IRQ) &&
  1559			    !(mask & preempts))
  1560				mask |= RCUTORTURE_RDR_RCU;
  1561	
  1562			/* Can't modify atomic bh in non-atomic context */
  1563			if ((oldmask & atomic_bhs) && (mask & atomic_bhs) &&
  1564			    !(mask & preempts_irq)) {
  1565				mask |= oldmask & preempts_irq;
  1566				if (mask & RCUTORTURE_RDR_IRQ)
  1567					mask |= oldmask & tmp;
  1568			}
  1569			if ((mask & atomic_bhs) && !(mask & preempts_irq))
  1570				mask |= RCUTORTURE_RDR_PREEMPT;
  1571	
  1572			/* Can't modify non-atomic bh in atomic context */
  1573			tmp = nonatomic_bhs;
  1574			if (oldmask & preempts_irq)
  1575				mask &= ~tmp;
  1576			if ((oldmask | mask) & preempts_irq)
  1577				mask |= oldmask & tmp;
  1578		}
  1579	
  1580		return mask ?: RCUTORTURE_RDR_RCU;
  1581	}
  1582	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (35604 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ