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: <CA+fCnZebcevCZModJKRAVM_-WL0o_C+ooVxNpZtw+-Bwu3GMRA@mail.gmail.com>
Date:   Fri, 17 Feb 2023 11:01:41 +0100
From:   Andrey Konovalov <andreyknvl@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Arnd Bergmann <arnd@...nel.org>
Cc:     "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Arnd Bergmann <arnd@...db.de>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        kasan-dev@...glegroups.com, Vernon Yang <vernon2gm@...il.com>,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RFC] maple_tree: reduce stack usage with gcc-9 and earlier

On Tue, Feb 14, 2023 at 8:40 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Tue, 14 Feb 2023 11:30:24 +0100 Arnd Bergmann <arnd@...nel.org> wrote:
>
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > gcc-10 changed the way inlining works to be less aggressive, but
> > older versions run into an oversized stack frame warning whenever
> > CONFIG_KASAN_STACK is enabled, as that forces variables from
> > inlined callees to be non-overlapping:
> >
> > lib/maple_tree.c: In function 'mas_wr_bnode':
> > lib/maple_tree.c:4320:1: error: the frame size of 1424 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >
> > Change the annotations on mas_store_b_node() and mas_commit_b_node()
> > to explicitly forbid inlining in this configuration, which is
> > the same behavior that newer versions already have.
> >
> > ...
> >
> > --- a/lib/maple_tree.c
> > +++ b/lib/maple_tree.c
> > @@ -146,6 +146,13 @@ struct maple_subtree_state {
> >       struct maple_big_node *bn;
> >  };
> >
> > +#ifdef CONFIG_KASAN_STACK
> > +/* Prevent mas_wr_bnode() from exceeding the stack frame limit */
> > +#define noinline_for_kasan noinline_for_stack
> > +#else
> > +#define noinline_for_kasan inline
> > +#endif
>
> Should noinline_for_kasan be defined in kasan.h?  maple_tree.c is
> unlikely to be the only place in the kernel which could use this
> treatment?

We could also define it in include/linux/compiler_types.h along with
other KASAN attributes.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ