CC: [email protected] CC: [email protected] BCC: [email protected] CC: [email protected] TO: Arnd Bergmann <[email protected]> CC: Masahiro Yamada <[email protected]> CC: Alex Shi <[email protected]> CC: Nick Desaulniers <[email protected]> CC: Miguel Ojeda <[email protected]> CC: Nathan Chancellor <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 0f5d752b1395e777ef81e28886945e5e939b7c8a commit: e8c07082a810fbb9db303a2b66b66b8d7e588b53 Kbuild: move to -std=gnu11 date: 8 weeks ago :::::: branch date: 8 hours ago :::::: commit date: 8 weeks ago config: arm-randconfig-c002-20220505 (https://download.01.org/0day-ci/archive/20220506/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc) 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 arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e8c07082a810fbb9db303a2b66b66b8d7e588b53 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout e8c07082a810fbb9db303a2b66b66b8d7e588b53 # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 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 >>) kernel/sched/core.c:7652:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(attr, 0, sizeof(*attr)); ^~~~~~ kernel/sched/core.c:7652:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(attr, 0, sizeof(*attr)); ^~~~~~ kernel/sched/core.c:9330:3: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores] ptr += nr_cpu_ids * sizeof(void **); ^ kernel/sched/core.c:9330:3: note: Value stored to 'ptr' is never read kernel/sched/core.c:10760:6: warning: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (sscanf(buf, "%20s %llu", tok, periodp) < 1) ^~~~~~ kernel/sched/core.c:10760:6: note: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 if (sscanf(buf, "%20s %llu", tok, periodp) < 1) ^~~~~~ kernel/sched/core.c:10765:6: warning: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (sscanf(tok, "%llu", quotap)) ^~~~~~ kernel/sched/core.c:10765:6: note: Call to function 'sscanf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sscanf_s' in case of C11 if (sscanf(tok, "%llu", quotap)) ^~~~~~ Suppressed 66 warnings (60 in non-user code, 6 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. 61 warnings generated. Suppressed 61 warnings (61 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. 61 warnings generated. Suppressed 61 warnings (61 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. 31 warnings generated. crypto/dh.c:28:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(ctx, 0, sizeof(*ctx)); ^~~~~~ crypto/dh.c:28:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(ctx, 0, sizeof(*ctx)); ^~~~~~ Suppressed 30 warnings (30 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. 9 warnings generated. crypto/dh_helper.c:19:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(dst, src, size); ^~~~~~ crypto/dh_helper.c:19:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(dst, src, size); ^~~~~~ crypto/dh_helper.c:25:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(dst, src, size); ^~~~~~ crypto/dh_helper.c:25:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(dst, src, size); ^~~~~~ Suppressed 7 warnings (7 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. 30 warnings generated. Suppressed 30 warnings (30 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. 36 warnings generated. crypto/rsa-pkcs1pad.c:411:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(req_ctx->in_buf + 1, 0xff, ps_end - 1); ^~~~~~ crypto/rsa-pkcs1pad.c:411:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(req_ctx->in_buf + 1, 0xff, ps_end - 1); ^~~~~~ crypto/rsa-pkcs1pad.c:415:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memcpy(req_ctx->in_buf + ps_end + 1, digest_info->data, ^~~~~~ crypto/rsa-pkcs1pad.c:415:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 memcpy(req_ctx->in_buf + ps_end + 1, digest_info->data, ^~~~~~ crypto/rsa-pkcs1pad.c:627:7: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (snprintf(inst->alg.base.cra_name, ^~~~~~~~ crypto/rsa-pkcs1pad.c:627:7: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 if (snprintf(inst->alg.base.cra_name, ^~~~~~~~ crypto/rsa-pkcs1pad.c:632:7: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (snprintf(inst->alg.base.cra_driver_name, ^~~~~~~~ crypto/rsa-pkcs1pad.c:632:7: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 if (snprintf(inst->alg.base.cra_driver_name, ^~~~~~~~ crypto/rsa-pkcs1pad.c:644:7: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, ^~~~~~~~ crypto/rsa-pkcs1pad.c:644:7: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, ^~~~~~~~ crypto/rsa-pkcs1pad.c:649:7: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] if (snprintf(inst->alg.base.cra_driver_name, ^~~~~~~~ crypto/rsa-pkcs1pad.c:649:7: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 if (snprintf(inst->alg.base.cra_driver_name, ^~~~~~~~ Suppressed 30 warnings (30 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. 42 warnings generated. Suppressed 42 warnings (42 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. 32 warnings generated. >> security/lockdown/lockdown.c:103:15: warning: Call to function 'sprintf' is >> insecure as it does not provide bounding of the memory buffer or security >> checks introduced in the C11 standard. Replace with analogous functions that >> support length arguments or provides boundary checks such as 'sprintf_s' in >> case of C11 >> [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] offset += sprintf(temp+offset, "[%s] ", label); ^~~~~~~ security/lockdown/lockdown.c:103:15: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 offset += sprintf(temp+offset, "[%s] ", label); ^~~~~~~ security/lockdown/lockdown.c:105:15: warning: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] offset += sprintf(temp+offset, "%s ", label); ^~~~~~~ security/lockdown/lockdown.c:105:15: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 offset += sprintf(temp+offset, "%s ", label); ^~~~~~~ Suppressed 30 warnings (30 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. 44 warnings generated. security/device_cgroup.c:242:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(acc, 0, ACCLEN); ^~~~~~ security/device_cgroup.c:242:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(acc, 0, ACCLEN); ^~~~~~ security/device_cgroup.c:265:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(str, "*"); ^~~~~~ security/device_cgroup.c:265:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(str, "*"); ^~~~~~ security/device_cgroup.c:267:3: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] sprintf(str, "%u", m); ^~~~~~~ security/device_cgroup.c:267:3: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 sprintf(str, "%u", m); ^~~~~~~ security/device_cgroup.c:611:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(&ex, 0, sizeof(ex)); ^~~~~~ security/device_cgroup.c:611:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(&ex, 0, sizeof(ex)); ^~~~~~ security/device_cgroup.c:661:3: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(temp, 0, sizeof(temp)); ^~~~~~ security/device_cgroup.c:661:3: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(temp, 0, sizeof(temp)); ^~~~~~ security/device_cgroup.c:683:3: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(temp, 0, sizeof(temp)); ^~~~~~ security/device_cgroup.c:683:3: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(temp, 0, sizeof(temp)); ^~~~~~ Suppressed 38 warnings (38 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. 43 warnings generated. fs/ramfs/file-nommu.c:101:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] memset(data, 0, newsize); ^~~~~~ fs/ramfs/file-nommu.c:101:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 memset(data, 0, newsize); ^~~~~~ Suppressed 42 warnings (42 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. 46 warnings generated. fs/fat/cache.c:138:20: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult] if (new->fcluster == -1) /* dummy cache */ ^ fs/fat/cache.c:366:6: note: Left side of '&&' is true if (!is_fat32(sbi) && (inode->i_ino == MSDOS_ROOT_INO)) { ^ fs/fat/cache.c:366:25: note: Assuming field 'i_ino' is not equal to MSDOS_ROOT_INO if (!is_fat32(sbi) && (inode->i_ino == MSDOS_ROOT_INO)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/fat/cache.c:366:2: note: Taking false branch if (!is_fat32(sbi) && (inode->i_ino == MSDOS_ROOT_INO)) { ^ fs/fat/cache.c:374:6: note: Assuming 'from_bmap' is true if (!from_bmap) { ^~~~~~~~~~ fs/fat/cache.c:374:2: note: Taking false branch if (!from_bmap) { ^ fs/fat/cache.c:380:7: note: Assuming 'sector' is < 'last_block' if (sector >= last_block) ^~~~~~~~~~~~~~~~~~~~ fs/fat/cache.c:380:3: note: Taking false branch if (sector >= last_block) ^ fs/fat/cache.c:384:9: note: Calling 'fat_get_mapped_cluster' return fat_get_mapped_cluster(inode, sector, last_block, mapped_blocks, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/fat/cache.c:320:12: note: Calling 'fat_bmap_cluster' cluster = fat_bmap_cluster(inode, cluster); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/fat/cache.c:296:6: note: Assuming field 'i_start' is not equal to 0 if (MSDOS_I(inode)->i_start == 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/fat/cache.c:296:2: note: Taking false branch if (MSDOS_I(inode)->i_start == 0) ^ fs/fat/cache.c:299:8: note: Calling 'fat_get_cluster' ret = fat_get_cluster(inode, cluster, &fclus, &dclus); vim +103 security/lockdown/lockdown.c 000d388ed3bbed7 Matthew Garrett 2019-08-19 89 000d388ed3bbed7 Matthew Garrett 2019-08-19 90 static ssize_t lockdown_read(struct file *filp, char __user *buf, size_t count, 000d388ed3bbed7 Matthew Garrett 2019-08-19 91 loff_t *ppos) 000d388ed3bbed7 Matthew Garrett 2019-08-19 92 { 000d388ed3bbed7 Matthew Garrett 2019-08-19 93 char temp[80]; 000d388ed3bbed7 Matthew Garrett 2019-08-19 94 int i, offset = 0; 000d388ed3bbed7 Matthew Garrett 2019-08-19 95 000d388ed3bbed7 Matthew Garrett 2019-08-19 96 for (i = 0; i < ARRAY_SIZE(lockdown_levels); i++) { 000d388ed3bbed7 Matthew Garrett 2019-08-19 97 enum lockdown_reason level = lockdown_levels[i]; 000d388ed3bbed7 Matthew Garrett 2019-08-19 98 000d388ed3bbed7 Matthew Garrett 2019-08-19 99 if (lockdown_reasons[level]) { 000d388ed3bbed7 Matthew Garrett 2019-08-19 100 const char *label = lockdown_reasons[level]; 000d388ed3bbed7 Matthew Garrett 2019-08-19 101 000d388ed3bbed7 Matthew Garrett 2019-08-19 102 if (kernel_locked_down == level) 000d388ed3bbed7 Matthew Garrett 2019-08-19 @103 offset += sprintf(temp+offset, "[%s] ", label); 000d388ed3bbed7 Matthew Garrett 2019-08-19 104 else 000d388ed3bbed7 Matthew Garrett 2019-08-19 105 offset += sprintf(temp+offset, "%s ", label); 000d388ed3bbed7 Matthew Garrett 2019-08-19 106 } 000d388ed3bbed7 Matthew Garrett 2019-08-19 107 } 000d388ed3bbed7 Matthew Garrett 2019-08-19 108 000d388ed3bbed7 Matthew Garrett 2019-08-19 109 /* Convert the last space to a newline if needed. */ 000d388ed3bbed7 Matthew Garrett 2019-08-19 110 if (offset > 0) 000d388ed3bbed7 Matthew Garrett 2019-08-19 111 temp[offset-1] = '\n'; 000d388ed3bbed7 Matthew Garrett 2019-08-19 112 000d388ed3bbed7 Matthew Garrett 2019-08-19 113 return simple_read_from_buffer(buf, count, ppos, temp, strlen(temp)); 000d388ed3bbed7 Matthew Garrett 2019-08-19 114 } 000d388ed3bbed7 Matthew Garrett 2019-08-19 115 :::::: The code at line 103 was first introduced by commit :::::: 000d388ed3bbed745f366ce71b2bb7c2ee70f449 security: Add a static lockdown policy LSM :::::: TO: Matthew Garrett <[email protected]> :::::: CC: James Morris <[email protected]> -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
