* [PATCH] LSM: Fix type of id parameter in kernel_post_load_data prototype
@ 2020-10-06 20:11 Nathan Chancellor
2020-10-07 7:02 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2020-10-06 20:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, Kees Cook
Cc: James Morris, KP Singh, Nick Desaulniers, linux-kernel,
clang-built-linux, Nathan Chancellor
Clang warns:
security/security.c:1716:59: warning: implicit conversion from
enumeration type 'enum kernel_load_data_id' to different enumeration
type 'enum kernel_read_file_id' [-Wenum-conversion]
ret = call_int_hook(kernel_post_load_data, 0, buf, size, id,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
security/security.c:715:22: note: expanded from macro 'call_int_hook'
RC = P->hook.FUNC(__VA_ARGS__); \
~ ^~~~~~~~~~~
1 warning generated.
There is a mismatch between the id parameter type in
security_kernel_post_load_data and the function pointer prototype that
is created by the LSM_HOOK macro in the security_list_options union. Fix
the type in the LSM_HOOK macro as 'enum kernel_load_data_id' is what is
expected.
Fixes: b64fcae74b6d ("LSM: Introduce kernel_post_load_data() hook")
Link: https://github.com/ClangBuiltLinux/linux/issues/1172
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
include/linux/lsm_hook_defs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
index d67cb3502310..32a940117e7a 100644
--- a/include/linux/lsm_hook_defs.h
+++ b/include/linux/lsm_hook_defs.h
@@ -186,7 +186,7 @@ LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents)
LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size,
- enum kernel_read_file_id id, char *description)
+ enum kernel_load_data_id id, char *description)
LSM_HOOK(int, 0, kernel_read_file, struct file *file,
enum kernel_read_file_id id, bool contents)
LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
base-commit: dba8648dcab90564b8a11c952c06a9e1153506fb
--
2.29.0.rc0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] LSM: Fix type of id parameter in kernel_post_load_data prototype
2020-10-06 20:11 [PATCH] LSM: Fix type of id parameter in kernel_post_load_data prototype Nathan Chancellor
@ 2020-10-07 7:02 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2020-10-07 7:02 UTC (permalink / raw)
To: Nathan Chancellor, Greg Kroah-Hartman
Cc: James Morris, KP Singh, Nick Desaulniers, linux-kernel,
clang-built-linux
On Tue, Oct 06, 2020 at 01:11:15PM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> security/security.c:1716:59: warning: implicit conversion from
> enumeration type 'enum kernel_load_data_id' to different enumeration
> type 'enum kernel_read_file_id' [-Wenum-conversion]
> ret = call_int_hook(kernel_post_load_data, 0, buf, size, id,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
> security/security.c:715:22: note: expanded from macro 'call_int_hook'
> RC = P->hook.FUNC(__VA_ARGS__); \
> ~ ^~~~~~~~~~~
> 1 warning generated.
>
> There is a mismatch between the id parameter type in
> security_kernel_post_load_data and the function pointer prototype that
> is created by the LSM_HOOK macro in the security_list_options union. Fix
> the type in the LSM_HOOK macro as 'enum kernel_load_data_id' is what is
> expected.
>
> Fixes: b64fcae74b6d ("LSM: Introduce kernel_post_load_data() hook")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1172
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Ah yes; thank you! Greg, can you add this to your tree?
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> include/linux/lsm_hook_defs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
> index d67cb3502310..32a940117e7a 100644
> --- a/include/linux/lsm_hook_defs.h
> +++ b/include/linux/lsm_hook_defs.h
> @@ -186,7 +186,7 @@ LSM_HOOK(int, 0, kernel_create_files_as, struct cred *new, struct inode *inode)
> LSM_HOOK(int, 0, kernel_module_request, char *kmod_name)
> LSM_HOOK(int, 0, kernel_load_data, enum kernel_load_data_id id, bool contents)
> LSM_HOOK(int, 0, kernel_post_load_data, char *buf, loff_t size,
> - enum kernel_read_file_id id, char *description)
> + enum kernel_load_data_id id, char *description)
> LSM_HOOK(int, 0, kernel_read_file, struct file *file,
> enum kernel_read_file_id id, bool contents)
> LSM_HOOK(int, 0, kernel_post_read_file, struct file *file, char *buf,
>
> base-commit: dba8648dcab90564b8a11c952c06a9e1153506fb
> --
> 2.29.0.rc0
>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-07 7:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 20:11 [PATCH] LSM: Fix type of id parameter in kernel_post_load_data prototype Nathan Chancellor
2020-10-07 7:02 ` Kees Cook
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).