Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2672753imn; Tue, 2 Aug 2022 11:35:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR5S3qzSgXj684wbao6NLwN6PfYS+c7KNAc8StZiUbKD28rO3b5biFh7huxptZdS9ImdHDiZ X-Received: by 2002:a05:6402:3485:b0:43d:7fe0:74d1 with SMTP id v5-20020a056402348500b0043d7fe074d1mr13641265edc.413.1659465316444; Tue, 02 Aug 2022 11:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659465316; cv=none; d=google.com; s=arc-20160816; b=MqKXDegu94LZozsefGy/bhMG0XClyHyV1CdOD928u1KdRL3c8ENpapSBzn39xGifH1 fNfYzkFWxMoiI7b9pxbvfm5Qe2DHw224eE8ow2Gt1aT/Ad5YN1tVQdiW82hl4pK40Ko7 rBXq9LoBYlWf3gIsV/64Inu1/D7A3QbRmyZAOh0PaBMYHhWTL0YXsc63fwxPuLVKDzUz 9GJjPksqPiz6nvj77oQ77FaRs3NFEyBwqASnCvbBDNqU3ksnVFfn3Q7eHnE3kw8aLu5x EtlQ7sw0SpXEmSTGvxzCdNTGTRzLfm+6shXa9xAmwKTxCXsPr78lza3af1+01mwf9ICQ Rcdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hCKq08wS9LKGPPdUGpfwyeg68jheWrM+1KPceqyhEvU=; b=Q7qBv7XgQ3P/RnOBi3ZZVcQu9pQtGalc+YkrPMtFRJn6P6L+Tq1qZZeXeGZY2Q1Luy pO7MqvI5BdSOBEklbhLxrmDe1GB1LFmutHKrVAcHbznG5l6skO+yrUpT8S+VPbJIrnCQ T2b2rMG3B/vnjLbqyzY5qbae2HZuDvSzce6tInAebIT2CVDVgi9hkpIjUMDVQ1z2R+qO uReN1B9F+kqr8HFn4soipKrayVHtR8So4y0A8HbuI6PEFVxGNdOajRHJZKbjCqg1rolW 3xpLuLmVazos5s0e0ErJTxA2riT3+lZlUHwvj/zYJko81sHtpZBOboqbl9MJ/NluePcv I+Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KkZKasLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd6-20020a1709069b8600b007307ca55581si7112960ejc.47.2022.08.02.11.34.51; Tue, 02 Aug 2022 11:35:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KkZKasLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230412AbiHBSN1 (ORCPT + 99 others); Tue, 2 Aug 2022 14:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbiHBSNY (ORCPT ); Tue, 2 Aug 2022 14:13:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3551817E1C; Tue, 2 Aug 2022 11:13:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9C42B81EF4; Tue, 2 Aug 2022 18:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37F43C433D6; Tue, 2 Aug 2022 18:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659464000; bh=nQJbrO57DyZP6Khfo1y4+FRa0/uoV/1hWZd8ykEAbQQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KkZKasLRcXY0UBRLQpQCt2HQeH+bQJ1EurBm17qTjnGcjMFX7FlDsFYfMlc//PNrs rFG7UFwDqSKio7gMApA2khxLmHdsWrmSFmlu/5J5VQo2p+fG51lXBQcABrf/owkFq0 hnQ+djSIN+1DE05gj0AQAbawTkbxQJTcOUnoQysbS91lTcj/8M6sf/UKwuVpVES1jb N7iQn+MIzbkQyn59h47K0cGQLhExl2cifL9HAklbI6QScYHfNwzRldQq9iXSamtxvB 8btn6IUoD0XLlzco8f2s9dLVHg32tpNXRFgTuCCx6tcNHzqZTB2zWIp/y1CZGzHhqY WIOFYjDeMbbcQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 1B8CE40736; Tue, 2 Aug 2022 15:13:18 -0300 (-03) Date: Tue, 2 Aug 2022 15:13:18 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Stephane Eranian , =?utf-8?B?6LCt5qKT54WK?= , Zixuan Tan , terrelln@fb.com, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH] perf build: Suppress openssl v3 deprecation warnings in libcrypto feature test Message-ID: References: <20220625153439.513559-1-tanzixuan.me@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Aug 02, 2022 at 03:09:05PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Mon, Aug 01, 2022 at 03:24:18PM +0200, Jiri Olsa escreveu: > > On Tue, Jun 28, 2022 at 08:16:06AM +0200, Jiri Olsa wrote: > > > On Mon, Jun 27, 2022 at 11:08:34AM +0800, 谭梓煊 wrote: > > > > On Sun, Jun 26, 2022 at 10:45 PM Jiri Olsa wrote: > > > > > > > > > > On Sat, Jun 25, 2022 at 11:34:38PM +0800, Zixuan Tan wrote: > > > > > > With OpenSSL v3 installed, the libcrypto feature check fails as it use the > > > > > > deprecated MD5_* API (and is compiled with -Werror). The error message is > > > > > > as follows. > > > > > > > > > > > > $ make tools/perf > > > > > > ``` > > > > > > Makefile.config:778: No libcrypto.h found, disables jitted code injection, > > > > > > please install openssl-devel or libssl-dev > > > > > > > > > > > > Auto-detecting system features: > > > > > > ... dwarf: [ on ] > > > > > > ... dwarf_getlocations: [ on ] > > > > > > ... glibc: [ on ] > > > > > > ... libbfd: [ on ] > > > > > > ... libbfd-buildid: [ on ] > > > > > > ... libcap: [ on ] > > > > > > ... libelf: [ on ] > > > > > > ... libnuma: [ on ] > > > > > > ... numa_num_possible_cpus: [ on ] > > > > > > ... libperl: [ on ] > > > > > > ... libpython: [ on ] > > > > > > ... libcrypto: [ OFF ] > > > > > > ... libunwind: [ on ] > > > > > > ... libdw-dwarf-unwind: [ on ] > > > > > > ... zlib: [ on ] > > > > > > ... lzma: [ on ] > > > > > > ... get_cpuid: [ on ] > > > > > > ... bpf: [ on ] > > > > > > ... libaio: [ on ] > > > > > > ... libzstd: [ on ] > > > > > > ... disassembler-four-args: [ on ] > > > > > > ``` > > > > > > > > > > > > This is very confusing because the suggested library (on my Ubuntu 20.04 > > > > > > it is libssl-dev) is already installed. As the test only checks for the > > > > > > presence of libcrypto, this commit suppresses the deprecation warning to > > > > > > allow the test to pass. > > > > > > > > > > > > Signed-off-by: Zixuan Tan > > > > > > --- > > > > > > tools/build/feature/test-libcrypto.c | 6 ++++++ > > > > > > 1 file changed, 6 insertions(+) > > > > > > > > > > > > diff --git a/tools/build/feature/test-libcrypto.c b/tools/build/feature/test-libcrypto.c > > > > > > index a98174e0569c..31afff093d0b 100644 > > > > > > --- a/tools/build/feature/test-libcrypto.c > > > > > > +++ b/tools/build/feature/test-libcrypto.c > > > > > > @@ -2,6 +2,12 @@ > > > > > > #include > > > > > > #include > > > > > > > > > > > > +/* > > > > > > + * The MD5_* API have been deprecated since OpenSSL 3.0, which causes the > > > > > > + * feature test to fail silently. This is a workaround. > > > > > > + */ > > > > > > > > > > then we use these deprecated MD5 calls in util/genelf.c if libcrypto is detected, > > > > > so I wonder how come the rest of the compilation passed for you.. do you have > > > > > CONFIG_JITDUMP disabled? > > > > > > > > > No, CONFIG_JITDUMP is not disabled. I am using the default configuration. > > > > > > > > Yes, you are right. The rest of the compilation should fail, but it doesn't. > > > > I checked the verbose build commands. This seems to be the result of another > > > > inconsistency. > > > > > > > > If libcrypto is detected, the macro "HAVE_LIBCRYPTO_SUPPORT" will be > > > > defined, but in perf/util/genelf.c, "HAVE_LIBCRYPTO" without the "_SUPPORT" > > > > prefix is checked. This causes urandom always be used to create build id > > > > rather than MD5 and SHA1, no matter what the detection result is. > > > > > > > > In perf/Makefile.config, from line 776 > > > > ``` > > > > ifndef NO_LIBCRYPTO > > > > ifneq ($(feature-libcrypto), 1) > > > > msg := $(warning No libcrypto.h found, disables jitted code injection, > > > > please install openssl-devel or libssl-dev); > > > > NO_LIBCRYPTO := 1 > > > > else <-- if libcrypto feature detected > > > > CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT <-- define this > > > > EXTLIBS += -lcrypto > > > > $(call detected,CONFIG_CRYPTO) > > > > endif > > > > endif > > > > ``` > > > > > > > > In perf/util/genelf.c, from line 33 > > > > ``` > > > > #ifdef HAVE_LIBCRYPTO <-- but check this, it's always false > > > > > > nice :) > > > > > > > > > > > #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 > > > > #endif > > > > > > > > #ifdef BUILD_ID_MD5 > > > > #include > > > > #endif > > > > #endif <-- this block will be skipped > > > > ``` > > > > > > > > Maybe we should fix this, to really make use of libcrypto if it is available? > > > > > > yea, I think that was the original idea, let's keep the variable with > > > SUPPORT suffix and use the -Wdeprecated-declarations for genelf.c > > > > > > full fix would be to detect the new API and use it when it's available but.. > > > given that the check was false at least since 2016, perhaps we could remove > > > that code? ;-) Stephane? > > > > ping > > So, we should start with 谭梓煊 patch, then fix that ifdef and go on > from there? I.e. with this: diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index aed49806a09bab8f..953338b9e887e26f 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -30,7 +30,11 @@ #define BUILD_ID_URANDOM /* different uuid for each run */ -#ifdef HAVE_LIBCRYPTO +// FIXME, remove this and fix the deprecation warnings before its removed and +// We'll break for good here... +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#ifdef HAVE_LIBCRYPTO_SUPPORT #define BUILD_ID_MD5 #undef BUILD_ID_SHA /* does not seem to work well when linked with Java */