Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building evdi on Fedora 39 / Linux 6.7.9 #461

Closed
Tahaan opened this issue Mar 27, 2024 · 4 comments
Closed

Error building evdi on Fedora 39 / Linux 6.7.9 #461

Tahaan opened this issue Mar 27, 2024 · 4 comments

Comments

@Tahaan
Copy link

Tahaan commented Mar 27, 2024

  • Are you using the latest driver?
Installed Packages
Name         : displaylink
Version      : 1.14.1
Release      : 2
  • Are you using the latest EVDI version?
johan@fedora ~/evdi (main)> git remote -v
origin  https://github.com/DisplayLink/evdi (fetch)
origin  https://github.com/DisplayLink/evdi (push)
johan@fedora ~/evdi (main)> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
johan@fedora ~/evdi (main)> git log -1
commit 9905b9bfed8b7e49befa0530bfb6e464380d938f (HEAD -> main, tag: v1.14.2, origin/main, origin/HEAD)
Author: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
Date:   Wed Jan 31 11:30:22 2024 +0100

    Set version to 1.14.2
johan@fedora ~/evdi (main)> 
  • If you are using a DisplayLink device, have you checked 'troubleshooting'
    on DisplayLink's website?

The same device works fine with either Windows and with KDE-Neon using the Ubuntu packages from the Synaptic web site.

  • Is this issue related to evdi/kernel?

Building evdi

  • Linux distribution and its version
johan@fedora ~/evdi (main)> uname -a
Linux fedora 6.7.9-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Mar  6 19:35:04 UTC 2024 x86_64 GNU/Linux
  • Linux kernel version
    6.7.9-200.fc39.x86_64

  • Xorg version (if used)
    Plasma 5.27.11, kwin, Not really relevant.

  • Desktop environment in use
    KDE/Plasma, not really relevant.

I am hoping that building a newer version of evdi will solve the issue, as I dont know what else to look at. (The problem I am trying to solve is best described by watching this video: https://youtu.be/uZeN9UesBUY)

The error below occurs when trying to build.

johan@fedora ~/evdi (main)> make 
CFLAGS="-isystem./include -isystem./include/uapi -Werror -Wextra -Wall -Wno-error=missing-field-initializers -Werror=sign-compare -Wmissing-prototypes -Wstrict-prototypes -Werror=discarded-qualifiers " make -C module 
make[1]: Entering directory '/home/johan/evdi/module'
make -C /lib/modules/6.7.9-200.fc39.x86_64/build M=$PWD
make[2]: Entering directory '/usr/src/kernels/6.7.9-200.fc39.x86_64'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6)
  You are using:           gcc (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7)
  CC [M]  /home/johan/evdi/module/evdi_platform_drv.o
  CC [M]  /home/johan/evdi/module/evdi_platform_dev.o
  CC [M]  /home/johan/evdi/module/evdi_sysfs.o
  CC [M]  /home/johan/evdi/module/evdi_modeset.o
  CC [M]  /home/johan/evdi/module/evdi_connector.o
  CC [M]  /home/johan/evdi/module/evdi_encoder.o
  CC [M]  /home/johan/evdi/module/evdi_drm_drv.o
  CC [M]  /home/johan/evdi/module/evdi_fb.o
  CC [M]  /home/johan/evdi/module/evdi_gem.o
/home/johan/evdi/module/evdi_gem.c: In function ‘evdi_gem_fault’:
/home/johan/evdi/module/evdi_gem.c:214:40: error: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘loff_t’ {aka ‘long long int’} [-Werror=sign-compare]
  214 |         if (!obj->pages || page_offset >= num_pages)
      |                                        ^~
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:243: /home/johan/evdi/module/evdi_gem.o] Error 1
make[3]: *** [/usr/src/kernels/6.7.9-200.fc39.x86_64/Makefile:1929: /home/johan/evdi/module] Error 2
make[2]: *** [Makefile:246: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/kernels/6.7.9-200.fc39.x86_64'
make[1]: *** [Makefile:86: module] Error 2
make[1]: Leaving directory '/home/johan/evdi/module'
make: *** [Makefile:13: module] Error 2
@Tahaan
Copy link
Author

Tahaan commented Mar 27, 2024

The below commit seem to be to blame

johan@fedora ~/e/module (main) [128]> git log -p evdi_gem.c 
commit 294af3d4ec5b22012174a3b26b773f939dad7dbd
Author: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
Date:   Wed Sep 6 07:49:36 2023 +0200

    Fix possible OOB in evdi_gem_fault

diff --git a/module/evdi_gem.c b/module/evdi_gem.c
index 499d065..efae6e1 100644
--- a/module/evdi_gem.c
+++ b/module/evdi_gem.c
@@ -205,12 +205,13 @@ int evdi_gem_fault(struct vm_fault *vmf)
 #endif
        struct evdi_gem_object *obj = to_evdi_bo(vma->vm_private_data);
        struct page *page;
-       unsigned int page_offset;
+       pgoff_t page_offset;
+       loff_t num_pages = obj->base.size >> PAGE_SHIFT;
        int ret = 0;
 
        page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
-       if (!obj->pages)
+       if (!obj->pages || page_offset >= num_pages)
                return VM_FAULT_SIGBUS;
 
        page = obj->pages[page_offset];

@tanj
Copy link

tanj commented Mar 29, 2024

I also ran into this. I'm not sure if this is the right way to handle this, but I worked around it with the following. I cast, what I think is the smaller type of pgoff_t (long unsigned int) to the larger signed loff_t (long long int)

diff --git a/module/evdi_gem.c b/module/evdi_gem.c
index efae6e1..46dc5fa 100644
--- a/module/evdi_gem.c
+++ b/module/evdi_gem.c
@@ -211,7 +211,7 @@ int evdi_gem_fault(struct vm_fault *vmf)

        page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;

-       if (!obj->pages || page_offset >= num_pages)
+       if (!obj->pages || (loff_t)page_offset >= num_pages)
                return VM_FAULT_SIGBUS;

        page = obj->pages[page_offset];

@arnigb
Copy link

arnigb commented Apr 3, 2024

@tanj the same Issue still occurs on Pop_OS! (kernel 6.8.0)

/my/directory/path/evdi/module/evdi_gem.c: In function ‘evdi_gem_fault’:
/my/directory/path/evdi/module/evdi_gem.c:214:40: error: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘loff_t’ {aka ‘long long int’} [-Werror=sign-compare]
214 | if (!obj->pages || page_offset >= num_pages)
| ^~
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:243: /my/directory/path/evdi/module/evdi_gem.o] Error 1
make[3]: *** [/usr/src/linux-headers-6.8.0-76060800daily20240311-generic/Makefile:1927: /my/directory/path/evdi/module] Error 2
make[2]: *** [Makefile:240: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-6.8.0-76060800daily20240311-generic'
make[1]: *** [Makefile:86: module] Error 2
make[1]: Leaving directory '/my/directory/path/evdi/module'
make: *** [Makefile:13: module] Error 2

@displaylink-emajewsk
Copy link
Contributor

Fixed in 1.14.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants