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: <202203221253.Vhpboxoj-lkp@intel.com>
Date:   Tue, 22 Mar 2022 12:29:28 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [jgunthorpe:iommufd 7/13]
 drivers/iommu/iommufd/io_pagetable.c:486:14: warning: comparison of distinct
 pointer types ('typeof (iova) (aka 'unsigned long and 'typeof (length - 1)
 (aka 'unsigned int

tree:   https://github.com/jgunthorpe/linux iommufd
head:   fc388f906088fe5f5f2db6a36931e00124f52042
commit: 1af524ce30ddf820ec974c8635d3299caefc72ed [7/13] iommufd: Data structure to provide IOVA to PFN mapping
config: mips-randconfig-c004-20220322 (https://download.01.org/0day-ci/archive/20220322/202203221253.Vhpboxoj-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
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://github.com/jgunthorpe/linux/commit/1af524ce30ddf820ec974c8635d3299caefc72ed
        git remote add jgunthorpe https://github.com/jgunthorpe/linux
        git fetch --no-tags jgunthorpe iommufd
        git checkout 1af524ce30ddf820ec974c8635d3299caefc72ed
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips 

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

All warnings (new ones prefixed by >>):

>> drivers/iommu/iommufd/io_pagetable.c:486:14: warning: comparison of distinct pointer types ('typeof (iova) (aka 'unsigned long and 'typeof (length - 1) (aka 'unsigned int
   WARN_ON(check_add_overflow(iova, length - 1, &last_iova)))
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:66:15: note: expanded from macro 'check_add_overflow'
   (void) (&__a == &__b); ~~~~ ^ ~~~~
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
   int __ret_warn_on = ^~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( , ## __VA_ARGS__) ) )
   ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) (cond) : __trace_if_value(cond))
   ^~~~
>> drivers/iommu/iommufd/io_pagetable.c:486:14: warning: comparison of distinct pointer types ('typeof (iova) (aka 'unsigned long and 'typeof (length - 1) (aka 'unsigned int
   WARN_ON(check_add_overflow(iova, length - 1, &last_iova)))
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:66:15: note: expanded from macro 'check_add_overflow'
   (void) (&__a == &__b); ~~~~ ^ ~~~~
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
   int __ret_warn_on = ^~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( , ## __VA_ARGS__) ) )
   ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) (cond) : __trace_if_value(cond))
   ^~~~
>> drivers/iommu/iommufd/io_pagetable.c:486:14: warning: comparison of distinct pointer types ('typeof (iova) (aka 'unsigned long and 'typeof (length - 1) (aka 'unsigned int
   WARN_ON(check_add_overflow(iova, length - 1, &last_iova)))
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:66:15: note: expanded from macro 'check_add_overflow'
   (void) (&__a == &__b); ~~~~ ^ ~~~~
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
   int __ret_warn_on = ^~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( , ## __VA_ARGS__) ) )
   ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) (cond) : __trace_if_value(cond))
   ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
   (cond) ^~~~
   fatal error: error in backend: Nested variants found in inline asm string: ' .set push
   .set mips64r2
   .if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/atomic.h", .line = 156, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
   1: ll $1, $2 # atomic_fetch_sub
   subu $0, $1, $3
   sc $0, $2
   beqz $0, 1b
   .set pop
   move $0, $1
   '
   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
   Stack dump:
   0. Program arguments: clang -Wp,-MMD,drivers/iommu/iommufd/.io_pagetable.o.d -nostdinc -Iarch/mips/include -I./arch/mips/include/generated -Iinclude -I./include -Iarch/mips/include/uapi -I./arch/mips/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff84000000 -DLINKER_LOAD_ADDRESS=0x84000000 -DDATAOFFSET=0 -Qunused-arguments -fmacro-prefix-map== -DKBUILD_EXTRA_WARN1 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 --target=mips-linux -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -EB -fno-stack-check -march=mips32 -Wa,-mips32 -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -Iarch/mips/include/asm/mach-bcm63xx/ -Iarch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -Os -Wframe-larger-than=1024 -fno-stack-protector -Wimplicit-fallthrough -Wno-gnu -mno-global-merge -Wno-unused-but-set-variable -Wno-unused-const-variable -ftrivial-auto-var-init=pattern -fno-stack-clash-protection -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wextra -Wunused -Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs -Wunused-but-set-variable -Wunused-const-variable -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -fsanitize=array-bounds -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize-coverage=trace-pc -I drivers/iommu/iommufd -I ./drivers/iommu/iommufd -DKBUILD_MODFILE="drivers/iommu/iommufd/iommufd" -DKBUILD_BASENAME="io_pagetable" -DKBUILD_MODNAME="iommufd" -D__KBUILD_MODNAME=kmod_iommufd -c -o drivers/iommu/iommufd/io_pagetable.o drivers/iommu/iommufd/io_pagetable.c
   1. <eof> parser at end of file
   2. Code generation
   3. Running pass 'Function Pass Manager' on module 'drivers/iommu/iommufd/io_pagetable.c'.
   4. Running pass 'Mips Assembly Printer' on function '@...t_map_user_pages'
   #0 0x00005635c4ce26bf Signals.cpp:0:0
   #1 0x00005635c4ce059c llvm::sys::CleanupOnSignal(unsigned long) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x349f59c)
   #2 0x00005635c4c1ffc7 llvm::CrashRecoveryContext::HandleExit(int) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x33defc7)
   #3 0x00005635c4cd8c4e llvm::sys::Process::Exit(int, bool) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3497c4e)
   #4 0x00005635c28dd18b (/opt/cross/clang-85e9b2687a/bin/clang-15+0x109c18b)
   #5 0x00005635c4c26aec llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x33e5aec)
   #6 0x00005635c5943880 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const (/opt/cross/clang-85e9b2687a/bin/clang-15+0x4102880)
   #7 0x00005635c593f744 llvm::AsmPrinter::emitFunctionBody() (/opt/cross/clang-85e9b2687a/bin/clang-15+0x40fe744)
   #8 0x00005635c33587a7 llvm::MipsAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x1b177a7)
   #9 0x00005635c4022cbd llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.53) MachineFunctionPass.cpp:0:0
   #10 0x00005635c446a857 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x2c29857)
   #11 0x00005635c446a9d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x2c299d1)
   #12 0x00005635c446b54f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x2c2a54f)
   #13 0x00005635c5001f47 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x37c0f47)
   #14 0x00005635c5c642e3 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x44232e3)
   #15 0x00005635c6777b71 clang::ParseAST(clang::Sema&, bool, bool) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x4f36b71)
   #16 0x00005635c5c639c5 clang::CodeGenAction::ExecuteAction() (/opt/cross/clang-85e9b2687a/bin/clang-15+0x44229c5)
   #17 0x00005635c565cec1 clang::FrontendAction::Execute() (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3e1bec1)
   #18 0x00005635c55f2d1a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3db1d1a)
   #19 0x00005635c57227bb (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3ee17bb)
   #20 0x00005635c28de73c cc1_main(llvm::ArrayRef<char char (/opt/cross/clang-85e9b2687a/bin/clang-15+0x109d73c)
   #21 0x00005635c28db40b ExecuteCC1Tool(llvm::SmallVectorImpl<char driver.cpp:0:0
   #22 0x00005635c548a0a5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const::'lambda'()>(long) Job.cpp:0:0
   #23 0x00005635c4c1fe83 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x33dee83)
   #24 0x00005635c548a99e clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const (.part.216) Job.cpp:0:0
   #25 0x00005635c545f2e7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3c1e2e7)
   #26 0x00005635c545fcc7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) const (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3c1ecc7)
   #27 0x00005635c5469369 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) (/opt/cross/clang-85e9b2687a/bin/clang-15+0x3c28369)
   #28 0x00005635c282891f main (/opt/cross/clang-85e9b2687a/bin/clang-15+0xfe791f)
   #29 0x00007fab4e98fd0a __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26d0a)
   #30 0x00005635c28daf2a _start (/opt/cross/clang-85e9b2687a/bin/clang-15+0x1099f2a)
   clang-15: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 15.0.0 (git://gitmirror/llvm_project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
   Target: mips-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang-85e9b2687a/bin
   clang-15: note: diagnostic msg:
   Makefile arch drivers include kernel mm net nr_bisected scripts source usr


vim +486 drivers/iommu/iommufd/io_pagetable.c

   468	
   469	/**
   470	 * iopt_unaccess_pages() - Undo iopt_access_pages
   471	 * @iopt: io_pagetable to act on
   472	 * @iova: Starting IOVA
   473	 * @length:- Number of bytes to access
   474	 *
   475	 * Return the struct page's. The caller must stop accessing them before calling
   476	 * this. The iova/length must exactly match the one provided to access_pages.
   477	 */
   478	void iopt_unaccess_pages(struct io_pagetable *iopt, unsigned long iova,
   479				 size_t length)
   480	{
   481		unsigned long cur_iova = iova;
   482		unsigned long last_iova;
   483		struct iopt_area *area;
   484	
   485		if (WARN_ON(!length) ||
 > 486		    WARN_ON(check_add_overflow(iova, length - 1, &last_iova)))
   487			return;
   488	
   489		down_read(&iopt->iova_rwsem);
   490		for (area = iopt_area_iter_first(iopt, iova, last_iova); area;
   491		     area = iopt_area_iter_next(area, iova, last_iova)) {
   492			unsigned long last = min(last_iova, iopt_area_last_iova(area));
   493			int num_users;
   494	
   495			iopt_pages_remove_user(area->pages,
   496					       iopt_area_iova_to_index(area, cur_iova),
   497					       iopt_area_iova_to_index(area, last));
   498			if (last == last_iova)
   499				break;
   500			cur_iova = last + 1;
   501			num_users = atomic_dec_return(&area->num_users);
   502			WARN_ON(num_users < 0);
   503		}
   504		up_read(&iopt->iova_rwsem);
   505	}
   506	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ