[libcamera-devel] [PATCH v3 04/10] libcamera: ipa_module: verify IPA module API version upon loading

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jun 5 15:35:13 CEST 2019


Hi Paul,

Thank you for the patch.

On Tue, Jun 04, 2019 at 08:53:10PM -0400, Paul Elder wrote:
> The IPA module API version determines the layout of struct
> IPAModuleInfo. If this version number does not match, then it means that
> the IPA module cannot be loaded at all.

I would say "it means that the IPA module information structure can't be
interpreted, and the module can't be used."

> Validate this version number
> upon loading the IPA module info from the IPA shared object.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> New patch
> 
>  src/libcamera/ipa_module.cpp | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> index f79a44e..2aa508c 100644
> --- a/src/libcamera/ipa_module.cpp
> +++ b/src/libcamera/ipa_module.cpp
> @@ -274,6 +274,9 @@ int IPAModule::loadIPAModuleInfo()
>  		ret = elfLoadSymbol<Elf64_Ehdr, Elf64_Shdr, Elf64_Sym>
>  				   (&info_, sizeof(info_), map, soSize, "ipaModuleInfo");
>  
> +	if (info_.moduleAPIVersion != IPA_MODULE_API_VERSION)
> +		ret = -EINVAL;

Please log a debug message, and

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +
>  unmap:
>  	munmap(map, soSize);
>  close:

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list