[integrity:next-restore-kexec,5/9] kernel/kexec_file.c:206:2: error: implicit declaration of function 'ima_add_kexec_buffer'
diff mbox

Message ID 1548969.9JfI2IRN2U@hactar
State New
Headers show

Commit Message

Thiago Jung Bauermann Aug. 23, 2016, 4:56 p.m. UTC
Am Dienstag, 23 August 2016, 22:20:55 schrieb kbuild test robot:
> tree:  
> https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
> next-restore-kexec head:   62bc4b565254de4796a0835f6f67569eb4835f9f
> commit: 4733b1cd5da19fc80df1c1a91f1b1f2a94e70938 [5/9] ima: on soft
> reboot, save the measurement list config: x86_64-randconfig-x015-201634
> (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         git checkout 4733b1cd5da19fc80df1c1a91f1b1f2a94e70938
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
> 
> All errors (new ones prefixed by >>):
> 
>    kernel/kexec_file.c: In function 'kimage_file_prepare_segments':
> >> kernel/kexec_file.c:206:2: error: implicit declaration of function
> >> 'ima_add_kexec_buffer' [-Werror=implicit-function-declaration]
>      ima_add_kexec_buffer(image);
>      ^~~~~~~~~~~~~~~~~~~~

This happens with CONFIG_IMA=n and CONFIG_KEXEC_FILE=y. You can fix it with 
the following change in the patch "ima: on soft reboot, save the measurement 
list":

    Declare stub ima_add_kexec_buffer and stub struct kimage when CONFIG_IMA=n
    or CONFIG_IMA_KEXEC=n.



This patch also incorporates the change to fix
"[integrity:next-restore-kexec 5/9] include/linux/ima.h:30:48: warning:
'struct kimage' declared inside parameter list" that I just sent.

Comments

Mimi Zohar Aug. 24, 2016, 2:50 a.m. UTC | #1
Hi Thiago,

On Tue, 2016-08-23 at 13:56 -0300, Thiago Jung Bauermann wrote:
> Am Dienstag, 23 August 2016, 22:20:55 schrieb kbuild test robot:
> > tree:  
> > https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
> > next-restore-kexec head:   62bc4b565254de4796a0835f6f67569eb4835f9f
> > commit: 4733b1cd5da19fc80df1c1a91f1b1f2a94e70938 [5/9] ima: on soft
> > reboot, save the measurement list config: x86_64-randconfig-x015-201634
> > (attached as .config)
> > compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> > reproduce:
> >         git checkout 4733b1cd5da19fc80df1c1a91f1b1f2a94e70938
> >         # save the attached .config to linux build tree
> >         make ARCH=x86_64
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    kernel/kexec_file.c: In function 'kimage_file_prepare_segments':
> > >> kernel/kexec_file.c:206:2: error: implicit declaration of function
> > >> 'ima_add_kexec_buffer' [-Werror=implicit-function-declaration]
> >      ima_add_kexec_buffer(image);
> >      ^~~~~~~~~~~~~~~~~~~~
> 
> This happens with CONFIG_IMA=n and CONFIG_KEXEC_FILE=y. You can fix it with 
> the following change in the patch "ima: on soft reboot, save the measurement 
> list":
> 
>     Declare stub ima_add_kexec_buffer and stub struct kimage when CONFIG_IMA=n
>     or CONFIG_IMA_KEXEC=n.
> 
> diff --git a/include/linux/ima.h b/include/linux/ima.h
> index 6a2450ca13f1..e3d617526bed 100644
> --- a/include/linux/ima.h
> +++ b/include/linux/ima.h
> @@ -26,10 +26,6 @@ extern void ima_post_path_mknod(struct dentry *dentry);
> 
>  #ifdef CONFIG_IMA_KEXEC
>  extern void ima_add_kexec_buffer(struct kimage *image);
> -#else
> -static inline void ima_add_kexec_buffer(struct kimage *image)
> -{
> -}
>  #endif
> 
>  #else
> @@ -71,6 +67,14 @@ static inline void ima_post_path_mknod(struct dentry *dentry)
> 
>  #endif /* CONFIG_IMA */
> 
> +#if !defined(CONFIG_IMA) || !defined(CONFIG_IMA_KEXEC)

Thank you for resolving this!  I think it can be simplified since
CONFIG_IMA_KEXEC is dependent on CONFIG_IMA.

Mimi

> +struct kimage;
> +
> +static inline void ima_add_kexec_buffer(struct kimage *image)
> +{
> +}
> +#endif
> +
>  #ifdef CONFIG_IMA_APPRAISE
>  extern void ima_inode_post_setattr(struct dentry *dentry);
>  extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
> 
> 
> This patch also incorporates the change to fix
> "[integrity:next-restore-kexec 5/9] include/linux/ima.h:30:48: warning:
> 'struct kimage' declared inside parameter list" that I just sent.
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/include/linux/ima.h b/include/linux/ima.h
index 6a2450ca13f1..e3d617526bed 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -26,10 +26,6 @@  extern void ima_post_path_mknod(struct dentry *dentry);
 
 #ifdef CONFIG_IMA_KEXEC
 extern void ima_add_kexec_buffer(struct kimage *image);
-#else
-static inline void ima_add_kexec_buffer(struct kimage *image)
-{
-}
 #endif
 
 #else
@@ -71,6 +67,14 @@  static inline void ima_post_path_mknod(struct dentry *dentry)
 
 #endif /* CONFIG_IMA */
 
+#if !defined(CONFIG_IMA) || !defined(CONFIG_IMA_KEXEC)
+struct kimage;
+
+static inline void ima_add_kexec_buffer(struct kimage *image)
+{
+}
+#endif
+
 #ifdef CONFIG_IMA_APPRAISE
 extern void ima_inode_post_setattr(struct dentry *dentry);
 extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,