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] [day] [month] [year] [list]
Message-ID: <CAK8P3a1oTpirhdvYLNV=vw1pr6kZCkaHf=y-nuvHy8=9GOrO2A@mail.gmail.com>
Date:   Fri, 15 Oct 2021 16:40:53 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Zanussi <zanussi@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] tracing: use %ps format string to print symbols

On Fri, Oct 15, 2021 at 3:57 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Fri, 15 Oct 2021 10:34:31 +0200
> Arnd Bergmann <arnd@...nel.org> wrote:
>
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > clang started warning about excessive stack usage in
> > hist_trigger_print_key()
> >
> > kernel/trace/trace_events_hist.c:4723:13: error: stack frame size (1336) exceeds limit (1024) in function 'hist_trigger_print_key' [-Werror,-Wframe-larger-than]
> >
> > The problem is that there are two 512-byte arrays on the stack if
> > hist_trigger_stacktrace_print() gets inlined. I don't think this has
> > changed in the past five years, but something probably changed the
> > inlining decisions made by the compiler, so the problem is now made
> > more obvious.
>
> Could we just add "noinline" attribute to that function?

It would avoid the warning, but not reduce the overall stack
usage. If that's good enough for you, I'm fine with that as well.

> > @@ -4715,8 +4714,7 @@ static void hist_trigger_stacktrace_print(struct seq_file *m,
> >                       return;
> >
> >               seq_printf(m, "%*c", 1 + spaces, ' ');
> > -             sprint_symbol(str, stacktrace_entries[i]);
> > -             seq_printf(m, "%s\n", str);
> > +             seq_printf(m, "%pS\n", stacktrace_entries[i]);

I just noticed this needs an extra cast to (void*) to avoid a warning
with clang,
not sure why I saw it build cleanly before.

> > @@ -4747,14 +4744,12 @@ static void hist_trigger_print_key(struct seq_file *m,
> >                       seq_printf(m, "%s: %llx", field_name, uval);
> >               } else if (key_field->flags & HIST_FIELD_FL_SYM) {
> >                       uval = *(u64 *)(key + key_field->offset);
> > -                     sprint_symbol_no_offset(str, uval);
> > -                     seq_printf(m, "%s: [%llx] %-45s", field_name,
> > -                                uval, str);
> > +                     seq_printf(m, "%s: [%llx] %-45ps", field_name,
> > +                                uval, (void *)uval);
> >               } else if (key_field->flags & HIST_FIELD_FL_SYM_OFFSET) {
> >                       uval = *(u64 *)(key + key_field->offset);
> > -                     sprint_symbol(str, uval);
> > -                     seq_printf(m, "%s: [%llx] %-55s", field_name,
> > -                                uval, str);
> > +                     seq_printf(m, "%s: [%llx] %-55ps", field_name,
> > +                                uval, (void *)uval);
>
> The above requires "Ps" not "ps".

you mean "%-55pS", right?

> But other than that, I could test if this doesn't change the formatting and
> functionality at all.

Ok, let me know if I should resend with the two small changes I mentioned,
or if you want to just go with the 'noinline_for_stack' annotation.

        Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ