From: kernel test robot <lkp@intel.com>
To: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
linux-kernel@vger.kernel.org, Rob Herring <robh@kernel.org>,
Prakhar Srivastava <prsriva@linux.microsoft.com>,
Thiago Jung Bauermann <bauerman@linux.ibm.com>
Subject: security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer'
Date: Wed, 9 Jun 2021 12:10:39 +0800 [thread overview]
Message-ID: <202106091229.uCfgCAOZ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 7490 bytes --]
Hi Lakshmi,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 368094df48e680fa51cedb68537408cfa64b788e
commit: dce92f6b11c3174737bd65eaf933458909b633ff arm64: Enable passing IMA log to next kernel on kexec
date: 3 months ago
config: arm64-randconfig-r004-20210609 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d2012d965d60c3258b3a69d024491698f8aec386)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dce92f6b11c3174737bd65eaf933458909b633ff
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout dce92f6b11c3174737bd65eaf933458909b633ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer' [-Wmissing-prototypes]
void ima_add_kexec_buffer(struct kimage *image)
^
security/integrity/ima/ima_kexec.c:81:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void ima_add_kexec_buffer(struct kimage *image)
^
static
1 warning generated.
vim +/ima_add_kexec_buffer +81 security/integrity/ima/ima_kexec.c
7b8589cc29e7c3 Mimi Zohar 2016-12-19 74
7b8589cc29e7c3 Mimi Zohar 2016-12-19 75 /*
7b8589cc29e7c3 Mimi Zohar 2016-12-19 76 * Called during kexec_file_load so that IMA can add a segment to the kexec
7b8589cc29e7c3 Mimi Zohar 2016-12-19 77 * image for the measurement list for the next kernel.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 78 *
7b8589cc29e7c3 Mimi Zohar 2016-12-19 79 * This function assumes that kexec_mutex is held.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 80 */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 @81 void ima_add_kexec_buffer(struct kimage *image)
7b8589cc29e7c3 Mimi Zohar 2016-12-19 82 {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 83 struct kexec_buf kbuf = { .image = image, .buf_align = PAGE_SIZE,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 84 .buf_min = 0, .buf_max = ULONG_MAX,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 85 .top_down = true };
7b8589cc29e7c3 Mimi Zohar 2016-12-19 86 unsigned long binary_runtime_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 87
7b8589cc29e7c3 Mimi Zohar 2016-12-19 88 /* use more understandable variable names than defined in kbuf */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 89 void *kexec_buffer = NULL;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 90 size_t kexec_buffer_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 91 size_t kexec_segment_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 92 int ret;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 93
7b8589cc29e7c3 Mimi Zohar 2016-12-19 94 /*
7b8589cc29e7c3 Mimi Zohar 2016-12-19 95 * Reserve an extra half page of memory for additional measurements
7b8589cc29e7c3 Mimi Zohar 2016-12-19 96 * added during the kexec load.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 97 */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 98 binary_runtime_size = ima_get_binary_runtime_size();
7b8589cc29e7c3 Mimi Zohar 2016-12-19 99 if (binary_runtime_size >= ULONG_MAX - PAGE_SIZE)
7b8589cc29e7c3 Mimi Zohar 2016-12-19 100 kexec_segment_size = ULONG_MAX;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 101 else
7b8589cc29e7c3 Mimi Zohar 2016-12-19 102 kexec_segment_size = ALIGN(ima_get_binary_runtime_size() +
7b8589cc29e7c3 Mimi Zohar 2016-12-19 103 PAGE_SIZE / 2, PAGE_SIZE);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 104 if ((kexec_segment_size == ULONG_MAX) ||
ca79b0c211af63 Arun KS 2018-12-28 105 ((kexec_segment_size >> PAGE_SHIFT) > totalram_pages() / 2)) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 106 pr_err("Binary measurement list too large.\n");
7b8589cc29e7c3 Mimi Zohar 2016-12-19 107 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 108 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 109
7b8589cc29e7c3 Mimi Zohar 2016-12-19 110 ima_dump_measurement_list(&kexec_buffer_size, &kexec_buffer,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 111 kexec_segment_size);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 112 if (!kexec_buffer) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 113 pr_err("Not enough memory for the kexec measurement buffer.\n");
7b8589cc29e7c3 Mimi Zohar 2016-12-19 114 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 115 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 116
7b8589cc29e7c3 Mimi Zohar 2016-12-19 117 kbuf.buffer = kexec_buffer;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 118 kbuf.bufsz = kexec_buffer_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 119 kbuf.memsz = kexec_segment_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 120 ret = kexec_add_buffer(&kbuf);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 121 if (ret) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 122 pr_err("Error passing over kexec measurement buffer.\n");
6d14c6517885fa Lakshmi Ramasubramanian 2021-02-04 123 vfree(kexec_buffer);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 124 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 125 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 126
0c605158be3210 Lakshmi Ramasubramanian 2021-02-21 127 image->ima_buffer_addr = kbuf.mem;
0c605158be3210 Lakshmi Ramasubramanian 2021-02-21 128 image->ima_buffer_size = kexec_segment_size;
f31e3386a4e92b Lakshmi Ramasubramanian 2021-02-04 129 image->ima_buffer = kexec_buffer;
f31e3386a4e92b Lakshmi Ramasubramanian 2021-02-04 130
7b8589cc29e7c3 Mimi Zohar 2016-12-19 131 pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n",
7b8589cc29e7c3 Mimi Zohar 2016-12-19 132 kbuf.mem);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 133 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 134 #endif /* IMA_KEXEC */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 135
:::::: The code at line 81 was first introduced by commit
:::::: 7b8589cc29e7c35dcfd2d5138979f17b48f90110 ima: on soft reboot, save the measurement list
:::::: TO: Mimi Zohar <zohar@linux.vnet.ibm.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42572 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer'
Date: Wed, 09 Jun 2021 12:10:39 +0800 [thread overview]
Message-ID: <202106091229.uCfgCAOZ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 7603 bytes --]
Hi Lakshmi,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 368094df48e680fa51cedb68537408cfa64b788e
commit: dce92f6b11c3174737bd65eaf933458909b633ff arm64: Enable passing IMA log to next kernel on kexec
date: 3 months ago
config: arm64-randconfig-r004-20210609 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d2012d965d60c3258b3a69d024491698f8aec386)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dce92f6b11c3174737bd65eaf933458909b633ff
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout dce92f6b11c3174737bd65eaf933458909b633ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer' [-Wmissing-prototypes]
void ima_add_kexec_buffer(struct kimage *image)
^
security/integrity/ima/ima_kexec.c:81:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void ima_add_kexec_buffer(struct kimage *image)
^
static
1 warning generated.
vim +/ima_add_kexec_buffer +81 security/integrity/ima/ima_kexec.c
7b8589cc29e7c3 Mimi Zohar 2016-12-19 74
7b8589cc29e7c3 Mimi Zohar 2016-12-19 75 /*
7b8589cc29e7c3 Mimi Zohar 2016-12-19 76 * Called during kexec_file_load so that IMA can add a segment to the kexec
7b8589cc29e7c3 Mimi Zohar 2016-12-19 77 * image for the measurement list for the next kernel.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 78 *
7b8589cc29e7c3 Mimi Zohar 2016-12-19 79 * This function assumes that kexec_mutex is held.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 80 */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 @81 void ima_add_kexec_buffer(struct kimage *image)
7b8589cc29e7c3 Mimi Zohar 2016-12-19 82 {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 83 struct kexec_buf kbuf = { .image = image, .buf_align = PAGE_SIZE,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 84 .buf_min = 0, .buf_max = ULONG_MAX,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 85 .top_down = true };
7b8589cc29e7c3 Mimi Zohar 2016-12-19 86 unsigned long binary_runtime_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 87
7b8589cc29e7c3 Mimi Zohar 2016-12-19 88 /* use more understandable variable names than defined in kbuf */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 89 void *kexec_buffer = NULL;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 90 size_t kexec_buffer_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 91 size_t kexec_segment_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 92 int ret;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 93
7b8589cc29e7c3 Mimi Zohar 2016-12-19 94 /*
7b8589cc29e7c3 Mimi Zohar 2016-12-19 95 * Reserve an extra half page of memory for additional measurements
7b8589cc29e7c3 Mimi Zohar 2016-12-19 96 * added during the kexec load.
7b8589cc29e7c3 Mimi Zohar 2016-12-19 97 */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 98 binary_runtime_size = ima_get_binary_runtime_size();
7b8589cc29e7c3 Mimi Zohar 2016-12-19 99 if (binary_runtime_size >= ULONG_MAX - PAGE_SIZE)
7b8589cc29e7c3 Mimi Zohar 2016-12-19 100 kexec_segment_size = ULONG_MAX;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 101 else
7b8589cc29e7c3 Mimi Zohar 2016-12-19 102 kexec_segment_size = ALIGN(ima_get_binary_runtime_size() +
7b8589cc29e7c3 Mimi Zohar 2016-12-19 103 PAGE_SIZE / 2, PAGE_SIZE);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 104 if ((kexec_segment_size == ULONG_MAX) ||
ca79b0c211af63 Arun KS 2018-12-28 105 ((kexec_segment_size >> PAGE_SHIFT) > totalram_pages() / 2)) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 106 pr_err("Binary measurement list too large.\n");
7b8589cc29e7c3 Mimi Zohar 2016-12-19 107 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 108 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 109
7b8589cc29e7c3 Mimi Zohar 2016-12-19 110 ima_dump_measurement_list(&kexec_buffer_size, &kexec_buffer,
7b8589cc29e7c3 Mimi Zohar 2016-12-19 111 kexec_segment_size);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 112 if (!kexec_buffer) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 113 pr_err("Not enough memory for the kexec measurement buffer.\n");
7b8589cc29e7c3 Mimi Zohar 2016-12-19 114 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 115 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 116
7b8589cc29e7c3 Mimi Zohar 2016-12-19 117 kbuf.buffer = kexec_buffer;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 118 kbuf.bufsz = kexec_buffer_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 119 kbuf.memsz = kexec_segment_size;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 120 ret = kexec_add_buffer(&kbuf);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 121 if (ret) {
7b8589cc29e7c3 Mimi Zohar 2016-12-19 122 pr_err("Error passing over kexec measurement buffer.\n");
6d14c6517885fa Lakshmi Ramasubramanian 2021-02-04 123 vfree(kexec_buffer);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 124 return;
7b8589cc29e7c3 Mimi Zohar 2016-12-19 125 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 126
0c605158be3210 Lakshmi Ramasubramanian 2021-02-21 127 image->ima_buffer_addr = kbuf.mem;
0c605158be3210 Lakshmi Ramasubramanian 2021-02-21 128 image->ima_buffer_size = kexec_segment_size;
f31e3386a4e92b Lakshmi Ramasubramanian 2021-02-04 129 image->ima_buffer = kexec_buffer;
f31e3386a4e92b Lakshmi Ramasubramanian 2021-02-04 130
7b8589cc29e7c3 Mimi Zohar 2016-12-19 131 pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n",
7b8589cc29e7c3 Mimi Zohar 2016-12-19 132 kbuf.mem);
7b8589cc29e7c3 Mimi Zohar 2016-12-19 133 }
7b8589cc29e7c3 Mimi Zohar 2016-12-19 134 #endif /* IMA_KEXEC */
7b8589cc29e7c3 Mimi Zohar 2016-12-19 135
:::::: The code at line 81 was first introduced by commit
:::::: 7b8589cc29e7c35dcfd2d5138979f17b48f90110 ima: on soft reboot, save the measurement list
:::::: TO: Mimi Zohar <zohar@linux.vnet.ibm.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42572 bytes --]
next reply other threads:[~2021-06-09 4:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 4:10 kernel test robot [this message]
2021-06-09 4:10 ` security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer' kernel test robot
2021-06-09 14:26 ` nramas
2021-06-09 14:26 ` nramas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202106091229.uCfgCAOZ-lkp@intel.com \
--to=lkp@intel.com \
--cc=bauerman@linux.ibm.com \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nramas@linux.microsoft.com \
--cc=prsriva@linux.microsoft.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.