Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1578423
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line |
| Date | 2017-02-10 13:10 +0100 |
| Message-ID | <t9iby-3dS-53@gated-at.bofh.it> (permalink) |
| References | <t8I83-5Aj-39@gated-at.bofh.it> <t94BA-2X8-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: David Miller
> Sent: 09 February 2017 21:31
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Wed, 8 Feb 2017 22:18:26 +0100
>
> > When CONFIG_KASAN is enabled, the "--param asan-stack=1" causes rather large
> > stack frames in some functions. This goes unnoticed normally because
> > CONFIG_FRAME_WARN is disabled with CONFIG_KASAN by default as of commit
> > 3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with
> > KASAN=y").
> >
> > The kernelci.org build bot however has the warning enabled and that led
> > me to investigate it a little further, as every build produces these warnings:
> >
> > net/wireless/nl80211.c:4389:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-
...
> >
> > It turns out that there is a relatively simple workaround for the netlink
> > users that currently use a local variable in order to do the type conversion:
> > Moving the three functions (for each of the typical sizes) to lib/nlattr.c
> > avoids using local variables in the caller, which drastically reduces the
> > stack usage for nl80211 and br_netlink.
> >
> > It would be good if we could enable the frame size check after that again,
> > but that should be a separate patch and it requires some more testing
> > to see which the largest acceptable frame size should be.
...
> You should only extern these things when KASAN is enabled.
>
> The reason is that uninlining these routines makes attribute emission
> more expensive and for some applications performance of this matters.
If performance of nla_put() matters, then adding 1, 2 and 4 byte attributes
ought to be doable without writing the values to memory and later doing
(I presume) a memcpy().
I also can't help feeling that the gcc KASAN stuff needs some way to
annotate an 'extern' to say that a value passed by reference isn't
treated as an array.
Otherwise I suspect you get a lot of bloat all over the place.
David
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-08 22:40 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Dmitry Vyukov <dvyukov@google.com> - 2017-02-09 12:40 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-09 13:00 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Dmitry Vyukov <dvyukov@google.com> - 2017-02-09 13:50 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-09 15:50 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Dmitry Vyukov <dvyukov@google.com> - 2017-02-09 18:00 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-09 18:10 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-10 14:40 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line Arnd Bergmann <arnd@arndb.de> - 2017-02-13 17:20 +0100
Re: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line David Miller <davem@davemloft.net> - 2017-02-09 22:40 +0100
RE: [PATCH] netlink: move nla_put_{u8,u16,u32} out of line David Laight <David.Laight@ACULAB.COM> - 2017-02-10 13:10 +0100
csiph-web