[packages/kernel-tools] - updated to 5.7[.0] - added bpf-hashmap patch (fix bpftool with size_t shorter than ULL)

qboosh qboosh at pld-linux.org
Sun Jun 21 15:43:28 CEST 2020


commit a02a39f3a8c500bcad6ae95cd9c3188f2ec9b73f
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jun 21 15:44:28 2020 +0200

    - updated to 5.7[.0]
    - added bpf-hashmap patch (fix bpftool with size_t shorter than ULL)

 kernel-tools-bpf-hashmap.patch | 24 ++++++++++++++++++++++++
 kernel-tools.spec              |  8 +++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/kernel-tools.spec b/kernel-tools.spec
index 5434d1b..8d8f951 100644
--- a/kernel-tools.spec
+++ b/kernel-tools.spec
@@ -19,8 +19,8 @@
 %undefine	with_multilib
 %endif
 
-%define		basever		5.6
-%define		postver		.5
+%define		basever		5.7
+%define		postver		.0
 Summary:	Assortment of tools for the Linux kernel
 Summary(pl.UTF-8):	Zestaw narzędzi dla jądra Linuksa
 Name:		kernel-tools
@@ -29,7 +29,7 @@ Release:	1
 License:	GPL v2
 Group:		Applications/System
 Source0:	https://www.kernel.org/pub/linux/kernel/v5.x/linux-%{basever}.tar.xz
-# Source0-md5:	7b9199ec5fa563ece9ed585ffb17798f
+# Source0-md5:	f63ed18935914e1ee3e04c2a0ce1ba3b
 Source1:	cpupower.service
 Source2:	cpupower.config
 %if "%{postver}" != ".0"
@@ -40,6 +40,7 @@ Patch1:		x32.patch
 Patch2:		regex.patch
 Patch3:		%{name}-perf-update.patch
 Patch4:		%{name}-perf-gtk2.patch
+Patch5:		%{name}-bpf-hashmap.patch
 URL:		https://www.kernel.org/
 BuildRequires:	bison
 BuildRequires:	docutils
@@ -404,6 +405,7 @@ cd linux-%{basever}
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %{__sed} -i -e '/^CFLAGS = /s/ -g / $(OPTFLAGS) /' tools/hv/Makefile
 %{__sed} -i -e '/^CFLAGS+=/s/ -O1 / $(OPTFLAGS) /' tools/thermal/tmon/Makefile
diff --git a/kernel-tools-bpf-hashmap.patch b/kernel-tools-bpf-hashmap.patch
new file mode 100644
index 0000000..e5300b1
--- /dev/null
+++ b/kernel-tools-bpf-hashmap.patch
@@ -0,0 +1,24 @@
+Fix broken hashmap implementation to ensure that hash_bits returns value fitting in
+given bits (for bits > 0): multiplier is long long, so shift bits must be based on
+long long, not __WORDSIZE.
+--- linux-5.7/tools/lib/bpf/hashmap.h.orig	2020-06-01 01:49:15.000000000 +0200
++++ linux-5.7/tools/lib/bpf/hashmap.h	2020-06-21 15:22:07.298466419 +0200
+@@ -10,17 +10,12 @@
+ 
+ #include <stdbool.h>
+ #include <stddef.h>
+-#ifdef __GLIBC__
+-#include <bits/wordsize.h>
+-#else
+-#include <bits/reg.h>
+-#endif
+ #include "libbpf_internal.h"
+ 
+ static inline size_t hash_bits(size_t h, int bits)
+ {
+ 	/* shuffle bits and return requested number of upper bits */
+-	return (h * 11400714819323198485llu) >> (__WORDSIZE - bits);
++	return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
+ }
+ 
+ typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel-tools.git/commitdiff/a02a39f3a8c500bcad6ae95cd9c3188f2ec9b73f



More information about the pld-cvs-commit mailing list