Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float
@ 2020-11-24  7:32 tw4452852
  2020-11-24 13:16 ` [PR REVIEW] " ericonr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tw4452852 @ 2020-11-24  7:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

There is a new pull request by tw4452852 against master on the void-packages repository

https://github.com/tw4452852/void-packages igt-gpu_tools
https://github.com/void-linux/void-packages/pull/26673

igt-gpu-tools: fix segment fault on resolve_half_to_float
This patch fix segment fault because the ifunc
resolver resolve_half_to_float() tries to call unbound global function
igt_x86_features().

Fix issue #26671

Signed-off-by: Tw <wei.tan@intel.com>

A patch file from https://github.com/void-linux/void-packages/pull/26673.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-igt-gpu_tools-26673.patch --]
[-- Type: text/x-diff, Size: 3303 bytes --]

From c92a973af73db7956f0bc6f9416a2be5b3857269 Mon Sep 17 00:00:00 2001
From: Tw <wei.tan@intel.com>
Date: Tue, 24 Nov 2020 15:13:16 +0800
Subject: [PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float

This patch fix segment fault because the ifunc
resolver resolve_half_to_float() tries to call unbound global function
igt_x86_features().

Fix issue #26671

Signed-off-by: Tw <wei.tan@intel.com>
---
 ...-loading-failure-in-resolve-function.patch | 63 +++++++++++++++++++
 ...ing-failure-in-resolve-function.patch.args |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch
 create mode 100644 srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch.args

diff --git a/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch
new file mode 100644
index 000000000000..dc977190e92b
--- /dev/null
+++ b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch
@@ -0,0 +1,63 @@
+diff --git a/lib/igt_halffloat.c b/lib/igt_halffloat.c
+index 08ab05fc..e5e8a5bd 100644
+--- a/lib/igt_halffloat.c
++++ b/lib/igt_halffloat.c
+@@ -24,6 +24,19 @@
+ 
+ #include <assert.h>
+ #include <math.h>
++#include <stdbool.h>
++
++#ifdef HAVE_CPUID_H
++#include <cpuid.h>
++#else
++#define __get_cpuid_max(x, y) 0
++#define __cpuid(level, a, b, c, d) a = b = c = d = 0
++#define __cpuid_count(level, count, a, b, c, d) a = b = c = d = 0
++#endif
++
++#ifndef bit_F16C
++#define bit_F16C	(1 << 29)
++#endif
+ 
+ #include "igt_halffloat.h"
+ #include "igt_x86.h"
+@@ -182,6 +195,20 @@ static void half_to_float_f16c(const uint16_t *h, float *f, unsigned int num)
+ 
+ #pragma GCC pop_options
+ 
++static bool f16c_is_supported(void)
++{
++	unsigned max = __get_cpuid_max(0, NULL);
++	unsigned eax, ebx, ecx, edx;
++
++	if (max >= 1) {
++		__cpuid(1, eax, ebx, ecx, edx);
++
++		if (ecx & bit_F16C)
++			return true;
++	}
++	return false;
++}
++
+ static void float_to_half(const float *f, uint16_t *h, unsigned int num)
+ {
+ 	for (int i = 0; i < num; i++)
+@@ -196,7 +223,7 @@ static void half_to_float(const uint16_t *h, float *f, unsigned int num)
+ 
+ static void (*resolve_float_to_half(void))(const float *f, uint16_t *h, unsigned int num)
+ {
+-	if (igt_x86_features() & F16C)
++	if (f16c_is_supported())
+ 		return float_to_half_f16c;
+ 
+ 	return float_to_half;
+@@ -207,7 +234,7 @@ void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)
+ 
+ static void (*resolve_half_to_float(void))(const uint16_t *h, float *f, unsigned int num)
+ {
+-	if (igt_x86_features() & F16C)
++	if (f16c_is_supported())
+ 		return half_to_float_f16c;
+ 
+ 	return half_to_float;
diff --git a/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch.args b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch.args
new file mode 100644
index 000000000000..2eba1cb3c5ce
--- /dev/null
+++ b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch.args
@@ -0,0 +1 @@
+-Np1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR REVIEW] igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
@ 2020-11-24 13:16 ` ericonr
  2020-11-24 13:16 ` ericonr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2020-11-24 13:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/26673#discussion_r529536413

Comment:
Do you have an upstream commit for this?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR REVIEW] igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
  2020-11-24 13:16 ` [PR REVIEW] " ericonr
@ 2020-11-24 13:16 ` ericonr
  2020-11-25  2:03 ` [PR PATCH] [Updated] " tw4452852
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2020-11-24 13:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/26673#discussion_r529536721

Comment:
```suggestion
--- lib/igt_halffloat.c
+++ lib/igt_halffloat.c
```

So you don't need the `.args` file.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
  2020-11-24 13:16 ` [PR REVIEW] " ericonr
  2020-11-24 13:16 ` ericonr
@ 2020-11-25  2:03 ` tw4452852
  2020-11-25  2:04 ` [PR REVIEW] " tw4452852
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tw4452852 @ 2020-11-25  2:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

There is an updated pull request by tw4452852 against master on the void-packages repository

https://github.com/tw4452852/void-packages igt-gpu_tools
https://github.com/void-linux/void-packages/pull/26673

igt-gpu-tools: fix segment fault on resolve_half_to_float
This patch fix segment fault because the ifunc
resolver resolve_half_to_float() tries to call unbound global function
igt_x86_features().

Fix issue #26671

Signed-off-by: Tw <wei.tan@intel.com>

A patch file from https://github.com/void-linux/void-packages/pull/26673.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-igt-gpu_tools-26673.patch --]
[-- Type: text/x-diff, Size: 3271 bytes --]

From 74330ccf1cef8d7c204f1ffbfdff7b97bcc0a955 Mon Sep 17 00:00:00 2001
From: Tw <wei.tan@intel.com>
Date: Tue, 24 Nov 2020 15:13:16 +0800
Subject: [PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float

This patch fix segment fault because the ifunc
resolver resolve_half_to_float() tries to call unbound global function
igt_x86_features().

The upstream patch is https://patchwork.freedesktop.org/series/67150/

Fix issue #26671

Signed-off-by: Tw <wei.tan@intel.com>
---
 ...-loading-failure-in-resolve-function.patch | 63 +++++++++++++++++++
 srcpkgs/igt-gpu-tools/template                |  2 +-
 2 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch

diff --git a/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch
new file mode 100644
index 00000000000..40e3fb006cb
--- /dev/null
+++ b/srcpkgs/igt-gpu-tools/patches/i-g-t-Fix-global-symbol-loading-failure-in-resolve-function.patch
@@ -0,0 +1,63 @@
+diff --git lib/igt_halffloat.c lib/igt_halffloat.c
+index 08ab05fc..e5e8a5bd 100644
+--- lib/igt_halffloat.c
++++ lib/igt_halffloat.c
+@@ -24,6 +24,19 @@
+ 
+ #include <assert.h>
+ #include <math.h>
++#include <stdbool.h>
++
++#ifdef HAVE_CPUID_H
++#include <cpuid.h>
++#else
++#define __get_cpuid_max(x, y) 0
++#define __cpuid(level, a, b, c, d) a = b = c = d = 0
++#define __cpuid_count(level, count, a, b, c, d) a = b = c = d = 0
++#endif
++
++#ifndef bit_F16C
++#define bit_F16C	(1 << 29)
++#endif
+ 
+ #include "igt_halffloat.h"
+ #include "igt_x86.h"
+@@ -182,6 +195,20 @@ static void half_to_float_f16c(const uint16_t *h, float *f, unsigned int num)
+ 
+ #pragma GCC pop_options
+ 
++static bool f16c_is_supported(void)
++{
++	unsigned max = __get_cpuid_max(0, NULL);
++	unsigned eax, ebx, ecx, edx;
++
++	if (max >= 1) {
++		__cpuid(1, eax, ebx, ecx, edx);
++
++		if (ecx & bit_F16C)
++			return true;
++	}
++	return false;
++}
++
+ static void float_to_half(const float *f, uint16_t *h, unsigned int num)
+ {
+ 	for (int i = 0; i < num; i++)
+@@ -196,7 +223,7 @@ static void half_to_float(const uint16_t *h, float *f, unsigned int num)
+ 
+ static void (*resolve_float_to_half(void))(const float *f, uint16_t *h, unsigned int num)
+ {
+-	if (igt_x86_features() & F16C)
++	if (f16c_is_supported())
+ 		return float_to_half_f16c;
+ 
+ 	return float_to_half;
+@@ -207,7 +234,7 @@ void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)
+ 
+ static void (*resolve_half_to_float(void))(const uint16_t *h, float *f, unsigned int num)
+ {
+-	if (igt_x86_features() & F16C)
++	if (f16c_is_supported())
+ 		return half_to_float_f16c;
+ 
+ 	return half_to_float;
diff --git a/srcpkgs/igt-gpu-tools/template b/srcpkgs/igt-gpu-tools/template
index d118f888582..ddbbdce106c 100644
--- a/srcpkgs/igt-gpu-tools/template
+++ b/srcpkgs/igt-gpu-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'igt-gpu-tools'
 pkgname=igt-gpu-tools
 version=1.25
-revision=2
+revision=3
 build_style=meson
 configure_args="-Db_ndebug=false -Db_lto=false"
 # b_lto=true makes the build hang at a random point

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR REVIEW] igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
                   ` (2 preceding siblings ...)
  2020-11-25  2:03 ` [PR PATCH] [Updated] " tw4452852
@ 2020-11-25  2:04 ` tw4452852
  2020-11-25  2:04 ` tw4452852
  2020-11-25  4:08 ` [PR PATCH] [Merged]: " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: tw4452852 @ 2020-11-25  2:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

New review comment by tw4452852 on void-packages repository

https://github.com/void-linux/void-packages/pull/26673#discussion_r530060298

Comment:
Not yet, the upstream patch seems to haven't been merged into master. BTW, I attach the link about the patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR REVIEW] igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
                   ` (3 preceding siblings ...)
  2020-11-25  2:04 ` [PR REVIEW] " tw4452852
@ 2020-11-25  2:04 ` tw4452852
  2020-11-25  4:08 ` [PR PATCH] [Merged]: " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: tw4452852 @ 2020-11-25  2:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New review comment by tw4452852 on void-packages repository

https://github.com/void-linux/void-packages/pull/26673#discussion_r530060298

Comment:
Not yet, the upstream patch seems to haven't been merged into master. BTW, I attach the link about the patch in the commit message.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Merged]: igt-gpu-tools: fix segment fault on resolve_half_to_float
  2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
                   ` (4 preceding siblings ...)
  2020-11-25  2:04 ` tw4452852
@ 2020-11-25  4:08 ` ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2020-11-25  4:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

There's a merged pull request on the void-packages repository

igt-gpu-tools: fix segment fault on resolve_half_to_float
https://github.com/void-linux/void-packages/pull/26673

Description:
This patch fix segment fault because the ifunc
resolver resolve_half_to_float() tries to call unbound global function
igt_x86_features().

Fix issue #26671

Signed-off-by: Tw <wei.tan@intel.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-11-25  4:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24  7:32 [PR PATCH] igt-gpu-tools: fix segment fault on resolve_half_to_float tw4452852
2020-11-24 13:16 ` [PR REVIEW] " ericonr
2020-11-24 13:16 ` ericonr
2020-11-25  2:03 ` [PR PATCH] [Updated] " tw4452852
2020-11-25  2:04 ` [PR REVIEW] " tw4452852
2020-11-25  2:04 ` tw4452852
2020-11-25  4:08 ` [PR PATCH] [Merged]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).