perf: Remove libcrypto dependency
v2 cover perf: Remove libcrypto dependency
This is a reworked version of
https://lore.kernel.org/all/[email protected]/.
I've changed it to add a new minimal SHA-1 implementation, instead of trying to pull in the kernel's SHA-1 implementation which is not really designed to be extracted into userspace programs. I also added a test.
Eric Biggers (2):
perf build: enable -fno-strict-aliasing
perf util: add a basic SHA-1 implementation
Yuzhuo Jing (2):
perf genelf: Remove libcrypto dependency and use built-in sha1()
tools: Remove libcrypto dependency
tools/build/Makefile.feature | 2 - tools/build/feature/Makefile | 4 - tools/build/feature/test-all.c | 5 -- tools/build/feature/test-libcrypto.c | 25 ------- tools/perf/Documentation/perf-check.txt | 1 - tools/perf/Makefile.config | 17 +---- tools/perf/Makefile.perf | 3 - tools/perf/builtin-check.c | 1 - tools/perf/tests/make | 4 +- tools/perf/tests/util.c | 45 +++++++++++- tools/perf/util/Build | 1 + tools/perf/util/genelf.c | 85 +--------------------- tools/perf/util/sha1.c | 97 +++++++++++++++++++++++++ tools/perf/util/sha1.h | 6 ++ 14 files changed, 156 insertions(+), 140 deletions(-) delete mode 100644 tools/build/feature/test-libcrypto.c create mode 100644 tools/perf/util/sha1.c create mode 100644 tools/perf/util/sha1.h
base-commit: 18531f4d1c8c47c4796289dbbc1ab657ffa063d2
Signature · 1 line
2.49.0
PATCH v2 1/4 perf build: enable -fno-strict-aliasing
From: Eric Biggers <[email protected]>
perf pulls in code from kernel headers that assumes it is being built with -fno-strict-aliasing, namely put_unaligned_*() from <linux/unaligned.h> which write the data using packed structs that lack the may_alias attribute. Enable -fno-strict-aliasing to prevent miscompilations in sha1.c which would otherwise occur due to this issue.
--- tools/perf/Makefile.config | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/Makefile.config +4 -0
@@ -17,10 +17,14 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +# This is required because the kernel is built with this and some of the code +# borrowed from kernel headers depends on it, e.g. put_unaligned_*(). +CFLAGS += -fno-strict-aliasing + # Enabled Wthread-safety analysis for clang builds. ifeq ($(CC_NO_CLANG), 0) CFLAGS += -Wthread-safety endif
Signature · 1 line
2.49.0
Ian Rogers
reviewerRe: [PATCH v2 1/4] perf build: enable -fno-strict-aliasing
Quoted 8 lines · Eric Biggers
From: Eric Biggers <[email protected]>
perf pulls in code from kernel headers that assumes it is being built with -fno-strict-aliasing, namely put_unaligned_*() from <
linux/unaligned.h> which write the data using packed structs that lack themay_aliasattribute. Enable -fno-strict-aliasing to prevent miscompilations insha1.cwhich would otherwise occur due to this issue.
Wow, good catch! I wonder if -fsanitize=type could be used to capture when perf's code is broken like this? Perhaps we should just remove linux/unaligned.h in tools because of this, the alternative of using memcpy doesn't look particularly burdensome. Given the memcpys are of a known/fixed size I'd expect the compiler to be able to optimize things just as well. Perhaps we should rewrite unaligned.h in tools but perhaps the kernel too. Something like:
#define __get_unaligned_t(type, ptr) ({
\
const struct { type x; } __packed * __get_pptr =
(typeof(__get_pptr))(ptr); \
__get_pptr->x;
\
})becomes:
#define __get_unaligned_t(type, ptr) ({
\
type __get_val; memcpy(&__get_val, ptr, sizeof(__get_val)); \
__get_val;
\
})Thanks,
Ian
Quoted 27 lines
Signed-off-by Eric Biggers <[email protected]>--- tools/perf/Makefile.config | 4 ++++ 1 file changed, 4 insertions(+)tools/perf/Makefile.config +4
-1@@ -17,10 +17,14 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +# This is required because the kernel is built with this and some of the code +# borrowed from kernel headers depends on it, e.g. put_unaligned_*(). +CFLAGS += -fno-strict-aliasing + # Enabled Wthread-safety analysis for clang builds. ifeq ($(CC_NO_CLANG), 0) CFLAGS += -Wthread-safety endif --2.49.0
Re: [PATCH v2 1/4] perf build: enable -fno-strict-aliasing
Quoted 26 lines · Ian Rogers
Quoted 8 lines · Eric Biggers
From: Eric Biggers <[email protected]>
perf pulls in code from kernel headers that assumes it is being built with -fno-strict-aliasing, namely put_unaligned_*() from <
linux/unaligned.h> which write the data using packed structs that lack themay_aliasattribute. Enable -fno-strict-aliasing to prevent miscompilations insha1.cwhich would otherwise occur due to this issue.Wow, good catch! I wonder if -fsanitize=type could be used to capture when perf's code is broken like this? Perhaps we should just remove
linux/unaligned.hin tools because of this, the alternative of using memcpy doesn't look particularly burdensome. Given the memcpys are of a known/fixed size I'd expect the compiler to be able to optimize things just as well. Perhaps we should rewriteunaligned.hin tools but perhaps the kernel too. Something like:#define
__get_unaligned_t(type, ptr)({
\
const struct { type x; }__packed*__get_pptr=(typeof(__get_pptr))(ptr); \ __get_pptr->x; \ })
Quoted 8 lines
becomes:
#define __get_unaligned_t(type, ptr) ({ \ type __get_val; memcpy(&__get_val, ptr, sizeof(__get_val)); \ __get_val; \ })
As far as I know, the packed struct method of doing unaligned memory accesses is obsolete these days, and memcpy() generates the desired code on all supported architectures and compilers.
- Eric
Ian Rogers
reviewerRe: [PATCH v2 1/4] perf build: enable -fno-strict-aliasing
Quoted 4 lines · Eric Biggers
As far as I know, the packed struct method of doing unaligned memory accesses is obsolete these days, and
memcpy()generates the desired code on all supported architectures and compilers.
Thanks Eric, I sent:
https://lore.kernel.org/lkml/[email protected]/
let's see how it goes.
Thanks,
Ian
PATCH v2 2/4 perf util: add a basic SHA-1 implementation
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
SHA-1 can be written in fewer than 100 lines of code. Just add a basic SHA-1 implementation so that there's no need to use an external library or try to pull in the kernel's SHA-1 implementation. The kernel's SHA-1 implementation is not really intended to be pulled into userspace programs in the way that it was proposed to do so for perf
(https://lore.kernel.org/r/[email protected]/),
and it's also likely to undergo some refactoring in the future. There's no need to tie userspace tools to it.
Include a test for sha1() in the util test suite.
--- tools/perf/tests/util.c | 45 ++++++++++++++++++- tools/perf/util/Build | 1 + tools/perf/util/sha1.c | 97 +++++++++++++++++++++++++++++++++++++++++ tools/perf/util/sha1.h | 6 +++ 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 tools/perf/util/sha1.c create mode 100644 tools/perf/util/sha1.h
tools/perf/tests/util.c +44 -1
@@ -1,8 +1,9 @@// SPDX-License-Identifier: GPL-2.0 #include "tests.h" #include "util/debug.h" +#include "util/sha1.h" #include <linux/compiler.h> #include <stdlib.h> #include <string2.h>
@@ -14,18 +15,60 @@ static int test_strreplace(char needle, const char *haystack,free (new);return ret ==0 ; } +#define MAX_LEN 512 + +/* Test sha1() for all lengths from 0 to MAX_LEN inclusively. */ +static int test_sha1 (void ) +{ +u8 data[MAX_LEN ]; +size_t digests_size = (MAX_LEN +1 ) *SHA1_DIGEST_SIZE ; +u8 *digests; +u8 digest_of_digests[SHA1_DIGEST_SIZE ]; +/* +* The correctness of this value was verified by running this test with +* sha1() replaced by OpenSSL's SHA1(). +*/ +static const u8 expected_digest_of_digests[SHA1_DIGEST_SIZE ] = { +0x74 ,0xcd ,0x4c ,0xb9 ,0xd8 ,0xa6 ,0xd5 ,0x95 ,0x22 ,0x8b , +0x7e ,0xd6 ,0x8b ,0x7e ,0x46 ,0x95 ,0x31 ,0x9b ,0xa2 ,0x43 , + }; +size_t i; + + digests =malloc (digests_size); +TEST_ASSERT_VAL ("failed to allocate digests" , digests !=NULL ); + +/* Generate MAX_LEN bytes of data. */ +for (i =0 ; i <MAX_LEN ; i++) + data[i] = i; + +/* Calculate a SHA-1 for each length 0 through MAX_LEN inclusively. */ +for (i =0 ; i <=MAX_LEN ; i++) +sha1 (data, i, &digests[i *SHA1_DIGEST_SIZE ]); + +/* Calculate digest of all digests calculated above. */ +sha1 (digests, digests_size, digest_of_digests); + +free (digests); + +/* Check for the expected result. */ +TEST_ASSERT_VAL ("wrong output from sha1()" , +memcmp (digest_of_digests, expected_digest_of_digests, +SHA1_DIGEST_SIZE ) ==0 ); +return 0 ; +} +static int test__util (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("empty string" ,test_strreplace (' ' ,"" ,"123" ,"" ));TEST_ASSERT_VAL ("no match" ,test_strreplace ('5' ,"123" ,"4" ,"123" ));TEST_ASSERT_VAL ("replace 1" ,test_strreplace ('3' ,"123" ,"4" ,"124" ));TEST_ASSERT_VAL ("replace 2" ,test_strreplace ('a' ,"abcabc" ,"ef" ,"efbcefbc" ));TEST_ASSERT_VAL ("replace long" ,test_strreplace ('a' ,"abcabc" ,"longlong" ,"longlongbclonglongbc" )); -return 0 ; +return test_sha1 (); }DEFINE_SUITE ("util" , util);
tools/perf/util/Build +1 -0
@@ -39,10 +39,11 @@ perf-util-y += rlimit.o perf-util-y += argv_split.o perf-util-y += rbtree.o perf-util-y += libstring.o perf-util-y += bitmap.o perf-util-y += hweight.o +perf-util-y += sha1.o perf-util-y += smt.o perf-util-y += strbuf.o perf-util-y += string.o perf-util-y += strlist.o perf-util-y += strfilter.o
tools/perf/util/sha1.c new file +97 -0
97 lines not on this page · raw message
tools/perf/util/sha1.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include <linux/types.h> + +#define SHA1_DIGEST_SIZE 20 + +void sha1 (const void *data,size_t len,u8 out[SHA1_DIGEST_SIZE ]);
Signature · 1 line
2.49.0
PATCH v2 3/4 perf genelf: Remove libcrypto dependency and use built-in sha1()
In reply to Eric BiggersFrom: Yuzhuo Jing <[email protected]>
genelf is the only file in perf that depends on libcrypto (or openssl) which only calculates a Build ID (SHA1, MD5, or URANDOM). SHA1 was expected to be the default option, but MD5 was used by default due to previous issues when linking against Java. This commit switches genelf to use the in-house sha1(), and also removes MD5 and URANDOM options since we have a reliable SHA1 implementation to rely on. It passes the tools/perf/tests/shell/test_java_symbol.sh test.
--- tools/perf/util/genelf.c | 85 ++-------------------------------------- 1 file changed, 3 insertions(+), 82 deletions(-)
tools/perf/util/genelf.c +3 -82
@@ -10,45 +10,25 @@#include <sys/types.h> #include <stddef.h> #include <libelf.h> #include <string.h> #include <stdlib.h> -#include <unistd.h> #include <inttypes.h> -#include <fcntl.h> #include <err.h> #ifdef HAVE_LIBDW_SUPPORT #include <dwarf.h> #endif #include "genelf.h" +#include "sha1.h" #include "../util/jitdump.h" #include <linux/compiler.h> #ifndef NT_GNU_BUILD_ID #define NT_GNU_BUILD_ID 3#endif -#define BUILD_ID_URANDOM /* different uuid for each run */ - -#ifdef HAVE_LIBCRYPTO_SUPPORT - -#define BUILD_ID_MD5 -#undef BUILD_ID_SHA/* does not seem to work well when linked with Java */ -#undef BUILD_ID_URANDOM/* different uuid for each run */ - -#ifdef BUILD_ID_SHA -#include <openssl/sha.h> -#endif - -#ifdef BUILD_ID_MD5 -#include <openssl/evp.h> -#include <openssl/md5.h> -#endif -#endif - - typedef struct { unsigned int namesz; /* Size of entry's owner string */ unsigned int descsz; /* Size of the note descriptor */ unsigned int type; /* Interpretation of the descriptor */ char name[0]; /* Start of the name+desc data */
@@ -69,11 +49,11 @@ static char shd_string_table[] = { };static struct buildid_note {Elf_Note desc;/* descsz: size of build-id, must be multiple of 4 */ char name[4 ];/* GNU\0 */ -char build_id[20 ]; +u8 build_id[SHA1_DIGEST_SIZE ]; } bnote;static Elf_Sym symtab[]={/* symbol 0 MUST be the undefined symbol */ { .st_name =0 ,/* index in sym_string table */
@@ -90,69 +70,10 @@ static Elf_Sym symtab[]={ .st_other = ELF_ST_VIS(STV_DEFAULT), .st_size = 0, /* for now */ } }; -#ifdef BUILD_ID_URANDOM -static void -gen_build_id (struct buildid_note *note, -unsigned long load_addr__maybe_unused , -const void *code__maybe_unused , -size_t csize__maybe_unused ) -{ -int fd; -size_t sz =sizeof (note->build_id); -ssize_t sret; - - fd =open ("/dev/urandom" ,O_RDONLY ); -if (fd ==-1 ) -err (1 ,"cannot access /dev/urandom for buildid" ); - - sret =read (fd, note->build_id, sz); - -close (fd); - -if (sret != (ssize_t )sz) -memset (note->build_id,0 , sz); -} -#endif - -#ifdef BUILD_ID_SHA -static void -gen_build_id (struct buildid_note *note, -unsigned long load_addr__maybe_unused , -const void *code, -size_t csize) -{ -if (sizeof (note->build_id) <SHA_DIGEST_LENGTH ) -errx (1 ,"build_id too small for SHA1" ); - -SHA1 (code, csize, (unsigned char *)note->build_id); -} -#endif - -#ifdef BUILD_ID_MD5 -static void -gen_build_id (struct buildid_note *note,unsigned long load_addr,const void *code,size_t csize) -{ -EVP_MD_CTX *mdctx; - -if (sizeof (note->build_id) <16 ) -errx (1 ,"build_id too small for MD5" ); - - mdctx =EVP_MD_CTX_new (); -if (!mdctx) -errx (2 ,"failed to create EVP_MD_CTX" ); - -EVP_DigestInit_ex (mdctx,EVP_md5 (),NULL ); -EVP_DigestUpdate (mdctx, &load_addr,sizeof (load_addr)); -EVP_DigestUpdate (mdctx, code, csize); -EVP_DigestFinal_ex (mdctx, (unsigned char *)note->build_id,NULL ); -EVP_MD_CTX_free (mdctx); -} -#endif -static int jit_add_eh_frame_info (Elf *e,void * unwinding,uint64_t unwinding_header_size,uint64_t unwinding_size,uint64_t base_offset) {Elf_Data *d;
@@ -471,11 +392,11 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym, }/* * build-id generation */ -gen_build_id (&bnote, load_addr, code, csize); +sha1 (code, csize, bnote.build_id); bnote.desc.namesz =sizeof (bnote.name);/* must include 0 termination */ bnote.desc.descsz =sizeof (bnote.build_id); bnote.desc.type =NT_GNU_BUILD_ID ;strcpy (bnote.name,"GNU" );
Signature · 1 line
2.49.0
PATCH v2 4/4 tools: Remove libcrypto dependency
In reply to Eric BiggersFrom: Yuzhuo Jing <[email protected]>
Remove all occurrence of libcrypto in the build system.
--- tools/build/Makefile.feature | 2 -- tools/build/feature/Makefile | 4 ---- tools/build/feature/test-all.c | 5 ----- tools/build/feature/test-libcrypto.c | 25 ------------------------- tools/perf/Documentation/perf-check.txt | 1 - tools/perf/Makefile.config | 13 ------------- tools/perf/Makefile.perf | 3 --- tools/perf/builtin-check.c | 1 - tools/perf/tests/make | 4 +--- 9 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 tools/build/feature/test-libcrypto.c
tools/build/Makefile.feature +0 -2
@@ -84,11 +84,10 @@ FEATURE_TESTS_BASIC := \ libpython \ libslang \ libtraceevent \ libtracefs \ libcpupower \ - libcrypto \ pthread-attr-setaffinity-np \ pthread-barrier \ reallocarray \ stackprotector-all \ timerfd \
@@ -150,11 +149,10 @@ FEATURE_DISPLAY ?= \ libelf \ libnuma \ numa_num_possible_cpus \ libperl \ libpython \ - libcrypto \ libcapstone \ llvm-perf \ zlib \ lzma \ get_cpuid \
tools/build/feature/Makefile +0 -4
@@ -36,11 +36,10 @@ FILES= \ test-libslang.bin \ test-libslang-include-subdir.bin \ test-libtraceevent.bin \ test-libcpupower.bin \ test-libtracefs.bin \ - test-libcrypto.bin \ test-libunwind.bin \ test-libunwind-debug-frame.bin \ test-libunwind-x86.bin \ test-libunwind-x86_64.bin \ test-libunwind-arm.bin \
@@ -244,13 +243,10 @@ $(OUTPUT)test-libcpupower.bin: $(BUILD) -lcpupower $(OUTPUT)test-libtracefs.bin: $(BUILD) $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) -ltracefs -$(OUTPUT)test-libcrypto.bin: - $(BUILD) -lcrypto - $(OUTPUT)test-gtk2.bin: $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations $(OUTPUT)test-gtk2-infobar.bin: $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
tools/build/feature/test-all.c +0 -5
@@ -136,14 +136,10 @@#define main main_test_bpf# include "test-bpf.c" #undef main -#define main main_test_libcrypto -# include "test-libcrypto.c" -#undef main -#define main main_test_sdt# include "test-sdt.c" #undef main#define main main_test_setns
@@ -204,11 +200,10 @@ int main(int argc, char *argv[])main_test_pthread_attr_setaffinity_np ();main_test_pthread_barrier ();main_test_lzma ();main_test_get_cpuid ();main_test_bpf (); -main_test_libcrypto ();main_test_scandirat ();main_test_sched_getcpu ();main_test_sdt ();main_test_setns ();main_test_libaio ();
tools/build/feature/test-libcrypto.c deleted +0 -25
@@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <openssl/evp.h> -#include <openssl/sha.h> -#include <openssl/md5.h> - -int main (void ) -{ -EVP_MD_CTX *mdctx; -unsigned char md[MD5_DIGEST_LENGTH +SHA_DIGEST_LENGTH ]; -unsigned char dat[] ="12345" ; -unsigned int digest_len; - - 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 ]); - -return 0 ; -}
tools/perf/Documentation/perf-check.txt +0 -1
@@ -51,11 +51,10 @@ feature:: dwarf_getlocations / HAVE_LIBDW_SUPPORT dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT auxtrace / HAVE_AUXTRACE_SUPPORT libbfd / HAVE_LIBBFD_SUPPORT libcapstone / HAVE_LIBCAPSTONE_SUPPORT - libcrypto / HAVE_LIBCRYPTO_SUPPORT libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT libelf / HAVE_LIBELF_SUPPORT libnuma / HAVE_LIBNUMA_SUPPORT libopencsd / HAVE_CSTRACE_SUPPORT libperl / HAVE_LIBPERL_SUPPORT
tools/perf/Makefile.config +0 -13
@@ -132,12 +132,10 @@ ifndef NO_LIBUNWIND FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64 FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86 FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64 endif -FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto - ifdef CSINCLUDES LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) endif OPENCSDLIBS := -lopencsd_c_api -lopencsd ifeq ($(findstring -static,${LDFLAGS}),-static)
@@ -774,21 +772,10 @@ endif ifneq ($(NO_LIBTRACEEVENT),1) $(call detected,CONFIG_TRACE) endif -ifndef NO_LIBCRYPTO - ifneq ($(feature-libcrypto), 1) - $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev) - NO_LIBCRYPTO := 1 - else - CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT - EXTLIBS += -lcrypto - $(call detected,CONFIG_CRYPTO) - endif -endif - ifndef NO_SLANG ifneq ($(feature-libslang), 1) ifneq ($(feature-libslang-include-subdir), 1) $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev) NO_SLANG := 1
tools/perf/Makefile.perf +0 -3
@@ -59,13 +59,10 @@ include ../scripts/utilities.mak # # Define NO_LIBNUMA if you do not want numa perf benchmark # # Define NO_LIBBIONIC if you do not want bionic support # -# Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support -# used for generating build-ids for ELFs generated by jitdump. -# # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support # for dwarf backtrace post unwind. # # Define NO_LIBTRACEEVENT=1 if you don't want libtraceevent to be linked, # this will remove multiple features and tools, such as 'perf trace',
tools/perf/builtin-check.c +0 -1
@@ -42,11 +42,10 @@ struct feature_status supported_features[] = {FEATURE_STATUS ("dwarf_getlocations" ,HAVE_LIBDW_SUPPORT ),FEATURE_STATUS ("dwarf-unwind" ,HAVE_DWARF_UNWIND_SUPPORT ),FEATURE_STATUS ("auxtrace" ,HAVE_AUXTRACE_SUPPORT ),FEATURE_STATUS_TIP ("libbfd" ,HAVE_LIBBFD_SUPPORT ,"Deprecated, license incompatibility, use BUILD_NONDISTRO=1 and install binutils-dev[el]" ),FEATURE_STATUS ("libcapstone" ,HAVE_LIBCAPSTONE_SUPPORT ), -FEATURE_STATUS ("libcrypto" ,HAVE_LIBCRYPTO_SUPPORT ),FEATURE_STATUS ("libdw-dwarf-unwind" ,HAVE_LIBDW_SUPPORT ),FEATURE_STATUS ("libelf" ,HAVE_LIBELF_SUPPORT ),FEATURE_STATUS ("libnuma" ,HAVE_LIBNUMA_SUPPORT ),FEATURE_STATUS ("libopencsd" ,HAVE_CSTRACE_SUPPORT ), FEATURE_STATUS("libperl", HAVE_LIBPERL_SUPPORT),
tools/perf/tests/make +1 -3
@@ -89,11 +89,10 @@ make_no_libnuma := NO_LIBNUMA=1 make_no_libbionic := NO_LIBBIONIC=1 make_no_auxtrace := NO_AUXTRACE=1 make_no_libbpf := NO_LIBBPF=1 make_libbpf_dynamic := LIBBPF_DYNAMIC=1 make_no_libbpf_DEBUG := NO_LIBBPF=1 DEBUG=1 -make_no_libcrypto := NO_LIBCRYPTO=1 make_no_libllvm := NO_LIBLLVM=1 make_with_babeltrace:= LIBBABELTRACE=1 make_with_coresight := CORESIGHT=1 make_no_sdt := NO_SDT=1 make_no_libpfm4 := NO_LIBPFM4=1
@@ -120,11 +119,11 @@ make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX3 # all the NO_* variable combined make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_GTK2=1 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_BACKTRACE=1 make_minimal += NO_LIBNUMA=1 NO_LIBBIONIC=1 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 -make_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 +make_minimal += NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 make_minimal += NO_LIBCAP=1 NO_CAPSTONE=1 # $(run) contains all available tests run := make_pure # Targets 'clean all' can be run together only through top level
@@ -158,11 +157,10 @@ run += make_no_libcapstone run += make_no_libnuma run += make_no_libbionic run += make_no_auxtrace run += make_no_libbpf run += make_no_libbpf_DEBUG -run += make_no_libcrypto run += make_no_libllvm run += make_no_sdt run += make_no_syscall_tbl run += make_with_babeltrace run += make_with_coresight
Signature · 1 line
2.49.0
Namhyung Kim
maintainerHello,
Quoted 6 lines · Eric Biggers
This is a reworked version of
https://lore.kernel.org/all/[email protected]/.
I've changed it to add a new minimal SHA-1 implementation, instead of trying to pull in the kernel's SHA-1 implementation which is not really designed to be extracted into userspace programs. I also added a test.
Quoted 7 lines
Eric Biggers (2):
perf build: enable -fno-strict-aliasing
perf util: add a basic SHA-1 implementationYuzhuo Jing (2):
perf genelf: Remove libcrypto dependency and use built-insha1()
tools: Remove libcrypto dependency
Thanks for working on this. But can you please rebase it on to the latest perf-tools-next tree/branch? It doesn't apply cleanly.
Thanks,
Namhyung
Quoted 25 lines
tools/build/Makefile.feature | 2 - tools/build/feature/Makefile | 4 - tools/build/feature/test-all.c | 5 -- tools/build/feature/test-libcrypto.c | 25 ------- tools/perf/Documentation/perf-check.txt | 1 - tools/perf/Makefile.config | 17 +---- tools/perf/Makefile.perf | 3 - tools/perf/builtin-check.c | 1 - tools/perf/tests/make | 4 +- tools/perf/tests/util.c | 45 +++++++++++- tools/perf/util/Build | 1 + tools/perf/util/genelf.c | 85 +--------------------- tools/perf/util/sha1.c | 97 +++++++++++++++++++++++++ tools/perf/util/sha1.h | 6 ++ 14 files changed, 156 insertions(+), 140 deletions(-) delete mode 100644 tools/build/feature/test-libcrypto.c create mode 100644 tools/perf/util/sha1.c create mode 100644 tools/perf/util/sha1.hbase-commit:
18531f4d1c8c47c4796289dbbc1ab657ffa063d2Signature · 1 line
2.49.0
Quoted 17 lines · Namhyung Kim
Hello,
Quoted 6 lines · Eric Biggers
This is a reworked version of
https://lore.kernel.org/all/[email protected]/.
I've changed it to add a new minimal SHA-1 implementation, instead of trying to pull in the kernel's SHA-1 implementation which is not really designed to be extracted into userspace programs. I also added a test.Quoted 7 lines
Eric Biggers (2):
perf build: enable -fno-strict-aliasing
perf util: add a basic SHA-1 implementationYuzhuo Jing (2):
perf genelf: Remove libcrypto dependency and use built-insha1()
tools: Remove libcrypto dependency
Quoted 6 lines
Thanks for working on this. But can you please rebase it on to the latest perf-tools-next tree/branch? It doesn't apply cleanly.
Thanks,
Namhyung
Done: https://lore.kernel.org/all/[email protected]/
- Eric