[libcamera-devel,2/2] v4l2: v4l2_compat_manager: Use openat64 and mmap64

Message ID 20200616105633.57717-2-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • [libcamera-devel,1/2] v4l2: v4l2_compat: Intercept open64, openat64, and mmap64
Related show

Commit Message

Paul Elder June 16, 2020, 10:56 a.m. UTC
Since we set _FILE_OFFSET_BITS to 32 to force the various open and mmap
symbols that we export to not be the 64-bit versions, our dlsym to get
the original open and mmap calls will not automatically be converted to
their 64-bit versions. Since we intercept both 32-bit and 64-bit
versions of open and mmap, we should be using the 64-bit version to
service both. Fetch the 64-bit versions of openat and mmap directly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/v4l2/v4l2_compat_manager.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart June 17, 2020, 12:29 a.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Tue, Jun 16, 2020 at 07:56:33PM +0900, Paul Elder wrote:
> Since we set _FILE_OFFSET_BITS to 32 to force the various open and mmap
> symbols that we export to not be the 64-bit versions, our dlsym to get
> the original open and mmap calls will not automatically be converted to
> their 64-bit versions. Since we intercept both 32-bit and 64-bit
> versions of open and mmap, we should be using the 64-bit version to
> service both. Fetch the 64-bit versions of openat and mmap directly.

Ah, this answer a question from the review of 1/2 :-) Shouldn't this
patch be squashed with 1/2 to avoid bisection breakages ?

> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  src/v4l2/v4l2_compat_manager.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp
> index f928760..9298c0f 100644
> --- a/src/v4l2/v4l2_compat_manager.cpp
> +++ b/src/v4l2/v4l2_compat_manager.cpp
> @@ -39,11 +39,11 @@ void get_symbol(T &func, const char *name)
>  V4L2CompatManager::V4L2CompatManager()
>  	: cm_(nullptr)
>  {
> -	get_symbol(fops_.openat, "openat");
> +	get_symbol(fops_.openat, "openat64");
>  	get_symbol(fops_.dup, "dup");
>  	get_symbol(fops_.close, "close");
>  	get_symbol(fops_.ioctl, "ioctl");
> -	get_symbol(fops_.mmap, "mmap");
> +	get_symbol(fops_.mmap, "mmap64");
>  	get_symbol(fops_.munmap, "munmap");
>  }
>

Patch

diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp
index f928760..9298c0f 100644
--- a/src/v4l2/v4l2_compat_manager.cpp
+++ b/src/v4l2/v4l2_compat_manager.cpp
@@ -39,11 +39,11 @@  void get_symbol(T &func, const char *name)
 V4L2CompatManager::V4L2CompatManager()
 	: cm_(nullptr)
 {
-	get_symbol(fops_.openat, "openat");
+	get_symbol(fops_.openat, "openat64");
 	get_symbol(fops_.dup, "dup");
 	get_symbol(fops_.close, "close");
 	get_symbol(fops_.ioctl, "ioctl");
-	get_symbol(fops_.mmap, "mmap");
+	get_symbol(fops_.mmap, "mmap64");
 	get_symbol(fops_.munmap, "munmap");
 }