linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer'
@ 2021-06-09  4:10 kernel test robot
  2021-06-09 14:26 ` nramas
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-06-09  4:10 UTC (permalink / raw)
  To: Lakshmi Ramasubramanian
  Cc: kbuild-all, clang-built-linux, linux-kernel, Rob Herring,
	Prakhar Srivastava, Thiago Jung Bauermann

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype for function 'ima_add_kexec_buffer'
  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
  0 siblings, 0 replies; 2+ messages in thread
From: nramas @ 2021-06-09 14:26 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, clang-built-linux, linux-kernel, Rob Herring,
	Prakhar Srivastava, Thiago Jung Bauermann

On Wed, 2021-06-09 at 12:10 +0800, kernel test robot wrote:

Hi,

>         # 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)
>         ^

"linux/ima.h" needs to be included in
"security/integrity/ima/ima_kexec.c" to fix the above warning.

Thanks for reporting. I will post a patch shortly.

 -lakshmi

>    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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-09 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).