Re: [PATCH v2] Revert "kbuild: Do not enable -Wimplicit-fallthrough for clang for now"

From: kernel test robot
Date: Mon Nov 09 2020 - 05:42:19 EST


Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kbuild/for-next]
[also build test WARNING on v5.10-rc3 next-20201109]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
config: powerpc64-randconfig-r016-20201109 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 09ec07827b1128504457a93dee80b2ceee1af600)
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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/8b3537ff657d0124d47fbe215decbba65c4551ff
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nick-Desaulniers/Revert-kbuild-Do-not-enable-Wimplicit-fallthrough-for-clang-for-now/20201109-093904
git checkout 8b3537ff657d0124d47fbe215decbba65c4551ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

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

All warnings (new ones prefixed by >>):

In file included from security/integrity/ima/ima_main.c:23:
In file included from include/linux/mman.h:5:
In file included from include/linux/mm.h:687:
In file included from include/linux/huge_mm.h:8:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
>> security/integrity/ima/ima_main.c:746:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
security/integrity/ima/ima_main.c:746:2: note: insert 'break;' to avoid fall-through
default:
^
break;
3 warnings generated.
--
In file included from security/integrity/ima/ima_policy.c:13:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
>> security/integrity/ima/ima_policy.c:569:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
security/integrity/ima/ima_policy.c:569:3: note: insert 'break;' to avoid fall-through
default:
^
break;
security/integrity/ima/ima_policy.c:805:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
security/integrity/ima/ima_policy.c:805:2: note: insert 'break;' to avoid fall-through
default:
^
break;
4 warnings generated.
--
In file included from drivers/mmc/host/sdhci-of-arasan.c:22:
In file included from include/linux/phy/phy.h:17:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
>> drivers/mmc/host/sdhci-of-arasan.c:630:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/mmc/host/sdhci-of-arasan.c:630:2: note: insert 'break;' to avoid fall-through
default:
^
break;
drivers/mmc/host/sdhci-of-arasan.c:698:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/mmc/host/sdhci-of-arasan.c:698:2: note: insert 'break;' to avoid fall-through
default:
^
break;
drivers/mmc/host/sdhci-of-arasan.c:763:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/mmc/host/sdhci-of-arasan.c:763:2: note: insert 'break;' to avoid fall-through
default:
^
break;
drivers/mmc/host/sdhci-of-arasan.c:834:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/mmc/host/sdhci-of-arasan.c:834:2: note: insert 'break;' to avoid fall-through
default:
^
break;
6 warnings generated.
--
>> lib/siphash.c:72:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
lib/siphash.c:72:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
__attribute__((fallthrough));
lib/siphash.c:72:2: note: insert 'break;' to avoid fall-through
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
break;
lib/siphash.c:73:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
lib/siphash.c:73:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
__attribute__((fallthrough));
lib/siphash.c:73:2: note: insert 'break;' to avoid fall-through
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
break;
lib/siphash.c:74:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 4: b |= le32_to_cpup(data); break;
^
lib/siphash.c:74:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 4: b |= le32_to_cpup(data); break;
^
__attribute__((fallthrough));
lib/siphash.c:74:2: note: insert 'break;' to avoid fall-through
case 4: b |= le32_to_cpup(data); break;
^
break;
lib/siphash.c:76:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 2: b |= le16_to_cpup(data); break;
^
lib/siphash.c:76:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 2: b |= le16_to_cpup(data); break;
^
__attribute__((fallthrough));
lib/siphash.c:76:2: note: insert 'break;' to avoid fall-through
case 2: b |= le16_to_cpup(data); break;
^
break;
lib/siphash.c:272:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
lib/siphash.c:272:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
__attribute__((fallthrough));
lib/siphash.c:272:2: note: insert 'break;' to avoid fall-through
case 6: b |= ((u64)end[5]) << 40; /* fall through */
^
break;
lib/siphash.c:273:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
lib/siphash.c:273:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
__attribute__((fallthrough));
lib/siphash.c:273:2: note: insert 'break;' to avoid fall-through
case 5: b |= ((u64)end[4]) << 32; /* fall through */
^
break;
lib/siphash.c:274:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 4: b |= le32_to_cpup(data); break;
^
lib/siphash.c:274:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 4: b |= le32_to_cpup(data); break;
^
__attribute__((fallthrough));
lib/siphash.c:274:2: note: insert 'break;' to avoid fall-through
case 4: b |= le32_to_cpup(data); break;
^
break;
lib/siphash.c:276:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 2: b |= le16_to_cpup(data); break;
^
lib/siphash.c:276:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 2: b |= le16_to_cpup(data); break;
^
__attribute__((fallthrough));
lib/siphash.c:276:2: note: insert 'break;' to avoid fall-through
case 2: b |= le16_to_cpup(data); break;
^
break;
8 warnings generated.

vim +746 security/integrity/ima/ima_main.c

5a9196d715607f7 Mimi Zohar 2014-07-22 699
16c267aac86b463 Mimi Zohar 2018-07-13 700 /**
16c267aac86b463 Mimi Zohar 2018-07-13 701 * ima_load_data - appraise decision based on policy
16c267aac86b463 Mimi Zohar 2018-07-13 702 * @id: kernel load data caller identifier
b64fcae74b6d694 Kees Cook 2020-10-02 703 * @contents: whether the full contents will be available in a later
b64fcae74b6d694 Kees Cook 2020-10-02 704 * call to ima_post_load_data().
16c267aac86b463 Mimi Zohar 2018-07-13 705 *
16c267aac86b463 Mimi Zohar 2018-07-13 706 * Callers of this LSM hook can not measure, appraise, or audit the
16c267aac86b463 Mimi Zohar 2018-07-13 707 * data provided by userspace. Enforce policy rules requring a file
16c267aac86b463 Mimi Zohar 2018-07-13 708 * signature (eg. kexec'ed kernel image).
16c267aac86b463 Mimi Zohar 2018-07-13 709 *
16c267aac86b463 Mimi Zohar 2018-07-13 710 * For permission return 0, otherwise return -EACCES.
16c267aac86b463 Mimi Zohar 2018-07-13 711 */
b64fcae74b6d694 Kees Cook 2020-10-02 712 int ima_load_data(enum kernel_load_data_id id, bool contents)
16c267aac86b463 Mimi Zohar 2018-07-13 713 {
b5ca117365d960f Nayna Jain 2018-10-09 714 bool ima_enforce, sig_enforce;
c77b8cdf745d91e Mimi Zohar 2018-07-13 715
b5ca117365d960f Nayna Jain 2018-10-09 716 ima_enforce =
b5ca117365d960f Nayna Jain 2018-10-09 717 (ima_appraise & IMA_APPRAISE_ENFORCE) == IMA_APPRAISE_ENFORCE;
16c267aac86b463 Mimi Zohar 2018-07-13 718
16c267aac86b463 Mimi Zohar 2018-07-13 719 switch (id) {
16c267aac86b463 Mimi Zohar 2018-07-13 720 case LOADING_KEXEC_IMAGE:
99d5cadfde2b1ac Jiri Bohac 2019-08-19 721 if (IS_ENABLED(CONFIG_KEXEC_SIG)
b5ca117365d960f Nayna Jain 2018-10-09 722 && arch_ima_get_secureboot()) {
b5ca117365d960f Nayna Jain 2018-10-09 723 pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n");
b5ca117365d960f Nayna Jain 2018-10-09 724 return -EACCES;
b5ca117365d960f Nayna Jain 2018-10-09 725 }
b5ca117365d960f Nayna Jain 2018-10-09 726
b5ca117365d960f Nayna Jain 2018-10-09 727 if (ima_enforce && (ima_appraise & IMA_APPRAISE_KEXEC)) {
16c267aac86b463 Mimi Zohar 2018-07-13 728 pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n");
16c267aac86b463 Mimi Zohar 2018-07-13 729 return -EACCES; /* INTEGRITY_UNKNOWN */
16c267aac86b463 Mimi Zohar 2018-07-13 730 }
fed2512a7ccc8fc Mimi Zohar 2018-07-13 731 break;
fed2512a7ccc8fc Mimi Zohar 2018-07-13 732 case LOADING_FIRMWARE:
4f2d99b06b73800 Kees Cook 2020-10-02 733 if (ima_enforce && (ima_appraise & IMA_APPRAISE_FIRMWARE) && !contents) {
fed2512a7ccc8fc Mimi Zohar 2018-07-13 734 pr_err("Prevent firmware sysfs fallback loading.\n");
fed2512a7ccc8fc Mimi Zohar 2018-07-13 735 return -EACCES; /* INTEGRITY_UNKNOWN */
fed2512a7ccc8fc Mimi Zohar 2018-07-13 736 }
c77b8cdf745d91e Mimi Zohar 2018-07-13 737 break;
c77b8cdf745d91e Mimi Zohar 2018-07-13 738 case LOADING_MODULE:
c77b8cdf745d91e Mimi Zohar 2018-07-13 739 sig_enforce = is_module_sig_enforced();
c77b8cdf745d91e Mimi Zohar 2018-07-13 740
b5ca117365d960f Nayna Jain 2018-10-09 741 if (ima_enforce && (!sig_enforce
b5ca117365d960f Nayna Jain 2018-10-09 742 && (ima_appraise & IMA_APPRAISE_MODULES))) {
c77b8cdf745d91e Mimi Zohar 2018-07-13 743 pr_err("impossible to appraise a module without a file descriptor. sig_enforce kernel parameter might help\n");
c77b8cdf745d91e Mimi Zohar 2018-07-13 744 return -EACCES; /* INTEGRITY_UNKNOWN */
c77b8cdf745d91e Mimi Zohar 2018-07-13 745 }
16c267aac86b463 Mimi Zohar 2018-07-13 @746 default:
16c267aac86b463 Mimi Zohar 2018-07-13 747 break;
16c267aac86b463 Mimi Zohar 2018-07-13 748 }
16c267aac86b463 Mimi Zohar 2018-07-13 749 return 0;
16c267aac86b463 Mimi Zohar 2018-07-13 750 }
16c267aac86b463 Mimi Zohar 2018-07-13 751

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip