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

intel_name_lookup_shim.c (get_intel_device_name): Fix SEGFAULT #958

Conversation

artyom-poptsov
Copy link
Contributor

btop would always fail with "Segmentation fault" when used on machines where the GPU does not have a codename (e.g. on embedded Intel graphics on Intel(R) Atom(TM) CPU D2500.) The reason for this behavior is that when a GPU does not have codename (it is NULL) the call to "strcpy" segfaults as the procedure effectively tries to access a NULL pointer.

  • src/linux/intel_gpu_top/intel_name_lookup_shim.c (get_intel_device_name): Add a check if "info->codename" is null; if it is, set the device name to "(unknown)" to prevent the SEGFAULT error.

btop would always fail with "Segmentation fault" when used on machines where the
GPU does not have a codename (e.g. on embedded Intel graphics on Intel(R)
Atom(TM) CPU D2500.)  The reason for this behavior is that when a GPU does not
have codename (it is NULL) the call to "strcpy" segfaults as the procedure
effectively tries to access a NULL pointer.

* src/linux/intel_gpu_top/intel_name_lookup_shim.c (get_intel_device_name): Add
a check if "info->codename" is null; if it is, set the device name to
"(unknown)" to prevent the SEGFAULT error.
@artyom-poptsov artyom-poptsov deleted the avp-fix-embedded-intel-graphics-segfault branch November 3, 2024 09:09
Copy link
Owner

@aristocratos aristocratos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix.
Thanks for contributing!

@aristocratos aristocratos merged commit df3f052 into aristocratos:main Nov 3, 2024
44 checks passed
github-actions bot pushed a commit to guix-ru/guix that referenced this pull request Nov 3, 2024
btop would fail on built-in Intel GPUs, this patch fixes that (see
<aristocratos/btop#958>.)

* gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/admin.scm (btop): Use it.

Change-Id: Ic2bbf55a5f892a37bde17db6fb15025733b9bad6
Reviewed-by: Z572 <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants