From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id UFfsL2c/J2c4ogAA62LTzQ:P1 (envelope-from ) for ; Sun, 03 Nov 2024 09:16:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id UFfsL2c/J2c4ogAA62LTzQ (envelope-from ) for ; Sun, 03 Nov 2024 10:16:23 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=WgSckciM; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=Nok7KNSg; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730625383; a=rsa-sha256; cv=none; b=X09x3n39Is8Rpimb+0PtPbXnNd/YWRWcxYygGNtC413x6i5G3HwXLAZJ1q6eb8QgRGD/I8 ykXPz+EVz6MMLmLT84gyNlFp0SQGTLULFdoDTBaKOtcZ4ZZ4Og3KCLhhafKApNYM8y1i/H g3j6DSHYnZUawA6QksgfSQ36uQ+Tm847M8AxGJ7qRYuq0Vlas1KeJG2Fft7GVOpRW8F2qg m+HXJib2lfv4+xff4xvj5kFKjwJQYOO3WMYxCz1c9ZC39xaD1eCFUPGjvX6GIixlqMvw1W WQYtC8RrMLdmFwi5p4diU78uA2mD40CaNcQN03AemzUszzONztV7dN1oPyq9pw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=WgSckciM; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=Nok7KNSg; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730625383; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=SOUKZdQh/GUqJPjli260G2W2sf+MmvOTtQ+YUWZNv4A=; b=n5ebOx1z+F70b+aPFXC0e8CLIprYsK/ObNFOUABRgiZ1YLIWA+6ezj6CfLxFlIzD3Mo/TT SGqToyvcivR5A9oD/00svhFWuO8ZWRE9W4JVKpI4kE3EGNnxWFGLX+hKuWKwTnEOv4uNYt DC9slIMGmMGSaTMreaXzd/nUUJOunguVwGq1g1Zl+Hnup5sv7XP5SOp+Bb6Qb1q/a8Ca1q 7fU9h4rqkCWZ31Bn3cB5CZYvQWT7SDJcOcXsbGzL8UmUPgYUr3kuJZfQPdYG9BrqZzFPEk xMAqBsjxXe3VbvhDNSyZUqFNVACOZPIjii4p2Wnix7ahNCmW6RreH1KJwML1jw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1198E1E42A for ; Sun, 03 Nov 2024 10:16:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7WiL-0006uI-PU; Sun, 03 Nov 2024 04:16:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7WiJ-0006tI-2G for guix-patches@gnu.org; Sun, 03 Nov 2024 04:16:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7WiI-0003bh-Q4 for guix-patches@gnu.org; Sun, 03 Nov 2024 04:16:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=SOUKZdQh/GUqJPjli260G2W2sf+MmvOTtQ+YUWZNv4A=; b=WgSckciM1kE5DCk8d3bhlcaq8+v9V2a1/uf86RZFMPw9S2dnks+4a/sg4FH6cge04OHVWJshhqy1JrSSmwK9FQwiPnknVrss8aIy2YDqdrtHGQbRTd8C0zJC4wy9B0DK2t2OSEUVohXROehOIQEf7WeemJCHIPyOSKo+qhbQHM1Kz7YEI95LSqLuA5aOePkjJJveup1GI1aN7LFRpLEvkEjPRoXkKD4QIfV265eNL1YR6TOMqXC3In/FXNJ4f9RVuqgpLrAkycmgaopLucXgflkRlN6/Ds4+U6h+PhBz6Uog1pEOWK2P/QYzGwQ/N957/XTTYFVOstby4MyDpNTwAg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t7WiI-0007RY-KJ for guix-patches@gnu.org; Sun, 03 Nov 2024 04:16:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74183] [PATCH 2/2] gnu: btop: Fix SEGFAULT error on Intel GPUs. Resent-From: "Artyom V. Poptsov" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Nov 2024 09:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74183 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74183@debbugs.gnu.org Cc: "Artyom V. Poptsov" Received: via spool by 74183-submit@debbugs.gnu.org id=B74183.173062533928584 (code B ref 74183); Sun, 03 Nov 2024 09:16:02 +0000 Received: (at 74183) by debbugs.gnu.org; 3 Nov 2024 09:15:39 +0000 Received: from localhost ([127.0.0.1]:59106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7Whv-0007Qv-AS for submit@debbugs.gnu.org; Sun, 03 Nov 2024 04:15:39 -0500 Received: from mail-lf1-f45.google.com ([209.85.167.45]:41059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t7Wht-0007Qd-27 for 74183@debbugs.gnu.org; Sun, 03 Nov 2024 04:15:37 -0500 Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-539d9ba5c81so418460e87.0 for <74183@debbugs.gnu.org>; Sun, 03 Nov 2024 01:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730625276; x=1731230076; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SOUKZdQh/GUqJPjli260G2W2sf+MmvOTtQ+YUWZNv4A=; b=Nok7KNSgf6YD+k6i3pHSFBkch15+xZjWuP6sdrQiITFBJNHE3fMmCx/S+beTexqQJp kTxs64UPtirRDs0BkA93ohp34ucBQh1PCdbaz9XYkHwf9fp71Pj+gbY8KLg0t86Ve6BW kjpngFsX/uS0Ah4KqPgBCat2FacPHXIRTy/dICQTJffQB33RHGxj0tSasuuf481OXvNZ ijGpfFgtIdKIbKDDQlofcuKFITxNj4RKuzGG75z05HTLJ2+LFE4okwQYJieUQWRblwGj f9bu+wXb+bq+NAjo64lXyzlnoUPW47ppuYNKmidBMPWR+8o6T8M3/KjZI8MxTuTKCk7v j3aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730625276; x=1731230076; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SOUKZdQh/GUqJPjli260G2W2sf+MmvOTtQ+YUWZNv4A=; b=vgWzYPEeKIKR2y6nDyFzedFJl0xxCeO/N6R/iNaMkHDbrVqu1GTJU7PHXoXPo9mGjb 4GIfUNmLZ+dXp/kYPuF4KzjrmOsBSZlAZWzN54hG9fB76sdMvBNPRPxcbV3bUyXg5Saa r9n9zSJSCx9z+pipsnGmEX6qu6JG9G2sxUpP4PoYRkB9VqYqmMwxfao501/aRqdcxD1a Cb0t/v4GWs5+2HOu/BgXPJu2JrHJr+4JO45XOGdJ5nq6Cg6ZEplYykhC92SzJbzH5rwD j7YKpM9Yu8nb4pF73Fq+7KdSc9JyvtxhD0MOQNbSaP+oh2rk+S2rvd9d411yqHJfmQJk sgVA== X-Gm-Message-State: AOJu0YynxkhYz1MsdqgXrxn5aJl7Nk2+h0ud3WAyiQkGa546GXhEysVf 6v/aeb5doW4GO8o1HfjpsuAoJIg72ZrxmQNmKGRf2LRzYle2K7/B73C5F6Sia/M= X-Google-Smtp-Source: AGHT+IFLFoSckhKLDj4165HkbNLMYU5riKMXJ7iUeFylJM5nvl270fzTu7kMcfX+M8oYMNLZOhd85Q== X-Received: by 2002:a05:6512:b0d:b0:53a:415:d33b with SMTP id 2adb3069b0e04-53b34b36e23mr4080088e87.10.1730625275770; Sun, 03 Nov 2024 01:14:35 -0800 (PST) Received: from elephant.. ([95.79.6.229]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bde09adsm1232285e87.263.2024.11.03.01.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 01:14:34 -0800 (PST) From: "Artyom V. Poptsov" Date: Sun, 3 Nov 2024 12:14:26 +0300 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -0.95 X-Spam-Score: -0.95 X-Migadu-Queue-Id: 1198E1E42A X-Migadu-Scanner: mx12.migadu.com X-TUID: +hnmQnqURwJ1 btop would fail on built-in Intel GPUs, this patch fixes that (see .) * 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 --- gnu/local.mk | 1 + gnu/packages/admin.scm | 4 +- .../btop-fix-segfault-on-intel-gpus.patch | 47 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch diff --git a/gnu/local.mk b/gnu/local.mk index 1040b3927b..6f96cf5794 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1018,6 +1018,7 @@ dist_patch_DATA = \ %D%/packages/patches/bsd-games-number.c-and-test.patch \ %D%/packages/patches/bsd-games-prevent-name-collisions.patch \ %D%/packages/patches/bsd-games-stdio.h.patch \ + %D%/packages/patches/btop-fix-segfault-on-intel-gpus.patch \ %D%/packages/patches/beancount-disable-googleapis-fonts.patch \ %D%/packages/patches/beignet-correct-file-names.patch \ %D%/packages/patches/bidiv-update-fribidi.patch \ diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index bc8f0efdef..4ae4db641f 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -773,7 +773,9 @@ (define-public btop (file-name (git-file-name name version)) (sha256 (base32 - "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603")))) + "0vgw6hwqh6zbzrvrn3i0xwi9ykm1qdvhqcyz3mjakd7w303lx603")) + (patches + (search-patches "btop-fix-segfault-on-intel-gpus.patch")))) (build-system gnu-build-system) (native-inputs (list lowdown)) (arguments diff --git a/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch new file mode 100644 index 0000000000..d3618a374a --- /dev/null +++ b/gnu/packages/patches/btop-fix-segfault-on-intel-gpus.patch @@ -0,0 +1,47 @@ +From 0ed4e9e907b3a3f1c2ae209b1dab384b1fa7a490 Mon Sep 17 00:00:00 2001 +From: "Artyom V. Poptsov" +Date: Sun, 3 Nov 2024 09:02:45 +0300 +Subject: [PATCH] intel_name_lookup_shim.c (get_intel_device_name): Fix + SEGFAULT + +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. +--- + src/linux/intel_gpu_top/intel_name_lookup_shim.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/linux/intel_gpu_top/intel_name_lookup_shim.c b/src/linux/intel_gpu_top/intel_name_lookup_shim.c +index e714f80..38f87fa 100644 +--- a/src/linux/intel_gpu_top/intel_name_lookup_shim.c ++++ b/src/linux/intel_gpu_top/intel_name_lookup_shim.c +@@ -84,10 +84,14 @@ char *get_intel_device_name(const char *device_id) { + char full_name[256]; + const struct intel_device_info *info = intel_get_device_info(devid); + if (info) { +- strcpy(dev_name, info->codename); +- dev_name[0] = toupper(dev_name[0]); ++ if (info->codename == NULL) { ++ strcpy(dev_name, "(unknown)"); ++ } else { ++ strcpy(dev_name, info->codename); ++ dev_name[0] = toupper(dev_name[0]); ++ } + snprintf(full_name, sizeof(full_name), "Intel %s (Gen%u)", dev_name, info->graphics_ver); + return strdup(full_name); + } + return NULL; +-} +\ No newline at end of file ++} + +base-commit: 2e7208d59c54515080027a5ecbb89d2054047985 +-- +2.46.0 + -- 2.46.0