lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaM8dh6KvTu3TN2vRdpPVWdgWTd5uEF+z05cKQJMCJ3Ag@mail.gmail.com>
Date:   Wed, 14 Apr 2021 17:03:00 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     David Laight <David.Laight@...lab.com>
Cc:     Andrii Nakryiko <andrii@...nel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "ast@...com" <ast@...com>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "kernel-team@...com" <kernel-team@...com>
Subject: Re: [PATCH bpf-next 13/17] selftests/bpf: use -O0 instead of -Og in
 selftests builds

On Wed, Apr 14, 2021 at 3:15 PM David Laight <David.Laight@...lab.com> wrote:
>
> From: Andrii Nakryiko
> > Sent: 14 April 2021 21:02
> >
> > While -Og is designed to work well with debugger, it's still inferior to -O0
> > in terms of debuggability experience. It will cause some variables to still be
> > inlined, it will also prevent single-stepping some statements and otherwise
> > interfere with debugging experience. So switch to -O0 which turns off any
> > optimization and provides the best debugging experience.
>
> Surely the selftests need to use the normal compiler options
> so the compiler is generating the same type of code.
> Otherwise you are likely to miss out some instructions completely.
>

I don't know, it's not like I'm trying to validate that GCC is
generating a valid assembly. And there is almost nothing in libbpf and
selftests that relies on delicate timing, so I don't think we should
worry about changing timing characteristics. And there is nothing
performance-critical in libbpf logic itself either, for the most part.
So I don't see much harm in running selftests in debug mode.

> For normal code I actually prefer using -O2 when dubugging.
> If/when you need to look at the generated code you can see
> the wood for the trees, with -O0 the code is typically
> full of memory read/write to/from the stack.

Whenever I try debugging anything in selftest+libbpf+bpftool, if any
of those components are built with -O2, it makes it almost impossible
to figure anything out in debugger. So I always go back and force all
of them to -O0. So that's what this patch is doing, so that I and
others don't have to go through this every single time we need to
debug something.

>
> About the only annoying thing is tail-calls.
> They can get confusing.
>
>         David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ