CC: [email protected] CC: [email protected] CC: "GNU/Weeb Mailing List" <[email protected]> CC: [email protected] TO: Eric Biggers <[email protected]> CC: Jaegeuk Kim <[email protected]> CC: Victor Hsieh <[email protected]> CC: Chao Yu <[email protected]>, Chao Yu <[email protected]>
tree: https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android12-5.10-2021-12 head: 51e133b6e4eb00703d3b3fe71cc2447ebd9fb4a8 commit: 0b29c4caec92e23e3a9698f40b619f3ec71a13ab [1196/9999] fs-verity: support reading Merkle tree with ioctl :::::: branch date: 2 days ago :::::: commit date: 11 months ago config: s390-randconfig-c005-20220121 (https://download.01.org/0day-ci/archive/20220123/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7b3d30728816403d1fd73cc5082e9fb761262bce) 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 s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://github.com/ammarfaizi2/linux-block/commit/0b29c4caec92e23e3a9698f40b619f3ec71a13ab git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android12-5.10-2021-12 git checkout 0b29c4caec92e23e3a9698f40b619f3ec71a13ab # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) goto unwind; ^ kernel/locking/locktorture.c:1040:2: note: Calling 'lock_torture_cleanup' lock_torture_cleanup(); ^~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:784:6: note: Assuming the condition is false if (torture_cleanup_begin()) ^~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:784:2: note: Taking false branch if (torture_cleanup_begin()) ^ kernel/locking/locktorture.c:793:6: note: Assuming field 'lwsa' is non-null if (!cxt.lwsa && !cxt.lrsa) ^~~~~~~~~ kernel/locking/locktorture.c:793:16: note: Left side of '&&' is false if (!cxt.lwsa && !cxt.lrsa) ^ kernel/locking/locktorture.c:796:6: note: Assuming 'writer_tasks' is null if (writer_tasks) { ^~~~~~~~~~~~ kernel/locking/locktorture.c:796:2: note: Taking false branch if (writer_tasks) { ^ kernel/locking/locktorture.c:804:6: note: Assuming 'reader_tasks' is null if (reader_tasks) { ^~~~~~~~~~~~ kernel/locking/locktorture.c:804:2: note: Taking false branch if (reader_tasks) { ^ kernel/locking/locktorture.c:813:2: note: Calling 'lock_torture_stats_print' lock_torture_stats_print(); /* -After- the stats thread is stopped! */ ^~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:721:6: note: Assuming field 'readlock' is null if (cxt.cur_ops->readlock) ^~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:721:2: note: Taking false branch if (cxt.cur_ops->readlock) ^ kernel/locking/locktorture.c:724:8: note: Calling 'kmalloc' buf = kmalloc(size, GFP_KERNEL); ^~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/slab.h:540:2: note: Taking false branch if (__builtin_constant_p(size)) { ^ include/linux/slab.h:557:9: note: Value assigned to 'cxt.lwsa' return __kmalloc(size, flags); ^~~~~~~~~~~~~~~~~~~~~~ include/linux/slab.h:557:2: note: Returning pointer, which participates in a condition later return __kmalloc(size, flags); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:724:8: note: Returning from 'kmalloc' buf = kmalloc(size, GFP_KERNEL); ^~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:725:6: note: Assuming 'buf' is non-null if (!buf) { ^~~~ kernel/locking/locktorture.c:725:2: note: Taking false branch if (!buf) { ^ kernel/locking/locktorture.c:731:29: note: Passing value via 2nd parameter 'statp' __torture_print_stats(buf, cxt.lwsa, true); ^~~~~~~~ kernel/locking/locktorture.c:731:2: note: Calling '__torture_print_stats' __torture_print_stats(buf, cxt.lwsa, true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:685:22: note: Assuming 'statp' is null long max = 0, min = statp ? statp[0].n_lock_acquired : 0; ^~~~~ kernel/locking/locktorture.c:685:22: note: '?' condition is false kernel/locking/locktorture.c:688:13: note: 'write' is true n_stress = write ? cxt.nrealwriters_stress : cxt.nrealreaders_stress; ^~~~~ kernel/locking/locktorture.c:688:13: note: '?' condition is true kernel/locking/locktorture.c:689:14: note: Assuming 'i' is < 'n_stress' for (i = 0; i < n_stress; i++) { ^~~~~~~~~~~~ kernel/locking/locktorture.c:689:2: note: Loop condition is true. Entering loop body for (i = 0; i < n_stress; i++) { ^ kernel/locking/locktorture.c:690:7: note: Dereference of null pointer if (statp[i].n_lock_fail) ^~~~~~~~~~~~~~~~~~~~ kernel/locking/locktorture.c:698:2: warning: Value stored to 'page' is never read [clang-analyzer-deadcode.DeadStores] page += sprintf(page, ^ ~~~~~~~~~~~~~ kernel/locking/locktorture.c:698:2: note: Value stored to 'page' is never read page += sprintf(page, ^ ~~~~~~~~~~~~~ Suppressed 5 warnings (5 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. Suppressed 5 warnings (5 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. Suppressed 5 warnings (5 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. Suppressed 5 warnings (5 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 26 warnings generated. >> fs/verity/read_metadata.c:70:28: warning: Dereference of null pointer >> [clang-analyzer-core.NullDereference] if (fatal_signal_pending(current)) { ^ arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current' #define current ((struct task_struct *const)S390_lowcore.current_task) ^ arch/s390/include/asm/lowcore.h:193:22: note: expanded from macro 'S390_lowcore' #define S390_lowcore (*((struct lowcore *) 0)) ^ fs/verity/read_metadata.c:95:6: note: Assuming 'vi' is non-null if (!vi) ^~~ fs/verity/read_metadata.c:95:2: note: Taking false branch if (!vi) ^ fs/verity/read_metadata.c:102:2: note: Taking false branch if (copy_from_user(&arg, uarg, sizeof(arg))) ^ fs/verity/read_metadata.c:105:6: note: Assuming field '__reserved' is 0 if (arg.__reserved) ^~~~~~~~~~~~~~ fs/verity/read_metadata.c:105:2: note: Taking false branch if (arg.__reserved) ^ fs/verity/read_metadata.c:109:6: note: Assuming the condition is false if (arg.offset + arg.length < arg.offset) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/verity/read_metadata.c:109:2: note: Taking false branch if (arg.offset + arg.length < arg.offset) ^ fs/verity/read_metadata.c:113:11: note: Assuming '__UNIQUE_ID___x287' is < '__UNIQUE_ID___y288' length = min_t(u64, arg.length, INT_MAX); ^ include/linux/minmax.h:110:27: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:34:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^~~~~~~~~~ fs/verity/read_metadata.c:113:11: note: '?' condition is true length = min_t(u64, arg.length, INT_MAX); ^ include/linux/minmax.h:110:27: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) ^ include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^ include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^ include/linux/minmax.h:34:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ fs/verity/read_metadata.c:117:2: note: Control jumps to 'case 1:' at line 118 switch (arg.metadata_type) { ^ fs/verity/read_metadata.c:119:10: note: Calling 'fsverity_read_merkle_tree' return fsverity_read_merkle_tree(inode, vi, buf, arg.offset, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/verity/read_metadata.c:26:15: note: Assuming '__UNIQUE_ID___x281' is >= '__UNIQUE_ID___y282' end_offset = min(offset + length, vi->tree_params.tree_size); ^ include/linux/minmax.h:51:19: note: expanded from macro 'min' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:34:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^~~~~~~~~~ fs/verity/read_metadata.c:26:15: note: '?' condition is false end_offset = min(offset + length, vi->tree_params.tree_size); ^ include/linux/minmax.h:51:19: note: expanded from macro 'min' #define min(x, y) __careful_cmp(x, y, <) ^ include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp' __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) ^ include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once' __cmp(unique_x, unique_y, op); }) ^ include/linux/minmax.h:34:26: note: expanded from macro '__cmp' #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) ^ fs/verity/read_metadata.c:27:6: note: Assuming 'offset' is < 'end_offset' if (offset >= end_offset) ^~~~~~~~~~~~~~~~~~~~ fs/verity/read_metadata.c:27:2: note: Taking false branch if (offset >= end_offset) vim +70 fs/verity/read_metadata.c d758f506808823a Eric Biggers 2021-01-15 14 0b29c4caec92e23 Eric Biggers 2021-01-15 15 static int fsverity_read_merkle_tree(struct inode *inode, 0b29c4caec92e23 Eric Biggers 2021-01-15 16 const struct fsverity_info *vi, 0b29c4caec92e23 Eric Biggers 2021-01-15 17 void __user *buf, u64 offset, int length) 0b29c4caec92e23 Eric Biggers 2021-01-15 18 { 0b29c4caec92e23 Eric Biggers 2021-01-15 19 const struct fsverity_operations *vops = inode->i_sb->s_vop; 0b29c4caec92e23 Eric Biggers 2021-01-15 20 u64 end_offset; 0b29c4caec92e23 Eric Biggers 2021-01-15 21 unsigned int offs_in_page; 0b29c4caec92e23 Eric Biggers 2021-01-15 22 pgoff_t index, last_index; 0b29c4caec92e23 Eric Biggers 2021-01-15 23 int retval = 0; 0b29c4caec92e23 Eric Biggers 2021-01-15 24 int err = 0; 0b29c4caec92e23 Eric Biggers 2021-01-15 25 0b29c4caec92e23 Eric Biggers 2021-01-15 26 end_offset = min(offset + length, vi->tree_params.tree_size); 0b29c4caec92e23 Eric Biggers 2021-01-15 27 if (offset >= end_offset) 0b29c4caec92e23 Eric Biggers 2021-01-15 28 return 0; 0b29c4caec92e23 Eric Biggers 2021-01-15 29 offs_in_page = offset_in_page(offset); 0b29c4caec92e23 Eric Biggers 2021-01-15 30 last_index = (end_offset - 1) >> PAGE_SHIFT; 0b29c4caec92e23 Eric Biggers 2021-01-15 31 0b29c4caec92e23 Eric Biggers 2021-01-15 32 /* 0b29c4caec92e23 Eric Biggers 2021-01-15 33 * Iterate through each Merkle tree page in the requested range and copy 0b29c4caec92e23 Eric Biggers 2021-01-15 34 * the requested portion to userspace. Note that the Merkle tree block 0b29c4caec92e23 Eric Biggers 2021-01-15 35 * size isn't important here, as we are returning a byte stream; i.e., 0b29c4caec92e23 Eric Biggers 2021-01-15 36 * we can just work with pages even if the tree block size != PAGE_SIZE. 0b29c4caec92e23 Eric Biggers 2021-01-15 37 */ 0b29c4caec92e23 Eric Biggers 2021-01-15 38 for (index = offset >> PAGE_SHIFT; index <= last_index; index++) { 0b29c4caec92e23 Eric Biggers 2021-01-15 39 unsigned long num_ra_pages = 0b29c4caec92e23 Eric Biggers 2021-01-15 40 min_t(unsigned long, last_index - index + 1, 0b29c4caec92e23 Eric Biggers 2021-01-15 41 inode->i_sb->s_bdi->io_pages); 0b29c4caec92e23 Eric Biggers 2021-01-15 42 unsigned int bytes_to_copy = min_t(u64, end_offset - offset, 0b29c4caec92e23 Eric Biggers 2021-01-15 43 PAGE_SIZE - offs_in_page); 0b29c4caec92e23 Eric Biggers 2021-01-15 44 struct page *page; 0b29c4caec92e23 Eric Biggers 2021-01-15 45 const void *virt; 0b29c4caec92e23 Eric Biggers 2021-01-15 46 0b29c4caec92e23 Eric Biggers 2021-01-15 47 page = vops->read_merkle_tree_page(inode, index, num_ra_pages); 0b29c4caec92e23 Eric Biggers 2021-01-15 48 if (IS_ERR(page)) { 0b29c4caec92e23 Eric Biggers 2021-01-15 49 err = PTR_ERR(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 50 fsverity_err(inode, 0b29c4caec92e23 Eric Biggers 2021-01-15 51 "Error %d reading Merkle tree page %lu", 0b29c4caec92e23 Eric Biggers 2021-01-15 52 err, index); 0b29c4caec92e23 Eric Biggers 2021-01-15 53 break; 0b29c4caec92e23 Eric Biggers 2021-01-15 54 } 0b29c4caec92e23 Eric Biggers 2021-01-15 55 0b29c4caec92e23 Eric Biggers 2021-01-15 56 virt = kmap(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 57 if (copy_to_user(buf, virt + offs_in_page, bytes_to_copy)) { 0b29c4caec92e23 Eric Biggers 2021-01-15 58 kunmap(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 59 put_page(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 60 err = -EFAULT; 0b29c4caec92e23 Eric Biggers 2021-01-15 61 break; 0b29c4caec92e23 Eric Biggers 2021-01-15 62 } 0b29c4caec92e23 Eric Biggers 2021-01-15 63 kunmap(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 64 put_page(page); 0b29c4caec92e23 Eric Biggers 2021-01-15 65 0b29c4caec92e23 Eric Biggers 2021-01-15 66 retval += bytes_to_copy; 0b29c4caec92e23 Eric Biggers 2021-01-15 67 buf += bytes_to_copy; 0b29c4caec92e23 Eric Biggers 2021-01-15 68 offset += bytes_to_copy; 0b29c4caec92e23 Eric Biggers 2021-01-15 69 0b29c4caec92e23 Eric Biggers 2021-01-15 @70 if (fatal_signal_pending(current)) { --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
