public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
To: Sergei Trofimovich <slyich@gmail.com>,
	Vladimir Mezentsev via Binutils <binutils@sourceware.org>
Subject: Re: [PATCH V3] gprofng: a new GNU profiler
Date: Mon, 23 May 2022 20:09:04 -0700	[thread overview]
Message-ID: <3ea7600e-a944-db69-0ec3-5681d3b6aea1@oracle.com> (raw)
In-Reply-To: <20220521093050.515a5ca5@nz>



On 5/21/22 01:30, Sergei Trofimovich wrote:
> On Wed, 1 Sep 2021 11:45:01 -0700
> Vladimir Mezentsev via Binutils <binutils@sourceware.org> wrote:
>
>> Hi people!
>>
>>
>> 09/01/2021: Changes from V2
>> ===========================
>>
>>     - Renamed experiment.h to gp-experiment.h (Hannes Domani reported
>> problem on Windows).
>>     - Fixed regression in build on ARM.
>>     - Improved gprofng/testsuite.
>>
>>
>> Where to get gprofng
>> ====================
>>
>> Due to the size of the contribution, we thought it would be better to
>> submit it in the form
>> of a git branch, instead of a regular emailed patch series.
>>
>> Repository: https://www.github.com/oracle/binutils-gdb
>> Branch:     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=-Werror=format-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=format-security clean.
>
> Do you think it's something gprofng could support or workaround?


Hi Sergei,

H.J. Lu failed  Bug 28968 - gprofng doesn't build with 
-Werror=format-security

We plan to fix this soon.

Thank you,
-Vladimir


>
> Currently I see the following failures:
>
> ../../../gprofng/src/Print.cc: In function 'int print_one_visible(FILE*, char*, char*, char*, TValue*, int)':
> ../../../gprofng/src/Print.cc:547:35: error: format not a string literal and no format arguments [-Werror=format-security]
>    547 |  nc = fprintf (out_file, fmt_real0);
>        |                                   ^
> ../../../gprofng/src/Print.cc:574:35: error: format not a string literal and no format arguments [-Werror=format-security]
>    574 |  nc = fprintf (out_file, fmt_real0);
>        |                                   ^
> ../../../gprofng/src/Print.cc: In function 'int print_one_tvisible(FILE*, char*, char*, TValue*, int, int)':
> ../../../gprofng/src/Print.cc:596:38: error: format not a string literal and no format arguments [-Werror=format-security]
>    596 |     nc = 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::HistMetric*, char*, Histable::NameFormat)':
> ../../../gprofng/src/Print.cc:692:31: error: format not a string literal and no format arguments [-Werror=format-security]
>    692 |      nc += 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 and no format arguments [-Werror=format-security]
>   1044 |     fprintf (out_file, fmt_real1);
>        |                        ^~~~~~~~~
> ../../../gprofng/src/Print.cc:1051:24: error: format not a string literal and no format arguments [-Werror=format-security]
>   1051 |     fprintf (out_file, fmt_int1);
>        |                        ^~~~~~~~
> ../../../gprofng/src/Print.cc:1062:23: error: format not a string literal and no format arguments [-Werror=format-security]
>   1062 |    fprintf (out_file, fmt_real1);
>        |                       ^~~~~~~~~
> ../../../gprofng/src/Print.cc:1066:28: error: format not a string literal and no format arguments [-Werror=format-security]
>   1066 |         fprintf (out_file, fmt_long1);
>        |                            ^~~~~~~~~
> ../../../gprofng/src/Print.cc:1105:24: error: format not a string literal and no format arguments [-Werror=format-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 and no format arguments [-Werror=format-security]
>   2616 |       fprintf (out_file, fmt3);
>        |                          ^~~~
> cc1plus: some warnings being treated as errors
> make[5]: *** [Makefile:870: Print.lo] Error 1
> depbase=`echo parse.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
> /nix/store/w61p7kw12h9ppxlfy5lsp2k32hcrwg4z-bash-5.1-p16/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../gprofng/src -I..  -U_ASM -DLOCALEDIR=\"/mnt/archive/big/git/binutils-gdb/outputs/out/share/locale\" -I.. -I../../../gprofng/src -I../../../gprofng/src/../common -I../../../gprofng/src/../../include -I../../../gprofng/src/../../opcodes -I../../bfd -I../../../gprofng/src/../../bfd   -Wall -pthread -Wno-format-truncation -Wno-switch -g -O2     -MT parse.lo -MD -MP -MF $depbase.Tpo -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_ASM -DLOCALEDIR=\"/mnt/archive/big/git/binutils-gdb/outputs/out/share/locale\" -I.. -I../../../gprofng/src -I../../../gprofng/src/../common -I../../../gprofng/src/../../include -I../../../gprofng/src/../../opcodes -I../../bfd -I../../../gprofng/src/../../bfd -Wall -pthread -Wno-format-truncation -Wno-switch -g -O2 -MT parse.lo -MD -MP -MF .deps/parse.Tpo -c ../../../gprofng/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 and no format arguments [-Werror=format-security]
>    909 |    sprintf (last_mod_name, mod_name_ptr);
>        |                                        ^
>
> Thanks!
>


      reply	other threads:[~2022-05-24  3:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <047143ae-be5e-9eec-237f-ad9ffe3795c0@oracle.com>
2021-09-01 18:45 ` Vladimir Mezentsev
2022-05-21  8:30   ` Sergei Trofimovich
2022-05-24  3:09     ` Vladimir Mezentsev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ea7600e-a944-db69-0ec3-5681d3b6aea1@oracle.com \
    --to=vladimir.mezentsev@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=slyich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).