All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] tools, build: Retry detection of bfd-related features
@ 2022-07-19 17:05 Roberto Sassu
  2022-07-19 17:05 ` [PATCH 2/4] bpftool: Complete libbfd feature detection Roberto Sassu
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Roberto Sassu @ 2022-07-19 17:05 UTC (permalink / raw)
  To: quentin, ast, daniel, andrii, martin.lau, song, john.fastabend,
	kpsingh, sdf, peterz, mingo, acme, terrelln, nathan,
	ndesaulniers
  Cc: bpf, linux-perf-users, llvm, linux-kernel, Roberto Sassu

While separate features have been defined to determine which linking flags
are required to use libbfd depending on the distribution (libbfd,
libbfd-liberty and libbfd-liberty-z), the same has not been done for other
features requiring linking to libbfd.

For example, disassembler-four-args requires linking to libbfd too, but it
should use the right linking flags. If not all the required ones are
specified, e.g. -liberty, detection will always fail even if the feature is
available.

Instead of creating new features, similarly to libbfd, simply retry
detection with the different set of flags until detection succeeds (or
fails, if the libraries are missing). In this way, feature detection is
transparent for the users of this building mechanism (e.g. perf), and those
users don't have for example to set an appropriate value for the
FEATURE_CHECK_LDFLAGS-disassembler-four-args variable.

The number of retries and features for which the retry mechanism is
implemented is low enough to make the increase in the complexity of
Makefile negligible.

Tested with perf and bpftool on Ubuntu 20.04.4 LTS, Fedora 36 and openSUSE
Tumbleweed.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 tools/build/feature/Makefile | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 7c2a17e23c30..063dab19148c 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -89,6 +89,8 @@ all: $(FILES)
 
 __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
   BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
+  BUILD_BFD = $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
+  BUILD_ALL = $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap
 
 __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
   BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
@@ -96,7 +98,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(
 ###############################
 
 $(OUTPUT)test-all.bin:
-	$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap
+	$(BUILD_ALL) || $(BUILD_ALL) -lopcodes -liberty
 
 $(OUTPUT)test-hello.bin:
 	$(BUILD)
@@ -240,13 +242,14 @@ $(OUTPUT)test-libpython.bin:
 	$(BUILD) $(FLAGS_PYTHON_EMBED)
 
 $(OUTPUT)test-libbfd.bin:
-	$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
+	$(BUILD_BFD)
 
 $(OUTPUT)test-libbfd-buildid.bin:
-	$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
+	$(BUILD_BFD) || $(BUILD_BFD) -liberty || $(BUILD_BFD) -liberty -lz
 
 $(OUTPUT)test-disassembler-four-args.bin:
-	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
+	$(BUILD_BFD) -lopcodes || $(BUILD_BFD) -lopcodes -liberty || \
+	$(BUILD_BFD) -lopcodes -liberty -lz
 
 $(OUTPUT)test-reallocarray.bin:
 	$(BUILD)
-- 
2.25.1


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

* [PATCH 2/4] bpftool: Complete libbfd feature detection
  2022-07-19 17:05 [PATCH 1/4] tools, build: Retry detection of bfd-related features Roberto Sassu
@ 2022-07-19 17:05 ` Roberto Sassu
  2022-07-20 20:07   ` Quentin Monnet
  2022-07-19 17:05 ` [PATCH 3/4] perf: Remove FEATURE_CHECK_LDFLAGS-disassembler-four-args Roberto Sassu
  2022-07-19 17:05 ` [PATCH 4/4] build: Switch to new openssl API for test-libcrypto Roberto Sassu
  2 siblings, 1 reply; 16+ messages in thread
From: Roberto Sassu @ 2022-07-19 17:05 UTC (permalink / raw)
  To: quentin, ast, daniel, andrii, martin.lau, song, john.fastabend,
	kpsingh, sdf, peterz, mingo, acme, terrelln, nathan,
	ndesaulniers
  Cc: bpf, linux-perf-users, llvm, linux-kernel, Roberto Sassu

Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
sets the linking flags depending on which flavor of the libbfd feature was
detected.

However, the flavors except libbfd cannot be detected, as they are not in
the feature list.

Complete the list of features to detect by adding libbfd-liberty and
libbfd-liberty-z.

Fixes: 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 tools/bpf/bpftool/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 6b5b3a99f79d..4b09a5c3b9f1 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -93,8 +93,10 @@ INSTALL ?= install
 RM ?= rm -f
 
 FEATURE_USER = .bpftool
-FEATURE_TESTS = libbfd disassembler-four-args libcap clang-bpf-co-re
-FEATURE_DISPLAY = libbfd disassembler-four-args libcap clang-bpf-co-re
+FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z \
+		disassembler-four-args libcap clang-bpf-co-re
+FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z \
+		  disassembler-four-args libcap clang-bpf-co-re
 
 check_feat := 1
 NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall
-- 
2.25.1


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

* [PATCH 3/4] perf: Remove FEATURE_CHECK_LDFLAGS-disassembler-four-args
  2022-07-19 17:05 [PATCH 1/4] tools, build: Retry detection of bfd-related features Roberto Sassu
  2022-07-19 17:05 ` [PATCH 2/4] bpftool: Complete libbfd feature detection Roberto Sassu
@ 2022-07-19 17:05 ` Roberto Sassu
  2022-07-19 17:05 ` [PATCH 4/4] build: Switch to new openssl API for test-libcrypto Roberto Sassu
  2 siblings, 0 replies; 16+ messages in thread
From: Roberto Sassu @ 2022-07-19 17:05 UTC (permalink / raw)
  To: quentin, ast, daniel, andrii, martin.lau, song, john.fastabend,
	kpsingh, sdf, peterz, mingo, acme, terrelln, nathan,
	ndesaulniers
  Cc: bpf, linux-perf-users, llvm, linux-kernel, Roberto Sassu

As the building mechanism is now able to retry detection with different
combinations of linking flags, setting
FEATURE_CHECK_LDFLAGS-disassembler-four-args is not necessary anymore, so
remove it.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 tools/perf/Makefile.config | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 73e0762092fe..6f8495544d19 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -297,8 +297,6 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
 
 FEATURE_CHECK_LDFLAGS-libaio = -lrt
 
-FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-
 CORE_CFLAGS += -fno-omit-frame-pointer
 CORE_CFLAGS += -ggdb3
 CORE_CFLAGS += -funwind-tables
@@ -328,8 +326,8 @@ ifneq ($(TCMALLOC),)
 endif
 
 ifeq ($(FEATURES_DUMP),)
-# We will display at the end of this Makefile.config, using $(call feature_display_entries)
-# As we may retry some feature detection here, see the disassembler-four-args case, for instance
+# We will display at the end of this Makefile.config, using $(call feature_display_entries),
+# as we may retry some feature detection here.
   FEATURE_DISPLAY_DEFERRED := 1
 include $(srctree)/tools/build/Makefile.feature
 else
@@ -904,11 +902,9 @@ ifndef NO_LIBBFD
 
     ifeq ($(feature-libbfd-liberty), 1)
       EXTLIBS += -lbfd -lopcodes -liberty
-      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
     else
       ifeq ($(feature-libbfd-liberty-z), 1)
         EXTLIBS += -lbfd -lopcodes -liberty -lz
-        FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
       endif
     endif
     $(call feature_check,disassembler-four-args)
@@ -1329,7 +1325,7 @@ endif
 
 # re-generate FEATURE-DUMP as we may have called feature_check, found out
 # extra libraries to add to LDFLAGS of some other test and then redo those
-# tests, see the block about libbfd, disassembler-four-args, for instance.
+# tests.
 $(shell rm -f $(FEATURE_DUMP_FILENAME))
 $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
 
-- 
2.25.1


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

* [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-07-19 17:05 [PATCH 1/4] tools, build: Retry detection of bfd-related features Roberto Sassu
  2022-07-19 17:05 ` [PATCH 2/4] bpftool: Complete libbfd feature detection Roberto Sassu
  2022-07-19 17:05 ` [PATCH 3/4] perf: Remove FEATURE_CHECK_LDFLAGS-disassembler-four-args Roberto Sassu
@ 2022-07-19 17:05 ` Roberto Sassu
  2022-08-08 16:14   ` Daniel Borkmann
  2 siblings, 1 reply; 16+ messages in thread
From: Roberto Sassu @ 2022-07-19 17:05 UTC (permalink / raw)
  To: quentin, ast, daniel, andrii, martin.lau, song, john.fastabend,
	kpsingh, sdf, peterz, mingo, acme, terrelln, nathan,
	ndesaulniers
  Cc: bpf, linux-perf-users, llvm, linux-kernel, Roberto Sassu

Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
error when it encounters the deprecated function MD5_Init() and the others.
The error would be interpreted as missing libcrypto, while in reality it is
not.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 tools/build/feature/test-libcrypto.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/build/feature/test-libcrypto.c b/tools/build/feature/test-libcrypto.c
index a98174e0569c..bc34a5bbb504 100644
--- a/tools/build/feature/test-libcrypto.c
+++ b/tools/build/feature/test-libcrypto.c
@@ -1,16 +1,23 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <openssl/evp.h>
 #include <openssl/sha.h>
 #include <openssl/md5.h>
 
 int main(void)
 {
-	MD5_CTX context;
+	EVP_MD_CTX *mdctx;
 	unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
 	unsigned char dat[] = "12345";
+	unsigned int digest_len;
 
-	MD5_Init(&context);
-	MD5_Update(&context, &dat[0], sizeof(dat));
-	MD5_Final(&md[0], &context);
+	mdctx = EVP_MD_CTX_new();
+	if (!mdctx)
+		return 0;
+
+	EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
+	EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
+	EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
+	EVP_MD_CTX_free(mdctx);
 
 	SHA1(&dat[0], sizeof(dat), &md[0]);
 
-- 
2.25.1


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

* Re: [PATCH 2/4] bpftool: Complete libbfd feature detection
  2022-07-19 17:05 ` [PATCH 2/4] bpftool: Complete libbfd feature detection Roberto Sassu
@ 2022-07-20 20:07   ` Quentin Monnet
  2022-07-20 22:37     ` Roberto Sassu
  0 siblings, 1 reply; 16+ messages in thread
From: Quentin Monnet @ 2022-07-20 20:07 UTC (permalink / raw)
  To: Roberto Sassu
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
	Stanislav Fomichev, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, terrelln, Nathan Chancellor,
	Nick Desaulniers, bpf, linux-perf-use.,
	llvm, open list

On Tue, 19 Jul 2022 at 18:06, Roberto Sassu <roberto.sassu@huawei.com> wrote:
>
> Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
> sets the linking flags depending on which flavor of the libbfd feature was
> detected.
>
> However, the flavors except libbfd cannot be detected, as they are not in
> the feature list.
>
> Complete the list of features to detect by adding libbfd-liberty and
> libbfd-liberty-z.
>
> Fixes: 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---
>  tools/bpf/bpftool/Makefile | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 6b5b3a99f79d..4b09a5c3b9f1 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -93,8 +93,10 @@ INSTALL ?= install
>  RM ?= rm -f
>
>  FEATURE_USER = .bpftool
> -FEATURE_TESTS = libbfd disassembler-four-args libcap clang-bpf-co-re
> -FEATURE_DISPLAY = libbfd disassembler-four-args libcap clang-bpf-co-re
> +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z \
> +               disassembler-four-args libcap clang-bpf-co-re
> +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z \
> +                 disassembler-four-args libcap clang-bpf-co-re

Do you know if there is a way to fold the different feature-libbfd-*
features into a single one for FEATURE_DISPLAY? Or should the various
features be all moved under feature-libbfd with multiple attempts,
like you did for disassembler-four-args in patch 1? My concern is that
users may think some features could be missing when they compile and
see that detection fails for some items.

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

* RE: [PATCH 2/4] bpftool: Complete libbfd feature detection
  2022-07-20 20:07   ` Quentin Monnet
@ 2022-07-20 22:37     ` Roberto Sassu
  0 siblings, 0 replies; 16+ messages in thread
From: Roberto Sassu @ 2022-07-20 22:37 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
	Stanislav Fomichev, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, terrelln, Nathan Chancellor,
	Nick Desaulniers, bpf, linux-perf-use.,
	llvm, open list

> From: Quentin Monnet [mailto:quentin@isovalent.com]
> Sent: Wednesday, July 20, 2022 10:08 PM
> On Tue, 19 Jul 2022 at 18:06, Roberto Sassu <roberto.sassu@huawei.com>
> wrote:
> >
> > Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
> > sets the linking flags depending on which flavor of the libbfd feature was
> > detected.
> >
> > However, the flavors except libbfd cannot be detected, as they are not in
> > the feature list.
> >
> > Complete the list of features to detect by adding libbfd-liberty and
> > libbfd-liberty-z.
> >
> > Fixes: 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
> > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > ---
> >  tools/bpf/bpftool/Makefile | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > index 6b5b3a99f79d..4b09a5c3b9f1 100644
> > --- a/tools/bpf/bpftool/Makefile
> > +++ b/tools/bpf/bpftool/Makefile
> > @@ -93,8 +93,10 @@ INSTALL ?= install
> >  RM ?= rm -f
> >
> >  FEATURE_USER = .bpftool
> > -FEATURE_TESTS = libbfd disassembler-four-args libcap clang-bpf-co-re
> > -FEATURE_DISPLAY = libbfd disassembler-four-args libcap clang-bpf-co-re
> > +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z \
> > +               disassembler-four-args libcap clang-bpf-co-re
> > +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z \
> > +                 disassembler-four-args libcap clang-bpf-co-re
> 
> Do you know if there is a way to fold the different feature-libbfd-*
> features into a single one for FEATURE_DISPLAY? Or should the various
> features be all moved under feature-libbfd with multiple attempts,
> like you did for disassembler-four-args in patch 1? My concern is that
> users may think some features could be missing when they compile and
> see that detection fails for some items.

I thought about retrying. Hovewer, bpftool Makefile uses the
different flavors to determine exactly which linking flags to use.
Transparent retrying means that this information is lost.

Also very interesting, Ubuntu uses feature-libbfd for the shared
library, feature-libbfd-liberty-z for the static one. 

Roberto

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-07-19 17:05 ` [PATCH 4/4] build: Switch to new openssl API for test-libcrypto Roberto Sassu
@ 2022-08-08 16:14   ` Daniel Borkmann
  2022-08-08 18:33     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Borkmann @ 2022-08-08 16:14 UTC (permalink / raw)
  To: Roberto Sassu, quentin, ast, andrii, martin.lau, song,
	john.fastabend, kpsingh, sdf, peterz, mingo, acme, terrelln,
	nathan, ndesaulniers
  Cc: bpf, linux-perf-users, llvm, linux-kernel

Hi Arnaldo,

On 7/19/22 7:05 PM, Roberto Sassu wrote:
> Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> error when it encounters the deprecated function MD5_Init() and the others.
> The error would be interpreted as missing libcrypto, while in reality it is
> not.
> 
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>

Given rest of the tooling fixes from Andres Freund went via perf tree and the
below is perf related as well, I presume you'll pick this up, too?

   [0] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core

>   tools/build/feature/test-libcrypto.c | 15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/build/feature/test-libcrypto.c b/tools/build/feature/test-libcrypto.c
> index a98174e0569c..bc34a5bbb504 100644
> --- a/tools/build/feature/test-libcrypto.c
> +++ b/tools/build/feature/test-libcrypto.c
> @@ -1,16 +1,23 @@
>   // SPDX-License-Identifier: GPL-2.0
> +#include <openssl/evp.h>
>   #include <openssl/sha.h>
>   #include <openssl/md5.h>
>   
>   int main(void)
>   {
> -	MD5_CTX context;
> +	EVP_MD_CTX *mdctx;
>   	unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
>   	unsigned char dat[] = "12345";
> +	unsigned int digest_len;
>   
> -	MD5_Init(&context);
> -	MD5_Update(&context, &dat[0], sizeof(dat));
> -	MD5_Final(&md[0], &context);
> +	mdctx = EVP_MD_CTX_new();
> +	if (!mdctx)
> +		return 0;
> +
> +	EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
> +	EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
> +	EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
> +	EVP_MD_CTX_free(mdctx);
>   
>   	SHA1(&dat[0], sizeof(dat), &md[0]);
>   
> 


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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-08 16:14   ` Daniel Borkmann
@ 2022-08-08 18:33     ` Arnaldo Carvalho de Melo
  2022-08-09 15:15       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-08 18:33 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Roberto Sassu, quentin, ast, andrii, martin.lau, song,
	john.fastabend, kpsingh, sdf, peterz, mingo, terrelln, nathan,
	ndesaulniers, bpf, linux-perf-users, llvm, linux-kernel

Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
> Hi Arnaldo,
> 
> On 7/19/22 7:05 PM, Roberto Sassu wrote:
> > Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> > error when it encounters the deprecated function MD5_Init() and the others.
> > The error would be interpreted as missing libcrypto, while in reality it is
> > not.
> > 
> > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> 
> Given rest of the tooling fixes from Andres Freund went via perf tree and the
> below is perf related as well, I presume you'll pick this up, too?

Sure.
 
>   [0] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
> 
> >   tools/build/feature/test-libcrypto.c | 15 +++++++++++----
> >   1 file changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/build/feature/test-libcrypto.c b/tools/build/feature/test-libcrypto.c
> > index a98174e0569c..bc34a5bbb504 100644
> > --- a/tools/build/feature/test-libcrypto.c
> > +++ b/tools/build/feature/test-libcrypto.c
> > @@ -1,16 +1,23 @@
> >   // SPDX-License-Identifier: GPL-2.0
> > +#include <openssl/evp.h>
> >   #include <openssl/sha.h>
> >   #include <openssl/md5.h>
> >   int main(void)
> >   {
> > -	MD5_CTX context;
> > +	EVP_MD_CTX *mdctx;
> >   	unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
> >   	unsigned char dat[] = "12345";
> > +	unsigned int digest_len;
> > -	MD5_Init(&context);
> > -	MD5_Update(&context, &dat[0], sizeof(dat));
> > -	MD5_Final(&md[0], &context);
> > +	mdctx = EVP_MD_CTX_new();
> > +	if (!mdctx)
> > +		return 0;
> > +
> > +	EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
> > +	EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
> > +	EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
> > +	EVP_MD_CTX_free(mdctx);
> >   	SHA1(&dat[0], sizeof(dat), &md[0]);
> > 

-- 

- Arnaldo

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-08 18:33     ` Arnaldo Carvalho de Melo
@ 2022-08-09 15:15       ` Arnaldo Carvalho de Melo
  2022-08-09 15:21         ` Arnaldo Carvalho de Melo
  2022-08-09 15:21         ` Quentin Monnet
  0 siblings, 2 replies; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-09 15:15 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Roberto Sassu, quentin, ast, andrii, martin.lau, song,
	john.fastabend, kpsingh, sdf, peterz, mingo, terrelln, nathan,
	ndesaulniers, bpf, linux-perf-users, llvm, linux-kernel,
	Andres Freund, Jiri Olsa

Em Mon, Aug 08, 2022 at 03:33:34PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
> > Hi Arnaldo,
> > 
> > On 7/19/22 7:05 PM, Roberto Sassu wrote:
> > > Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> > > error when it encounters the deprecated function MD5_Init() and the others.
> > > The error would be interpreted as missing libcrypto, while in reality it is
> > > not.
> > > 
> > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > 
> > Given rest of the tooling fixes from Andres Freund went via perf tree and the
> > below is perf related as well, I presume you'll pick this up, too?
> 
> Sure.
>  
> >   [0] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core

So I fixed up the first one, minor fuzzes, the second I had to fix
conflicts with the patchset from Andres, ended up as below, will test
build it then in my container kit.

- Arnaldo

commit bea955a0256e20cc18e87087e42f2a903b9a8b84
Author: Roberto Sassu <roberto.sassu@huawei.com>
Date:   Tue Jul 19 19:05:53 2022 +0200

    bpftool: Complete libbfd feature detection
    
    Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
    sets the linking flags depending on which flavor of the libbfd feature was
    detected.
    
    However, the flavors except libbfd cannot be detected, as they are not in
    the feature list.
    
    Complete the list of features to detect by adding libbfd-liberty and
    libbfd-liberty-z.
    
    Committer notes:
    
    Adjust conflict with with:
    
      1e1613f64cc8a09d ("tools bpftool: Don't display disassembler-four-args feature test")
      600b7b26c07a070d ("tools bpftool: Fix compilation error with new binutils")
    
    Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
    Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Andres Freund <andres@anarazel.de>
    Cc: Andrii Nakryiko <andrii@kernel.org>
    Cc: bpf@vger.kernel.org
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: John Fastabend <john.fastabend@gmail.com>
    Cc: KP Singh <kpsingh@kernel.org>
    Cc: llvm@lists.linux.dev
    Cc: Martin KaFai Lau <martin.lau@linux.dev>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Nick Terrell <terrelln@fb.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Quentin Monnet <quentin@isovalent.com>
    Cc: Song Liu <song@kernel.org>
    Cc: Stanislav Fomichev <sdf@google.com>
    Link: https://lore.kernel.org/r/20220719170555.2576993-2-roberto.sassu@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 04d733e98bffbc08..9cc132277150c534 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -93,9 +93,11 @@ INSTALL ?= install
 RM ?= rm -f
 
 FEATURE_USER = .bpftool
-FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled libcap \
+FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z
+	disassembler-four-args disassembler-init-styled libcap \
 	clang-bpf-co-re
-FEATURE_DISPLAY = libbfd libcap clang-bpf-co-re
+FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z
+	libcap clang-bpf-co-re
 
 check_feat := 1
 NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 15:15       ` Arnaldo Carvalho de Melo
@ 2022-08-09 15:21         ` Arnaldo Carvalho de Melo
  2022-08-09 15:28           ` Roberto Sassu
  2022-08-09 17:00           ` Andres Freund
  2022-08-09 15:21         ` Quentin Monnet
  1 sibling, 2 replies; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-09 15:21 UTC (permalink / raw)
  To: Roberto Sassu, Andres Freund, Daniel Borkmann
  Cc: quentin, ast, andrii, martin.lau, song, john.fastabend, kpsingh,
	sdf, peterz, mingo, terrelln, nathan, ndesaulniers, bpf,
	linux-perf-users, llvm, linux-kernel, Jiri Olsa

Em Tue, Aug 09, 2022 at 12:15:25PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 08, 2022 at 03:33:34PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
> > > Hi Arnaldo,
> > > 
> > > On 7/19/22 7:05 PM, Roberto Sassu wrote:
> > > > Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> > > > error when it encounters the deprecated function MD5_Init() and the others.
> > > > The error would be interpreted as missing libcrypto, while in reality it is
> > > > not.
> > > > 
> > > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > 
> > > Given rest of the tooling fixes from Andres Freund went via perf tree and the
> > > below is perf related as well, I presume you'll pick this up, too?
> > 
> > Sure.
> >  
> > >   [0] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
> 
> So I fixed up the first one, minor fuzzes, the second I had to fix
> conflicts with the patchset from Andres, ended up as below, will test
> build it then in my container kit.

So I backtracked, the way it works needs further consideration with
regard to the patchkit from Andres, that is already upstream, so it
would be good for Roberto to take a look at what is in torvalds/master
now and see if we have to removed that styled thing from Andres.

Andres, if you could take a look at Roberto's patchkit as well that
would be great.

- Arnaldo
 
> commit bea955a0256e20cc18e87087e42f2a903b9a8b84
> Author: Roberto Sassu <roberto.sassu@huawei.com>
> Date:   Tue Jul 19 19:05:53 2022 +0200
> 
>     bpftool: Complete libbfd feature detection
>     
>     Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
>     sets the linking flags depending on which flavor of the libbfd feature was
>     detected.
>     
>     However, the flavors except libbfd cannot be detected, as they are not in
>     the feature list.
>     
>     Complete the list of features to detect by adding libbfd-liberty and
>     libbfd-liberty-z.
>     
>     Committer notes:
>     
>     Adjust conflict with with:
>     
>       1e1613f64cc8a09d ("tools bpftool: Don't display disassembler-four-args feature test")
>       600b7b26c07a070d ("tools bpftool: Fix compilation error with new binutils")
>     
>     Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
>     Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
>     Cc: Alexei Starovoitov <ast@kernel.org>
>     Cc: Andres Freund <andres@anarazel.de>
>     Cc: Andrii Nakryiko <andrii@kernel.org>
>     Cc: bpf@vger.kernel.org
>     Cc: Daniel Borkmann <daniel@iogearbox.net>
>     Cc: Ingo Molnar <mingo@redhat.com>
>     Cc: John Fastabend <john.fastabend@gmail.com>
>     Cc: KP Singh <kpsingh@kernel.org>
>     Cc: llvm@lists.linux.dev
>     Cc: Martin KaFai Lau <martin.lau@linux.dev>
>     Cc: Nathan Chancellor <nathan@kernel.org>
>     Cc: Nick Desaulniers <ndesaulniers@google.com>
>     Cc: Nick Terrell <terrelln@fb.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Quentin Monnet <quentin@isovalent.com>
>     Cc: Song Liu <song@kernel.org>
>     Cc: Stanislav Fomichev <sdf@google.com>
>     Link: https://lore.kernel.org/r/20220719170555.2576993-2-roberto.sassu@huawei.com
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 04d733e98bffbc08..9cc132277150c534 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -93,9 +93,11 @@ INSTALL ?= install
>  RM ?= rm -f
>  
>  FEATURE_USER = .bpftool
> -FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled libcap \
> +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z
> +	disassembler-four-args disassembler-init-styled libcap \
>  	clang-bpf-co-re
> -FEATURE_DISPLAY = libbfd libcap clang-bpf-co-re
> +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z
> +	libcap clang-bpf-co-re
>  
>  check_feat := 1
>  NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall

-- 

- Arnaldo

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 15:15       ` Arnaldo Carvalho de Melo
  2022-08-09 15:21         ` Arnaldo Carvalho de Melo
@ 2022-08-09 15:21         ` Quentin Monnet
  1 sibling, 0 replies; 16+ messages in thread
From: Quentin Monnet @ 2022-08-09 15:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Daniel Borkmann
  Cc: Roberto Sassu, ast, andrii, martin.lau, song, john.fastabend,
	kpsingh, sdf, peterz, mingo, terrelln, nathan, ndesaulniers, bpf,
	linux-perf-users, llvm, linux-kernel, Andres Freund, Jiri Olsa

On 09/08/2022 16:15, Arnaldo Carvalho de Melo wrote:
> Em Mon, Aug 08, 2022 at 03:33:34PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
>>> Hi Arnaldo,
>>>
>>> On 7/19/22 7:05 PM, Roberto Sassu wrote:
>>>> Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
>>>> error when it encounters the deprecated function MD5_Init() and the others.
>>>> The error would be interpreted as missing libcrypto, while in reality it is
>>>> not.
>>>>
>>>> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
>>>
>>> Given rest of the tooling fixes from Andres Freund went via perf tree and the
>>> below is perf related as well, I presume you'll pick this up, too?
>>
>> Sure.
>>  
>>>   [0] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
> 
> So I fixed up the first one, minor fuzzes, the second I had to fix
> conflicts with the patchset from Andres, ended up as below, will test
> build it then in my container kit.
> 
> - Arnaldo
> 
> commit bea955a0256e20cc18e87087e42f2a903b9a8b84
> Author: Roberto Sassu <roberto.sassu@huawei.com>
> Date:   Tue Jul 19 19:05:53 2022 +0200
> 
>     bpftool: Complete libbfd feature detection
>     
>     Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
>     sets the linking flags depending on which flavor of the libbfd feature was
>     detected.
>     
>     However, the flavors except libbfd cannot be detected, as they are not in
>     the feature list.
>     
>     Complete the list of features to detect by adding libbfd-liberty and
>     libbfd-liberty-z.
>     
>     Committer notes:
>     
>     Adjust conflict with with:
>     
>       1e1613f64cc8a09d ("tools bpftool: Don't display disassembler-four-args feature test")
>       600b7b26c07a070d ("tools bpftool: Fix compilation error with new binutils")
>     
>     Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
>     Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
>     Cc: Alexei Starovoitov <ast@kernel.org>
>     Cc: Andres Freund <andres@anarazel.de>
>     Cc: Andrii Nakryiko <andrii@kernel.org>
>     Cc: bpf@vger.kernel.org
>     Cc: Daniel Borkmann <daniel@iogearbox.net>
>     Cc: Ingo Molnar <mingo@redhat.com>
>     Cc: John Fastabend <john.fastabend@gmail.com>
>     Cc: KP Singh <kpsingh@kernel.org>
>     Cc: llvm@lists.linux.dev
>     Cc: Martin KaFai Lau <martin.lau@linux.dev>
>     Cc: Nathan Chancellor <nathan@kernel.org>
>     Cc: Nick Desaulniers <ndesaulniers@google.com>
>     Cc: Nick Terrell <terrelln@fb.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Quentin Monnet <quentin@isovalent.com>
>     Cc: Song Liu <song@kernel.org>
>     Cc: Stanislav Fomichev <sdf@google.com>
>     Link: https://lore.kernel.org/r/20220719170555.2576993-2-roberto.sassu@huawei.com
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 04d733e98bffbc08..9cc132277150c534 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -93,9 +93,11 @@ INSTALL ?= install
>  RM ?= rm -f
>  
>  FEATURE_USER = .bpftool
> -FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled libcap \
> +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z
> +	disassembler-four-args disassembler-init-styled libcap \
>  	clang-bpf-co-re
> -FEATURE_DISPLAY = libbfd libcap clang-bpf-co-re
> +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z
> +	libcap clang-bpf-co-re
>  
>  check_feat := 1
>  NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall

The adjustment looks good, thanks Arnaldo!

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

* RE: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 15:21         ` Arnaldo Carvalho de Melo
@ 2022-08-09 15:28           ` Roberto Sassu
  2022-08-09 16:01             ` Roberto Sassu
  2022-08-09 17:00           ` Andres Freund
  1 sibling, 1 reply; 16+ messages in thread
From: Roberto Sassu @ 2022-08-09 15:28 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Andres Freund, Daniel Borkmann
  Cc: quentin, ast, andrii, martin.lau, song, john.fastabend, kpsingh,
	sdf, peterz, mingo, terrelln, nathan, ndesaulniers, bpf,
	linux-perf-users, llvm, linux-kernel, Jiri Olsa

> From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
> Sent: Tuesday, August 9, 2022 5:21 PM
> Em Tue, Aug 09, 2022 at 12:15:25PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Aug 08, 2022 at 03:33:34PM -0300, Arnaldo Carvalho de Melo
> escreveu:
> > > Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
> > > > Hi Arnaldo,
> > > >
> > > > On 7/19/22 7:05 PM, Roberto Sassu wrote:
> > > > > Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> > > > > error when it encounters the deprecated function MD5_Init() and the
> others.
> > > > > The error would be interpreted as missing libcrypto, while in reality it is
> > > > > not.
> > > > >
> > > > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > >
> > > > Given rest of the tooling fixes from Andres Freund went via perf tree and
> the
> > > > below is perf related as well, I presume you'll pick this up, too?
> > >
> > > Sure.
> > >
> > > >   [0]
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/cor
> e
> >
> > So I fixed up the first one, minor fuzzes, the second I had to fix
> > conflicts with the patchset from Andres, ended up as below, will test
> > build it then in my container kit.
> 
> So I backtracked, the way it works needs further consideration with
> regard to the patchkit from Andres, that is already upstream, so it
> would be good for Roberto to take a look at what is in torvalds/master
> now and see if we have to removed that styled thing from Andres.

Will do. Thanks Arnaldo for adapting the patch.

Roberto

> Andres, if you could take a look at Roberto's patchkit as well that
> would be great.
> 
> - Arnaldo
> 
> > commit bea955a0256e20cc18e87087e42f2a903b9a8b84
> > Author: Roberto Sassu <roberto.sassu@huawei.com>
> > Date:   Tue Jul 19 19:05:53 2022 +0200
> >
> >     bpftool: Complete libbfd feature detection
> >
> >     Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd variations")
> >     sets the linking flags depending on which flavor of the libbfd feature was
> >     detected.
> >
> >     However, the flavors except libbfd cannot be detected, as they are not in
> >     the feature list.
> >
> >     Complete the list of features to detect by adding libbfd-liberty and
> >     libbfd-liberty-z.
> >
> >     Committer notes:
> >
> >     Adjust conflict with with:
> >
> >       1e1613f64cc8a09d ("tools bpftool: Don't display disassembler-four-args
> feature test")
> >       600b7b26c07a070d ("tools bpftool: Fix compilation error with new
> binutils")
> >
> >     Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd variations")
> >     Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> >     Cc: Alexei Starovoitov <ast@kernel.org>
> >     Cc: Andres Freund <andres@anarazel.de>
> >     Cc: Andrii Nakryiko <andrii@kernel.org>
> >     Cc: bpf@vger.kernel.org
> >     Cc: Daniel Borkmann <daniel@iogearbox.net>
> >     Cc: Ingo Molnar <mingo@redhat.com>
> >     Cc: John Fastabend <john.fastabend@gmail.com>
> >     Cc: KP Singh <kpsingh@kernel.org>
> >     Cc: llvm@lists.linux.dev
> >     Cc: Martin KaFai Lau <martin.lau@linux.dev>
> >     Cc: Nathan Chancellor <nathan@kernel.org>
> >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> >     Cc: Nick Terrell <terrelln@fb.com>
> >     Cc: Peter Zijlstra <peterz@infradead.org>
> >     Cc: Quentin Monnet <quentin@isovalent.com>
> >     Cc: Song Liu <song@kernel.org>
> >     Cc: Stanislav Fomichev <sdf@google.com>
> >     Link: https://lore.kernel.org/r/20220719170555.2576993-2-
> roberto.sassu@huawei.com
> >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > index 04d733e98bffbc08..9cc132277150c534 100644
> > --- a/tools/bpf/bpftool/Makefile
> > +++ b/tools/bpf/bpftool/Makefile
> > @@ -93,9 +93,11 @@ INSTALL ?= install
> >  RM ?= rm -f
> >
> >  FEATURE_USER = .bpftool
> > -FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
> libcap \
> > +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z
> > +	disassembler-four-args disassembler-init-styled libcap \
> >  	clang-bpf-co-re
> > -FEATURE_DISPLAY = libbfd libcap clang-bpf-co-re
> > +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z
> > +	libcap clang-bpf-co-re
> >
> >  check_feat := 1
> >  NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-
> uninstall
> 
> --
> 
> - Arnaldo

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

* RE: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 15:28           ` Roberto Sassu
@ 2022-08-09 16:01             ` Roberto Sassu
  0 siblings, 0 replies; 16+ messages in thread
From: Roberto Sassu @ 2022-08-09 16:01 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: quentin, ast, andrii, martin.lau, song, john.fastabend, kpsingh,
	sdf, peterz, mingo, terrelln, nathan, ndesaulniers, bpf,
	linux-perf-users, llvm, linux-kernel, Jiri Olsa, Andres Freund,
	Daniel Borkmann

> From: Roberto Sassu [mailto:roberto.sassu@huawei.com]
> Sent: Tuesday, August 9, 2022 5:29 PM
> > From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
> > Sent: Tuesday, August 9, 2022 5:21 PM
> > Em Tue, Aug 09, 2022 at 12:15:25PM -0300, Arnaldo Carvalho de Melo
> escreveu:
> > > Em Mon, Aug 08, 2022 at 03:33:34PM -0300, Arnaldo Carvalho de Melo
> > escreveu:
> > > > Em Mon, Aug 08, 2022 at 06:14:48PM +0200, Daniel Borkmann escreveu:
> > > > > Hi Arnaldo,
> > > > >
> > > > > On 7/19/22 7:05 PM, Roberto Sassu wrote:
> > > > > > Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
> > > > > > error when it encounters the deprecated function MD5_Init() and the
> > others.
> > > > > > The error would be interpreted as missing libcrypto, while in reality it is
> > > > > > not.
> > > > > >
> > > > > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > > >
> > > > > Given rest of the tooling fixes from Andres Freund went via perf tree and
> > the
> > > > > below is perf related as well, I presume you'll pick this up, too?
> > > >
> > > > Sure.
> > > >
> > > > >   [0]
> >
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/cor
> > e
> > >
> > > So I fixed up the first one, minor fuzzes, the second I had to fix
> > > conflicts with the patchset from Andres, ended up as below, will test
> > > build it then in my container kit.

Did you push to a remote branch, so that I start from those?

Thanks

Roberto

> > So I backtracked, the way it works needs further consideration with
> > regard to the patchkit from Andres, that is already upstream, so it
> > would be good for Roberto to take a look at what is in torvalds/master
> > now and see if we have to removed that styled thing from Andres.
> 
> Will do. Thanks Arnaldo for adapting the patch.
> 
> Roberto
> 
> > Andres, if you could take a look at Roberto's patchkit as well that
> > would be great.
> >
> > - Arnaldo
> >
> > > commit bea955a0256e20cc18e87087e42f2a903b9a8b84
> > > Author: Roberto Sassu <roberto.sassu@huawei.com>
> > > Date:   Tue Jul 19 19:05:53 2022 +0200
> > >
> > >     bpftool: Complete libbfd feature detection
> > >
> > >     Commit 6e8ccb4f624a7 ("tools/bpf: properly account for libbfd
> variations")
> > >     sets the linking flags depending on which flavor of the libbfd feature was
> > >     detected.
> > >
> > >     However, the flavors except libbfd cannot be detected, as they are not in
> > >     the feature list.
> > >
> > >     Complete the list of features to detect by adding libbfd-liberty and
> > >     libbfd-liberty-z.
> > >
> > >     Committer notes:
> > >
> > >     Adjust conflict with with:
> > >
> > >       1e1613f64cc8a09d ("tools bpftool: Don't display disassembler-four-args
> > feature test")
> > >       600b7b26c07a070d ("tools bpftool: Fix compilation error with new
> > binutils")
> > >
> > >     Fixes: 6e8ccb4f624a73c5 ("tools/bpf: properly account for libbfd
> variations")
> > >     Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > >     Cc: Alexei Starovoitov <ast@kernel.org>
> > >     Cc: Andres Freund <andres@anarazel.de>
> > >     Cc: Andrii Nakryiko <andrii@kernel.org>
> > >     Cc: bpf@vger.kernel.org
> > >     Cc: Daniel Borkmann <daniel@iogearbox.net>
> > >     Cc: Ingo Molnar <mingo@redhat.com>
> > >     Cc: John Fastabend <john.fastabend@gmail.com>
> > >     Cc: KP Singh <kpsingh@kernel.org>
> > >     Cc: llvm@lists.linux.dev
> > >     Cc: Martin KaFai Lau <martin.lau@linux.dev>
> > >     Cc: Nathan Chancellor <nathan@kernel.org>
> > >     Cc: Nick Desaulniers <ndesaulniers@google.com>
> > >     Cc: Nick Terrell <terrelln@fb.com>
> > >     Cc: Peter Zijlstra <peterz@infradead.org>
> > >     Cc: Quentin Monnet <quentin@isovalent.com>
> > >     Cc: Song Liu <song@kernel.org>
> > >     Cc: Stanislav Fomichev <sdf@google.com>
> > >     Link: https://lore.kernel.org/r/20220719170555.2576993-2-
> > roberto.sassu@huawei.com
> > >     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > >
> > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > > index 04d733e98bffbc08..9cc132277150c534 100644
> > > --- a/tools/bpf/bpftool/Makefile
> > > +++ b/tools/bpf/bpftool/Makefile
> > > @@ -93,9 +93,11 @@ INSTALL ?= install
> > >  RM ?= rm -f
> > >
> > >  FEATURE_USER = .bpftool
> > > -FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
> > libcap \
> > > +FEATURE_TESTS = libbfd libbfd-liberty libbfd-liberty-z
> > > +	disassembler-four-args disassembler-init-styled libcap \
> > >  	clang-bpf-co-re
> > > -FEATURE_DISPLAY = libbfd libcap clang-bpf-co-re
> > > +FEATURE_DISPLAY = libbfd libbfd-liberty libbfd-liberty-z
> > > +	libcap clang-bpf-co-re
> > >
> > >  check_feat := 1
> > >  NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install
> doc-
> > uninstall
> >
> > --
> >
> > - Arnaldo

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 15:21         ` Arnaldo Carvalho de Melo
  2022-08-09 15:28           ` Roberto Sassu
@ 2022-08-09 17:00           ` Andres Freund
  2022-08-09 19:04             ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 16+ messages in thread
From: Andres Freund @ 2022-08-09 17:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Roberto Sassu, Daniel Borkmann, quentin, ast, andrii, martin.lau,
	song, john.fastabend, kpsingh, sdf, peterz, mingo, terrelln,
	nathan, ndesaulniers, bpf, linux-perf-users, llvm, linux-kernel,
	Jiri Olsa

Hi,

On 2022-08-09 12:21:15 -0300, Arnaldo Carvalho de Melo wrote:
> So I backtracked, the way it works needs further consideration with
> regard to the patchkit from Andres, that is already upstream, so it
> would be good for Roberto to take a look at what is in torvalds/master
> now and see if we have to removed that styled thing from Andres.

Why would it have to be removed - seems to be fairly independent, leaving the
line conflicts aside? Or do you just mean folding it into one-big-test? If so,
that'd make sense, although I'm not sure how ready the infrastructure


FWIW, if I would have to maintain these, I'd probably change FEATURE_TESTS,
FEATURE_DISPLAY into one-item-per-line to make conflicts less common and
easier to resolve.


> Andres, if you could take a look at Roberto's patchkit as well that
> would be great.

I briefly scanned it, and the only real comment I have mirror's Quentin's,
namely that it'd be nice to avoid displaying more tests that don't tell the
user much.

Greetings,

Andres Freund

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 17:00           ` Andres Freund
@ 2022-08-09 19:04             ` Arnaldo Carvalho de Melo
  2022-08-09 19:10               ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-09 19:04 UTC (permalink / raw)
  To: Andres Freund
  Cc: Roberto Sassu, Daniel Borkmann, quentin, ast, andrii, martin.lau,
	song, john.fastabend, kpsingh, sdf, peterz, mingo, terrelln,
	nathan, ndesaulniers, bpf, linux-perf-users, llvm, linux-kernel,
	Jiri Olsa

Em Tue, Aug 09, 2022 at 10:00:34AM -0700, Andres Freund escreveu:
> Hi,
> 
> On 2022-08-09 12:21:15 -0300, Arnaldo Carvalho de Melo wrote:
> > So I backtracked, the way it works needs further consideration with
> > regard to the patchkit from Andres, that is already upstream, so it
> > would be good for Roberto to take a look at what is in torvalds/master
> > now and see if we have to removed that styled thing from Andres.
> 
> Why would it have to be removed - seems to be fairly independent, leaving the
> line conflicts aside? Or do you just mean folding it into one-big-test? If so,
> that'd make sense, although I'm not sure how ready the infrastructure

So below is the 3rd patch in Roberto's patchkit adapted, I removed the
FEATURE_CHECK_LDFLAGS-disassembler-init-styled setting as we now
automatically try with multiple sets of libraries, as with
disassembler-four-args.

- Arnaldo

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 23648ea54e8d3d2c..0661a1cf98556ed3 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -297,9 +297,6 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
 
 FEATURE_CHECK_LDFLAGS-libaio = -lrt
 
-FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
-
 CORE_CFLAGS += -fno-omit-frame-pointer
 CORE_CFLAGS += -ggdb3
 CORE_CFLAGS += -funwind-tables
@@ -329,8 +326,8 @@ ifneq ($(TCMALLOC),)
 endif
 
 ifeq ($(FEATURES_DUMP),)
-# We will display at the end of this Makefile.config, using $(call feature_display_entries)
-# As we may retry some feature detection here, see the disassembler-four-args case, for instance
+# We will display at the end of this Makefile.config, using $(call feature_display_entries),
+# as we may retry some feature detection here.
   FEATURE_DISPLAY_DEFERRED := 1
 include $(srctree)/tools/build/Makefile.feature
 else
@@ -924,13 +921,9 @@ ifndef NO_LIBBFD
 
     ifeq ($(feature-libbfd-liberty), 1)
       EXTLIBS += -lbfd -lopcodes -liberty
-      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
     else
       ifeq ($(feature-libbfd-liberty-z), 1)
         EXTLIBS += -lbfd -lopcodes -liberty -lz
-        FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-        FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
       endif
     endif
     $(call feature_check,disassembler-four-args)
@@ -1356,7 +1349,7 @@ endif
 
 # re-generate FEATURE-DUMP as we may have called feature_check, found out
 # extra libraries to add to LDFLAGS of some other test and then redo those
-# tests, see the block about libbfd, disassembler-four-args, for instance.
+# tests.
 $(shell rm -f $(FEATURE_DUMP_FILENAME))
 $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
 
 
> 
> FWIW, if I would have to maintain these, I'd probably change FEATURE_TESTS,
> FEATURE_DISPLAY into one-item-per-line to make conflicts less common and
> easier to resolve.
> 
> 
> > Andres, if you could take a look at Roberto's patchkit as well that
> > would be great.
> 
> I briefly scanned it, and the only real comment I have mirror's Quentin's,
> namely that it'd be nice to avoid displaying more tests that don't tell the
> user much.
> 
> Greetings,
> 
> Andres Freund

-- 

- Arnaldo

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

* Re: [PATCH 4/4] build: Switch to new openssl API for test-libcrypto
  2022-08-09 19:04             ` Arnaldo Carvalho de Melo
@ 2022-08-09 19:10               ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-08-09 19:10 UTC (permalink / raw)
  To: Andres Freund
  Cc: Roberto Sassu, Daniel Borkmann, quentin, ast, andrii, martin.lau,
	song, john.fastabend, kpsingh, sdf, peterz, mingo, terrelln,
	nathan, ndesaulniers, bpf, linux-perf-users, llvm, linux-kernel,
	Jiri Olsa

Em Tue, Aug 09, 2022 at 04:04:46PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Aug 09, 2022 at 10:00:34AM -0700, Andres Freund escreveu:
> > Hi,
> > 
> > On 2022-08-09 12:21:15 -0300, Arnaldo Carvalho de Melo wrote:
> > > So I backtracked, the way it works needs further consideration with
> > > regard to the patchkit from Andres, that is already upstream, so it
> > > would be good for Roberto to take a look at what is in torvalds/master
> > > now and see if we have to removed that styled thing from Andres.
> > 
> > Why would it have to be removed - seems to be fairly independent, leaving the
> > line conflicts aside? Or do you just mean folding it into one-big-test? If so,
> > that'd make sense, although I'm not sure how ready the infrastructure
> 
> So below is the 3rd patch in Roberto's patchkit adapted, I removed the
> FEATURE_CHECK_LDFLAGS-disassembler-init-styled setting as we now
> automatically try with multiple sets of libraries, as with
> disassembler-four-args.

The following also had to be done:

⬢[acme@toolbox perf]$ git log --oneline -1
aa119945023c4ee7 (HEAD) tools, build: Retry detection of bfd-related features
⬢[acme@toolbox perf]$ git diff
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 928ebc355fb3f2d0..04b07ff8823487a0 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -253,7 +253,8 @@ $(OUTPUT)test-disassembler-four-args.bin:
        $(BUILD_BFD) -lopcodes -liberty -lz

 $(OUTPUT)test-disassembler-init-styled.bin:
-       $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
+       $(BUILD_BFD) -lopcodes || $(BUILD_BFD) -lopcodes -liberty || \
+       $(BUILD_BFD) -lopcodes -liberty -lz

 $(OUTPUT)test-reallocarray.bin:
        $(BUILD)
⬢[acme@toolbox perf]$
 
> - Arnaldo
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 23648ea54e8d3d2c..0661a1cf98556ed3 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -297,9 +297,6 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
>  
>  FEATURE_CHECK_LDFLAGS-libaio = -lrt
>  
> -FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
> -FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
> -
>  CORE_CFLAGS += -fno-omit-frame-pointer
>  CORE_CFLAGS += -ggdb3
>  CORE_CFLAGS += -funwind-tables
> @@ -329,8 +326,8 @@ ifneq ($(TCMALLOC),)
>  endif
>  
>  ifeq ($(FEATURES_DUMP),)
> -# We will display at the end of this Makefile.config, using $(call feature_display_entries)
> -# As we may retry some feature detection here, see the disassembler-four-args case, for instance
> +# We will display at the end of this Makefile.config, using $(call feature_display_entries),
> +# as we may retry some feature detection here.
>    FEATURE_DISPLAY_DEFERRED := 1
>  include $(srctree)/tools/build/Makefile.feature
>  else
> @@ -924,13 +921,9 @@ ifndef NO_LIBBFD
>  
>      ifeq ($(feature-libbfd-liberty), 1)
>        EXTLIBS += -lbfd -lopcodes -liberty
> -      FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
> -      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
>      else
>        ifeq ($(feature-libbfd-liberty-z), 1)
>          EXTLIBS += -lbfd -lopcodes -liberty -lz
> -        FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
> -        FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
>        endif
>      endif
>      $(call feature_check,disassembler-four-args)
> @@ -1356,7 +1349,7 @@ endif
>  
>  # re-generate FEATURE-DUMP as we may have called feature_check, found out
>  # extra libraries to add to LDFLAGS of some other test and then redo those
> -# tests, see the block about libbfd, disassembler-four-args, for instance.
> +# tests.
>  $(shell rm -f $(FEATURE_DUMP_FILENAME))
>  $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
>  
>  
> > 
> > FWIW, if I would have to maintain these, I'd probably change FEATURE_TESTS,
> > FEATURE_DISPLAY into one-item-per-line to make conflicts less common and
> > easier to resolve.
> > 
> > 
> > > Andres, if you could take a look at Roberto's patchkit as well that
> > > would be great.
> > 
> > I briefly scanned it, and the only real comment I have mirror's Quentin's,
> > namely that it'd be nice to avoid displaying more tests that don't tell the
> > user much.
> > 
> > Greetings,
> > 
> > Andres Freund
> 
> -- 
> 
> - Arnaldo

-- 

- Arnaldo

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

end of thread, other threads:[~2022-08-09 19:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 17:05 [PATCH 1/4] tools, build: Retry detection of bfd-related features Roberto Sassu
2022-07-19 17:05 ` [PATCH 2/4] bpftool: Complete libbfd feature detection Roberto Sassu
2022-07-20 20:07   ` Quentin Monnet
2022-07-20 22:37     ` Roberto Sassu
2022-07-19 17:05 ` [PATCH 3/4] perf: Remove FEATURE_CHECK_LDFLAGS-disassembler-four-args Roberto Sassu
2022-07-19 17:05 ` [PATCH 4/4] build: Switch to new openssl API for test-libcrypto Roberto Sassu
2022-08-08 16:14   ` Daniel Borkmann
2022-08-08 18:33     ` Arnaldo Carvalho de Melo
2022-08-09 15:15       ` Arnaldo Carvalho de Melo
2022-08-09 15:21         ` Arnaldo Carvalho de Melo
2022-08-09 15:28           ` Roberto Sassu
2022-08-09 16:01             ` Roberto Sassu
2022-08-09 17:00           ` Andres Freund
2022-08-09 19:04             ` Arnaldo Carvalho de Melo
2022-08-09 19:10               ` Arnaldo Carvalho de Melo
2022-08-09 15:21         ` Quentin Monnet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.