tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: af30725c132e2e5c5369b60369ff0771fde7d4ff
commit: 4e23395b9e97562d12b87a330a2fca3bf10c8663 [10774/15793] kcsan: Support
distinguishing volatile accesses
config: x86_64-randconfig-r013-20200605 (attached as .config)
compiler: clang version 11.0.0 (
https://github.com/llvm/llvm-project
6dd738e2f0609f7d3313b574a1d471263d2d3ba1)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 4e23395b9e97562d12b87a330a2fca3bf10c8663
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
DEFINE_TSAN_READ_WRITE(4);
^
kernel/kcsan/core.c:757:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
<scratch space>:92:1: note: expanded from here
__tsan_read4
^
kernel/kcsan/core.c:776:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_READ_WRITE(4);
^
static
kernel/kcsan/core.c:757:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
kernel/kcsan/core.c:776:1: warning: no previous prototype for function
'__tsan_write4' [-Wmissing-prototypes]
DEFINE_TSAN_READ_WRITE(4);
^
kernel/kcsan/core.c:765:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
<scratch space>:126:1: note: expanded from here
__tsan_write4
^
kernel/kcsan/core.c:776:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:765:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
kernel/kcsan/core.c:777:1: warning: no previous prototype for function
'__tsan_read8' [-Wmissing-prototypes]
DEFINE_TSAN_READ_WRITE(8);
^
kernel/kcsan/core.c:757:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
<scratch space>:160:1: note: expanded from here
__tsan_read8
^
kernel/kcsan/core.c:777:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_READ_WRITE(8);
^
static
kernel/kcsan/core.c:757:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
kernel/kcsan/core.c:777:1: warning: no previous prototype for function
'__tsan_write8' [-Wmissing-prototypes]
DEFINE_TSAN_READ_WRITE(8);
^
kernel/kcsan/core.c:765:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
<scratch space>:15:1: note: expanded from here
__tsan_write8
^
kernel/kcsan/core.c:777:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:765:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
kernel/kcsan/core.c:778:1: warning: no previous prototype for function
'__tsan_read16' [-Wmissing-prototypes]
DEFINE_TSAN_READ_WRITE(16);
^
kernel/kcsan/core.c:757:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
<scratch space>:49:1: note: expanded from here
__tsan_read16
^
kernel/kcsan/core.c:778:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_READ_WRITE(16);
^
static
kernel/kcsan/core.c:757:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_read##size(void *ptr) ^
kernel/kcsan/core.c:778:1: warning: no previous prototype for function
'__tsan_write16' [-Wmissing-prototypes]
DEFINE_TSAN_READ_WRITE(16);
^
kernel/kcsan/core.c:765:7: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
<scratch space>:83:1: note: expanded from here
__tsan_write16
^
kernel/kcsan/core.c:778:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:765:2: note: expanded from macro 'DEFINE_TSAN_READ_WRITE'
void __tsan_write##size(void *ptr) ^
kernel/kcsan/core.c:780:6: warning: no previous prototype for function
'__tsan_read_range' [-Wmissing-prototypes]
void __tsan_read_range(void *ptr, size_t size)
^
kernel/kcsan/core.c:780:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
void __tsan_read_range(void *ptr, size_t size)
^
static
kernel/kcsan/core.c:786:6: warning: no previous prototype for function
'__tsan_write_range' [-Wmissing-prototypes]
void __tsan_write_range(void *ptr, size_t size)
^
kernel/kcsan/core.c:786:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
void __tsan_write_range(void *ptr, size_t size)
^
static
> kernel/kcsan/core.c:829:1: warning: no previous prototype for
function '__tsan_volatile_read1' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(1);
^
kernel/kcsan/core.c:802:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
<scratch space>:145:1: note: expanded from here
__tsan_volatile_read1
^
kernel/kcsan/core.c:829:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_VOLATILE_READ_WRITE(1);
^
static
kernel/kcsan/core.c:802:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
> kernel/kcsan/core.c:829:1: warning: no previous prototype for
function '__tsan_volatile_write1' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(1);
^
kernel/kcsan/core.c:814:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
<scratch space>:18:1: note: expanded from here
__tsan_volatile_write1
^
kernel/kcsan/core.c:829:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:814:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
> kernel/kcsan/core.c:830:1: warning: no previous prototype for
function '__tsan_volatile_read2' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(2);
^
kernel/kcsan/core.c:802:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
<scratch space>:56:1: note: expanded from here
__tsan_volatile_read2
^
kernel/kcsan/core.c:830:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_VOLATILE_READ_WRITE(2);
^
static
kernel/kcsan/core.c:802:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
> kernel/kcsan/core.c:830:1: warning: no previous prototype for
function '__tsan_volatile_write2' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(2);
^
kernel/kcsan/core.c:814:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
<scratch space>:94:1: note: expanded from here
__tsan_volatile_write2
^
kernel/kcsan/core.c:830:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:814:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
> kernel/kcsan/core.c:831:1: warning: no previous prototype for
function '__tsan_volatile_read4' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(4);
^
kernel/kcsan/core.c:802:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
<scratch space>:6:1: note: expanded from here
__tsan_volatile_read4
^
kernel/kcsan/core.c:831:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_VOLATILE_READ_WRITE(4);
^
static
kernel/kcsan/core.c:802:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
> kernel/kcsan/core.c:831:1: warning: no previous prototype for
function '__tsan_volatile_write4' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(4);
^
kernel/kcsan/core.c:814:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
<scratch space>:44:1: note: expanded from here
__tsan_volatile_write4
^
kernel/kcsan/core.c:831:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:814:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
> kernel/kcsan/core.c:832:1: warning: no previous prototype for
function '__tsan_volatile_read8' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(8);
^
kernel/kcsan/core.c:802:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
<scratch space>:82:1: note: expanded from here
__tsan_volatile_read8
^
kernel/kcsan/core.c:832:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_VOLATILE_READ_WRITE(8);
^
static
kernel/kcsan/core.c:802:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
> kernel/kcsan/core.c:832:1: warning: no previous prototype for
function '__tsan_volatile_write8' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(8);
^
kernel/kcsan/core.c:814:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
<scratch space>:120:1: note: expanded from here
__tsan_volatile_write8
^
kernel/kcsan/core.c:832:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:814:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
> kernel/kcsan/core.c:833:1: warning: no previous prototype for
function '__tsan_volatile_read16' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(16);
^
kernel/kcsan/core.c:802:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
<scratch space>:30:1: note: expanded from here
__tsan_volatile_read16
^
kernel/kcsan/core.c:833:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
DEFINE_TSAN_VOLATILE_READ_WRITE(16);
^
static
kernel/kcsan/core.c:802:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_read##size(void *ptr) ^
> kernel/kcsan/core.c:833:1: warning: no previous prototype for
function '__tsan_volatile_write16' [-Wmissing-prototypes]
DEFINE_TSAN_VOLATILE_READ_WRITE(16);
^
kernel/kcsan/core.c:814:7: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
<scratch space>:68:1: note: expanded from here
__tsan_volatile_write16
^
kernel/kcsan/core.c:833:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
kernel/kcsan/core.c:814:2: note: expanded from macro
'DEFINE_TSAN_VOLATILE_READ_WRITE'
void __tsan_volatile_write##size(void *ptr) ^
kernel/kcsan/core.c:839:6: warning: no previous prototype for function
'__tsan_func_entry' [-Wmissing-prototypes]
void __tsan_func_entry(void *call_pc)
^
kernel/kcsan/core.c:839:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
void __tsan_func_entry(void *call_pc)
^
static
kernel/kcsan/core.c:843:6: warning: no previous prototype for function
'__tsan_func_exit' [-Wmissing-prototypes]
void __tsan_func_exit(void)
^
kernel/kcsan/core.c:843:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
void __tsan_func_exit(void)
^
static
kernel/kcsan/core.c:847:6: warning: no previous prototype for function
'__tsan_init' [-Wmissing-prototypes]
void __tsan_init(void)
^
kernel/kcsan/core.c:847:1: note: declare 'static' if the function is not intended
to be used outside of this translation unit
void __tsan_init(void)
^
static
25 warnings generated.
vim +/__tsan_volatile_read1 +829 kernel/kcsan/core.c
791
792 /*
793 * Use of explicit volatile is generally disallowed [1], however, volatile is
794 * still used in various concurrent context, whether in low-level
795 * synchronization primitives or for legacy reasons.
796 * [1]
https://lwn.net/Articles/233479/
797 *
798 * We only consider volatile accesses atomic if they are aligned and would pass
799 * the size-check of compiletime_assert_rwonce_type().
800 */
801 #define DEFINE_TSAN_VOLATILE_READ_WRITE(size) \
802 void __tsan_volatile_read##size(void *ptr) \
803 { \
804 const bool is_atomic = size <= sizeof(long long) && \
805 IS_ALIGNED((unsigned long)ptr, size); \
806 if (IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS) && is_atomic) \
807 return; \
808 check_access(ptr, size, is_atomic ? KCSAN_ACCESS_ATOMIC : 0); \
809 } \
810 EXPORT_SYMBOL(__tsan_volatile_read##size); \
811 void __tsan_unaligned_volatile_read##size(void *ptr) \
812 __alias(__tsan_volatile_read##size); \
813 EXPORT_SYMBOL(__tsan_unaligned_volatile_read##size); \
814 void __tsan_volatile_write##size(void *ptr) \
815 { \
816 const bool is_atomic = size <= sizeof(long long) && \
817 IS_ALIGNED((unsigned long)ptr, size); \
818 if (IS_ENABLED(CONFIG_KCSAN_IGNORE_ATOMICS) && is_atomic) \
819 return; \
820 check_access(ptr, size, \
821 KCSAN_ACCESS_WRITE | \
822 (is_atomic ? KCSAN_ACCESS_ATOMIC : 0)); \
823 } \
824 EXPORT_SYMBOL(__tsan_volatile_write##size); \
825 void __tsan_unaligned_volatile_write##size(void *ptr) \
826 __alias(__tsan_volatile_write##size); \
827 EXPORT_SYMBOL(__tsan_unaligned_volatile_write##size)
828
829 DEFINE_TSAN_VOLATILE_READ_WRITE(1);
830 DEFINE_TSAN_VOLATILE_READ_WRITE(2);
831 DEFINE_TSAN_VOLATILE_READ_WRITE(4);
832 DEFINE_TSAN_VOLATILE_READ_WRITE(8);
833 DEFINE_TSAN_VOLATILE_READ_WRITE(16);
834
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org