From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 941673857825 for ; Sat, 21 May 2022 08:31:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 941673857825 Received: by mail-ej1-x629.google.com with SMTP id wh22so19236398ejb.7 for ; Sat, 21 May 2022 01:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=29unxI3oUUwlkc4LzklbDMr46bI8OewnXSGgxC+Uqt4=; b=1kHy4SsCAkBwxtsJowmnb8jyzQGfldfg9s7EiHkXQ3mQiRkMDil0TbBZ33NH90+TMM uGtEImqw1pphVMeDZKifPcsTDu7qAHMb9dGifWQFx1qRMmm3WATmrjbWyHwW9FbE1cUG N43cROtx/Vc0K1uLgiIbuHVOPuRbaxMXF818eq2xV9GEfTaxEuStVvx8ff5V0m3nXDmz sDQVqb15ifiUBd9WeNVP6Amml8vEvi1fxurwWk/RQja14vqOle1UdAhGrzz2ISQNXJ/z //72OGr26Vx4vDRjyQzWuAunQazV6wmN3gRjLMaaP0aoGDC/90UiIbrpqrjdKuiiN1UY 7NUg== X-Gm-Message-State: AOAM532J4vnWe8HMZANPNyd/2mtc22AQfiGFJXtPJ1awc8q4W3/kuDOw GNleJRDedtQfxXBkiU7Sui6k3g6mvhQ= X-Google-Smtp-Source: ABdhPJzYECYxIikD3lXqUsu0XN4Gu2IcGjkjTaa9paFGNZNZ/l9PwQwJVtuooRZjT6woTYvh7xUjtw== X-Received: by 2002:a17:906:7954:b0:6f3:c1c8:f814 with SMTP id l20-20020a170906795400b006f3c1c8f814mr12319968ejo.230.1653121859241; Sat, 21 May 2022 01:30:59 -0700 (PDT) Received: from nz (host81-147-8-147.range81-147.btcentralplus.com. [81.147.8.147]) by smtp.gmail.com with ESMTPSA id jo14-20020a170906f6ce00b006feb5cae5f0sm1216219ejb.132.2022.05.21.01.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 01:30:58 -0700 (PDT) Date: Sat, 21 May 2022 09:30:57 +0100 From: Sergei Trofimovich To: Vladimir Mezentsev via Binutils Subject: Re: [PATCH V3] gprofng: a new GNU profiler Message-ID: <20220521093050.515a5ca5@nz> In-Reply-To: <52ead579-44ab-4d05-67d6-4a09f7a1693d@oracle.com> References: <047143ae-be5e-9eec-237f-ad9ffe3795c0@oracle.com> <52ead579-44ab-4d05-67d6-4a09f7a1693d@oracle.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2022 08:31:04 -0000 On Wed, 1 Sep 2021 11:45:01 -0700 Vladimir Mezentsev via Binutils wrote: > Hi people! >=20 >=20 > 09/01/2021: Changes from V2 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >=20 > =C2=A0 - Renamed experiment.h to gp-experiment.h (Hannes Domani reported= =20 > problem on Windows). > =C2=A0 - Fixed regression in build on ARM. > =C2=A0 - Improved gprofng/testsuite. >=20 >=20 > Where to get gprofng > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > Due to the size of the contribution, we thought it would be better to=20 > submit it in the form > of a git branch, instead of a regular emailed patch series. >=20 > Repository: https://www.github.com/oracle/binutils-gdb > Branch: =C2=A0=C2=A0=C2=A0 oracle/gprofng-v3 Hi Vladimir! [Months later] I noticed that gprofng is doing a bit of indirection in format strings. Many distributions (including NixOS) build projects with CFLAGS/CXXFLAGS=3D-Werror=3Dformat-security to avoid trivial format string vulnerabilities. Today's binutils-gdb master fails to build under such a setup. The rest of binutils is generally -Werror=3Dformat-security clean. Do you think it's something gprofng could support or workaround? Currently I see the following failures: ../../../gprofng/src/Print.cc: In function 'int print_one_visible(FILE*, ch= ar*, char*, char*, TValue*, int)': ../../../gprofng/src/Print.cc:547:35: error: format not a string literal an= d no format arguments [-Werror=3Dformat-security] 547 | nc =3D fprintf (out_file, fmt_real0); | ^ ../../../gprofng/src/Print.cc:574:35: error: format not a string literal an= d no format arguments [-Werror=3Dformat-security] 574 | nc =3D fprintf (out_file, fmt_real0); | ^ ../../../gprofng/src/Print.cc: In function 'int print_one_tvisible(FILE*, c= har*, char*, TValue*, int, int)': ../../../gprofng/src/Print.cc:596:38: error: format not a string literal an= d no format arguments [-Werror=3Dformat-security] 596 | nc =3D fprintf (out_file, fmt_real0); | ^ ../../../gprofng/src/Print.cc: In function 'void print_one(FILE*, Hist_data= *, Hist_data::HistItem*, char**, char**, char**, MetricList*, Metric::HistM= etric*, char*, Histable::NameFormat)': ../../../gprofng/src/Print.cc:692:31: error: format not a string literal an= d no format arguments [-Werror=3Dformat-security] 692 | nc +=3D fprintf (out_file, stmp); | ^~~~ ../../../gprofng/src/Print.cc: In member function 'void er_print_histogram:= :dump_detail(int)': ../../../gprofng/src/Print.cc:1044:24: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 1044 | fprintf (out_file, fmt_real1); | ^~~~~~~~~ ../../../gprofng/src/Print.cc:1051:24: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 1051 | fprintf (out_file, fmt_int1); | ^~~~~~~~ ../../../gprofng/src/Print.cc:1062:23: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 1062 | fprintf (out_file, fmt_real1); | ^~~~~~~~~ ../../../gprofng/src/Print.cc:1066:28: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 1066 | fprintf (out_file, fmt_long1); | ^~~~~~~~~ ../../../gprofng/src/Print.cc:1105:24: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 1105 | fprintf (out_file, fmt_real1); | ^~~~~~~~~ ../../../gprofng/src/Print.cc: In member function 'void er_print_experiment= ::overview_value(Value*, ValueTag, double)': ../../../gprofng/src/Print.cc:2616:26: error: format not a string literal a= nd no format arguments [-Werror=3Dformat-security] 2616 | fprintf (out_file, fmt3); | ^~~~ cc1plus: some warnings being treated as errors make[5]: *** [Makefile:870: Print.lo] Error 1 depbase=3D`echo parse.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /nix/store/w61p7kw12h9ppxlfy5lsp2k32hcrwg4z-bash-5.1-p16/bin/bash ../libtoo= l --tag=3DCXX --mode=3Dcompile g++ -DHAVE_CONFIG_H -I. -I../../../gprofn= g/src -I.. -U_ASM -DLOCALEDIR=3D\"/mnt/archive/big/git/binutils-gdb/output= s/out/share/locale\" -I.. -I../../../gprofng/src -I../../../gprofng/src/../= common -I../../../gprofng/src/../../include -I../../../gprofng/src/../../op= codes -I../../bfd -I../../../gprofng/src/../../bfd -Wall -pthread -Wno-fo= rmat-truncation -Wno-switch -g -O2 -MT parse.lo -MD -MP -MF $depbase.Tp= o -c -o parse.lo ../../../gprofng/src/parse.cc &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../gprofng/src -I.. -U_A= SM -DLOCALEDIR=3D\"/mnt/archive/big/git/binutils-gdb/outputs/out/share/loca= le\" -I.. -I../../../gprofng/src -I../../../gprofng/src/../common -I../../.= ./gprofng/src/../../include -I../../../gprofng/src/../../opcodes -I../../bf= d -I../../../gprofng/src/../../bfd -Wall -pthread -Wno-format-truncation -W= no-switch -g -O2 -MT parse.lo -MD -MP -MF .deps/parse.Tpo -c ../../../gprof= ng/src/parse.cc -o parse.o ../../../gprofng/src/parse.cc: In member function 'virtual int Experiment::= process_Linux_kernel_cmd(hrtime_t)': ../../../gprofng/src/parse.cc:909:40: error: format not a string literal an= d no format arguments [-Werror=3Dformat-security] 909 | sprintf (last_mod_name, mod_name_ptr); | ^ Thanks! --=20 Sergei