CC: [email protected] CC: [email protected] CC: [email protected] TO: Kees Cook <[email protected]> CC: Andrew Morton <[email protected]> CC: Linux Memory Management List <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 923dcc5eb0c111eccd51cc7ce1658537e3c38b25 commit: 4a26f49b7b3dbe998d9b2561f9f256a1c3fdb74a ubsan: expand tests and reporting date: 11 months ago :::::: branch date: 10 hours ago :::::: commit date: 11 months ago config: i386-randconfig-c001-20211118 (attached as .config) 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 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a26f49b7b3dbe998d9b2561f9f256a1c3fdb74a git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 4a26f49b7b3dbe998d9b2561f9f256a1c3fdb74a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 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 >>) 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 11 warnings generated. Suppressed 11 warnings (11 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. 6 warnings generated. lib/zstd/fse_compress.c:114:2: warning: Value stored to 'workspace' is never read [clang-analyzer-deadcode.DeadStores] workspace = (U32 *)workspace + spaceUsed32; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/zstd/fse_compress.c:114:2: note: Value stored to 'workspace' is never read workspace = (U32 *)workspace + spaceUsed32; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/zstd/fse_compress.c:115:2: warning: Value stored to 'workspaceSize' is never read [clang-analyzer-deadcode.DeadStores] workspaceSize -= (spaceUsed32 << 2); ^ ~~~~~~~~~~~~~~~~~~ lib/zstd/fse_compress.c:115:2: note: Value stored to 'workspaceSize' is never read workspaceSize -= (spaceUsed32 << 2); ^ ~~~~~~~~~~~~~~~~~~ lib/zstd/fse_compress.c:755:2: warning: Value stored to 'srcSize' is never read [clang-analyzer-deadcode.DeadStores] srcSize -= 2; ^ ~ lib/zstd/fse_compress.c:755:2: note: Value stored to 'srcSize' is never read srcSize -= 2; ^ ~ Suppressed 3 warnings (2 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (2 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (5 in non-user code, 3 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. 4 warnings generated. Suppressed 4 warnings (4 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. 2 warnings generated. 4 warnings generated. Suppressed 4 warnings (4 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. 2 warnings generated. 4 warnings generated. Suppressed 4 warnings (4 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. 6 warnings generated. Suppressed 6 warnings (6 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. 27 warnings generated. lib/test_ubsan.c:65:6: warning: Division by zero [clang-analyzer-core.DivideZero] val /= val2; ~~~~^~~~~~~ lib/test_ubsan.c:62:2: note: 'val2' initialized to 0 volatile int val2 = 0; ^~~~~~~~~~~~~~~~~ lib/test_ubsan.c:64:2: note: '?' condition is false UBSAN_TEST(CONFIG_UBSAN_DIV_ZERO); ^ lib/test_ubsan.c:10:4: note: expanded from macro 'UBSAN_TEST' sizeof(" " __VA_ARGS__) > 2 ? " " : "", \ ^ lib/test_ubsan.c:64:2: note: '?' condition is false UBSAN_TEST(CONFIG_UBSAN_DIV_ZERO); ^ lib/test_ubsan.c:11:13: note: expanded from macro 'UBSAN_TEST' #config, IS_ENABLED(config) ? "y" : "n"); \ ^ lib/test_ubsan.c:64:2: note: Loop condition is false. Exiting loop UBSAN_TEST(CONFIG_UBSAN_DIV_ZERO); ^ lib/test_ubsan.c:8:33: note: expanded from macro 'UBSAN_TEST' #define UBSAN_TEST(config, ...) do { \ ^ lib/test_ubsan.c:65:6: note: Division by zero val /= val2; ~~~~^~~~~~~ >> lib/test_ubsan.c:75:2: warning: Value stored to 'val1' is never read >> [clang-analyzer-deadcode.DeadStores] val1 <<= neg; ^ ~~~ lib/test_ubsan.c:75:2: note: Value stored to 'val1' is never read val1 <<= neg; ^ ~~~ lib/test_ubsan.c:75:7: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] val1 <<= neg; ^ ~~~ lib/test_ubsan.c:70:15: note: 'neg' initialized to -1 volatile int neg = -1, wrap = 4; ^~~ lib/test_ubsan.c:74:2: note: '?' condition is true UBSAN_TEST(CONFIG_UBSAN_SHIFT, "negative exponent"); ^ lib/test_ubsan.c:10:4: note: expanded from macro 'UBSAN_TEST' sizeof(" " __VA_ARGS__) > 2 ? " " : "", \ ^ lib/test_ubsan.c:74:2: note: '?' condition is true UBSAN_TEST(CONFIG_UBSAN_SHIFT, "negative exponent"); ^ lib/test_ubsan.c:11:13: note: expanded from macro 'UBSAN_TEST' #config, IS_ENABLED(config) ? "y" : "n"); \ ^ lib/test_ubsan.c:74:2: note: Loop condition is false. Exiting loop UBSAN_TEST(CONFIG_UBSAN_SHIFT, "negative exponent"); ^ lib/test_ubsan.c:8:33: note: expanded from macro 'UBSAN_TEST' #define UBSAN_TEST(config, ...) do { \ ^ lib/test_ubsan.c:75:7: note: Assigned value is garbage or undefined val1 <<= neg; ^ ~~~ lib/test_ubsan.c:78:2: warning: Value stored to 'val2' is never read [clang-analyzer-deadcode.DeadStores] val2 <<= wrap; ^ ~~~~ lib/test_ubsan.c:78:2: note: Value stored to 'val2' is never read val2 <<= wrap; ^ ~~~~ lib/test_ubsan.c:115:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores] ptr = &val2; ^ ~~~~~ lib/test_ubsan.c:115:2: note: Value stored to 'ptr' is never read ptr = &val2; ^ ~~~~~ >> lib/test_ubsan.c:123:2: warning: Value stored to 'eptr' is never read >> [clang-analyzer-deadcode.DeadStores] eptr = &eval2; ^ ~~~~~~ lib/test_ubsan.c:123:2: note: Value stored to 'eptr' is never read eptr = &eval2; ^ ~~~~~~ lib/test_ubsan.c:133:2: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores] val = *ptr; ^ ~~~~ lib/test_ubsan.c:133:2: note: Value stored to 'val' is never read val = *ptr; ^ ~~~~ lib/test_ubsan.c:133:8: warning: Dereference of null pointer (loaded from variable 'ptr') [clang-analyzer-core.NullDereference] val = *ptr; ^~~~ lib/test_ubsan.c:129:2: note: 'ptr' initialized to a null pointer value volatile int *ptr = NULL; ^~~~~~~~~~~~~~~~~ lib/test_ubsan.c:132:2: note: '?' condition is false UBSAN_TEST(CONFIG_UBSAN_OBJECT_SIZE); ^ lib/test_ubsan.c:10:4: note: expanded from macro 'UBSAN_TEST' sizeof(" " __VA_ARGS__) > 2 ? " " : "", \ ^ lib/test_ubsan.c:132:2: note: '?' condition is false UBSAN_TEST(CONFIG_UBSAN_OBJECT_SIZE); ^ lib/test_ubsan.c:11:13: note: expanded from macro 'UBSAN_TEST' #config, IS_ENABLED(config) ? "y" : "n"); \ ^ lib/test_ubsan.c:132:2: note: Loop condition is false. Exiting loop UBSAN_TEST(CONFIG_UBSAN_OBJECT_SIZE); ^ lib/test_ubsan.c:8:33: note: expanded from macro 'UBSAN_TEST' #define UBSAN_TEST(config, ...) do { \ ^ lib/test_ubsan.c:133:8: note: Dereference of null pointer (loaded from variable 'ptr') val = *ptr; ^~~~ Suppressed 19 warnings (5 in non-user code, 14 with check filters). 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. 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. 6 warnings generated. drivers/hwmon/asc7621.c:425:11: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult] temp = i << 2; ~ ^ drivers/hwmon/asc7621.c:415:2: note: Left side of '&&' is false SETUP_STORE_DATA_PARAM(dev, attr); ^ drivers/hwmon/asc7621.c:155:40: note: expanded from macro 'SETUP_STORE_DATA_PARAM' struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \ ^ include/linux/hwmon-sysfs.h:17:2: note: expanded from macro 'to_sensor_dev_attr' container_of(_dev_attr, struct sensor_device_attribute, dev_attr) ^ include/linux/kernel.h:694:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/hwmon/asc7621.c:415:2: note: Taking false branch SETUP_STORE_DATA_PARAM(dev, attr); ^ drivers/hwmon/asc7621.c:155:40: note: expanded from macro 'SETUP_STORE_DATA_PARAM' struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \ ^ include/linux/hwmon-sysfs.h:17:2: note: expanded from macro 'to_sensor_dev_attr' container_of(_dev_attr, struct sensor_device_attribute, dev_attr) ^ include/linux/kernel.h:694:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/hwmon/asc7621.c:415:2: note: Loop condition is false. Exiting loop SETUP_STORE_DATA_PARAM(dev, attr); ^ drivers/hwmon/asc7621.c:155:40: note: expanded from macro 'SETUP_STORE_DATA_PARAM' struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \ ^ include/linux/hwmon-sysfs.h:17:2: note: expanded from macro 'to_sensor_dev_attr' vim +/val1 +75 lib/test_ubsan.c 854686f4edf483 Jinbum Park 2018-04-10 67 854686f4edf483 Jinbum Park 2018-04-10 68 static void test_ubsan_shift_out_of_bounds(void) 854686f4edf483 Jinbum Park 2018-04-10 69 { 4a26f49b7b3dbe Kees Cook 2020-12-15 70 volatile int neg = -1, wrap = 4; 4a26f49b7b3dbe Kees Cook 2020-12-15 71 int val1 = 10; 4a26f49b7b3dbe Kees Cook 2020-12-15 72 int val2 = INT_MAX; 4a26f49b7b3dbe Kees Cook 2020-12-15 73 4a26f49b7b3dbe Kees Cook 2020-12-15 74 UBSAN_TEST(CONFIG_UBSAN_SHIFT, "negative exponent"); 4a26f49b7b3dbe Kees Cook 2020-12-15 @75 val1 <<= neg; 854686f4edf483 Jinbum Park 2018-04-10 76 4a26f49b7b3dbe Kees Cook 2020-12-15 77 UBSAN_TEST(CONFIG_UBSAN_SHIFT, "left overflow"); 4a26f49b7b3dbe Kees Cook 2020-12-15 78 val2 <<= wrap; 854686f4edf483 Jinbum Park 2018-04-10 79 } 854686f4edf483 Jinbum Park 2018-04-10 80 854686f4edf483 Jinbum Park 2018-04-10 81 static void test_ubsan_out_of_bounds(void) 854686f4edf483 Jinbum Park 2018-04-10 82 { 4a26f49b7b3dbe Kees Cook 2020-12-15 83 volatile int i = 4, j = 5, k = -1; 4a26f49b7b3dbe Kees Cook 2020-12-15 84 volatile char above[4] = { }; /* Protect surrounding memory. */ 9d7ca61b136644 Olof Johansson 2019-03-07 85 volatile int arr[4]; 4a26f49b7b3dbe Kees Cook 2020-12-15 86 volatile char below[4] = { }; /* Protect surrounding memory. */ 854686f4edf483 Jinbum Park 2018-04-10 87 4a26f49b7b3dbe Kees Cook 2020-12-15 88 above[0] = below[0]; 4a26f49b7b3dbe Kees Cook 2020-12-15 89 4a26f49b7b3dbe Kees Cook 2020-12-15 90 UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "above"); 854686f4edf483 Jinbum Park 2018-04-10 91 arr[j] = i; 4a26f49b7b3dbe Kees Cook 2020-12-15 92 4a26f49b7b3dbe Kees Cook 2020-12-15 93 UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "below"); 4a26f49b7b3dbe Kees Cook 2020-12-15 94 arr[k] = i; 854686f4edf483 Jinbum Park 2018-04-10 95 } 854686f4edf483 Jinbum Park 2018-04-10 96 4a26f49b7b3dbe Kees Cook 2020-12-15 97 enum ubsan_test_enum { 4a26f49b7b3dbe Kees Cook 2020-12-15 98 UBSAN_TEST_ZERO = 0, 4a26f49b7b3dbe Kees Cook 2020-12-15 99 UBSAN_TEST_ONE, 4a26f49b7b3dbe Kees Cook 2020-12-15 100 UBSAN_TEST_MAX, 4a26f49b7b3dbe Kees Cook 2020-12-15 101 }; 4a26f49b7b3dbe Kees Cook 2020-12-15 102 854686f4edf483 Jinbum Park 2018-04-10 103 static void test_ubsan_load_invalid_value(void) 854686f4edf483 Jinbum Park 2018-04-10 104 { 854686f4edf483 Jinbum Park 2018-04-10 105 volatile char *dst, *src; 854686f4edf483 Jinbum Park 2018-04-10 106 bool val, val2, *ptr; 4a26f49b7b3dbe Kees Cook 2020-12-15 107 enum ubsan_test_enum eval, eval2, *eptr; 4a26f49b7b3dbe Kees Cook 2020-12-15 108 unsigned char c = 0xff; 854686f4edf483 Jinbum Park 2018-04-10 109 4a26f49b7b3dbe Kees Cook 2020-12-15 110 UBSAN_TEST(CONFIG_UBSAN_BOOL, "bool"); 854686f4edf483 Jinbum Park 2018-04-10 111 dst = (char *)&val; 854686f4edf483 Jinbum Park 2018-04-10 112 src = &c; 854686f4edf483 Jinbum Park 2018-04-10 113 *dst = *src; 854686f4edf483 Jinbum Park 2018-04-10 114 854686f4edf483 Jinbum Park 2018-04-10 115 ptr = &val2; 854686f4edf483 Jinbum Park 2018-04-10 116 val2 = val; 4a26f49b7b3dbe Kees Cook 2020-12-15 117 4a26f49b7b3dbe Kees Cook 2020-12-15 118 UBSAN_TEST(CONFIG_UBSAN_ENUM, "enum"); 4a26f49b7b3dbe Kees Cook 2020-12-15 119 dst = (char *)&eval; 4a26f49b7b3dbe Kees Cook 2020-12-15 120 src = &c; 4a26f49b7b3dbe Kees Cook 2020-12-15 121 *dst = *src; 4a26f49b7b3dbe Kees Cook 2020-12-15 122 4a26f49b7b3dbe Kees Cook 2020-12-15 @123 eptr = &eval2; 4a26f49b7b3dbe Kees Cook 2020-12-15 124 eval2 = eval; 854686f4edf483 Jinbum Park 2018-04-10 125 } 854686f4edf483 Jinbum Park 2018-04-10 126 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
