From: Johannes Berg <johannes@sipsolutions.net>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Mathias Nyman <mathias.nyman@intel.com>,
Jakub Kicinski <kuba@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Brendan Higgins <brendanhiggins@google.com>,
Ariel Elior <aelior@marvell.com>,
GR-everest-linux-l2@marvell.com, Wei Liu <wei.liu@kernel.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>,
lkft-triage@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <nathan@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Eric Dumazet <edumazet@google.com>
Subject: Re: ipv4/tcp.c:4234:1: error: the frame size of 1152 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Date: Wed, 08 Sep 2021 09:09:04 +0200 [thread overview]
Message-ID: <4d7ecfd46d327d43466e2821112de867f483bfad.camel@sipsolutions.net> (raw)
In-Reply-To: <CAHk-=whF9F89vsfH8E9TGc0tZA-yhzi2Di8wOtquNB5vRkFX5w@mail.gmail.com>
On Tue, 2021-09-07 at 16:14 -0700, Linus Torvalds wrote:
>
> The mac802.11 one seems to be due to 'struct ieee802_11_elems' being
> big, and allocated on the stack. I think it's probably made worse
> there with inlining, ie
>
> - ieee80211_sta_rx_queued_mgmt() has one copy
>
> - ieee80211_rx_mgmt_beacon() is possibly inlined, and has its own copy
>
> but even if it isn't due to that kind of duplication due to inlining,
> that code is dangerous. Exactly because it has two nested stack frames
> with that big structure, and they are active at the same time in the
> callchain whether inlined or not.
>
> And it's *pointlessly* dangerous, because the 'struct ieee802_11_elems
> elems' in ieee80211_sta_rx_queued_mgmt() is only used for the
> IEEE80211_STYPE_ACTION case, so it is entirely disjoint from the
> IEEE80211_STYPE_BEACON case, and those stack allocations simply should
> not nest like that in the first place.
>
> Making the IEEE80211_STYPE_ACTION case be its own function - like the
> other cases - and moving the struct there should fix it. Possibly a
> "noinline" or two necessary to make sure that the compiler doesn't
> then undo the "these two cases are disjoint" thing.
Yeah, I'm aware, and I agree. We've been looking at it every now and
then. This got made worse by us actually adding a fair amount of
pointers to the struct recently (in this merge window).
Ultimately, every new spec addition ends up needing to add something
there, so I think ultimately we'll probably want to either dynamically
allocate it somewhere (perhaps in a data structure used here already),
or possibly not have this at all and just find a way to return only the
bits that are interesting. Even parsing a ~1k frame (typical, max ~2k) a
handful of times is probably not even worse than having this large a
structure that gets filled data that's probably useless in many cases (I
think the different cases all just need a subset). But not sure, I'll
take a look.
johannes
next prev parent reply other threads:[~2021-09-08 7:09 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 12:27 ipv4/tcp.c:4234:1: error: the frame size of 1152 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Naresh Kamboju
2021-09-07 22:16 ` Linus Torvalds
2021-09-07 23:14 ` Linus Torvalds
2021-09-07 23:35 ` Nathan Chancellor
2021-09-07 23:49 ` Linus Torvalds
2021-09-08 0:15 ` Nathan Chancellor
2021-09-08 1:35 ` Linus Torvalds
2021-09-08 1:43 ` Linus Torvalds
2021-09-08 17:00 ` Arnd Bergmann
2021-09-08 7:09 ` Johannes Berg [this message]
2021-09-08 10:03 ` Wei Liu
2021-09-08 14:51 ` David Laight
2021-09-08 15:23 ` Wei Liu
2021-09-08 16:05 ` David Laight
2021-09-08 15:59 ` Linus Torvalds
2021-09-08 16:12 ` Wei Liu
2021-09-08 13:48 ` Thorsten Glaser
2021-09-08 14:50 ` Eric Dumazet
2021-09-08 15:48 ` Linus Torvalds
2021-09-08 16:56 ` Arnd Bergmann
2021-09-08 14:11 ` Shuah Khan
2021-09-08 17:05 ` Arnd Bergmann
2021-09-08 17:16 ` Shuah Khan
2021-09-08 21:24 ` Brendan Higgins
2021-09-08 22:27 ` Linus Torvalds
2021-09-13 20:55 ` Shuah Khan
2021-09-14 20:46 ` Brendan Higgins
2021-09-14 22:03 ` Arnd Bergmann
2021-09-17 5:39 ` Brendan Higgins
2021-09-17 6:16 ` Brendan Higgins
2021-09-17 7:20 ` Arnd Bergmann
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=4d7ecfd46d327d43466e2821112de867f483bfad.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=GR-everest-linux-l2@marvell.com \
--cc=aelior@marvell.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=brendanhiggins@google.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=mathias.nyman@intel.com \
--cc=naresh.kamboju@linaro.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=torvalds@linux-foundation.org \
--cc=wei.liu@kernel.org \
/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