linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/26] bring back stack frame warning with KASAN
@ 2017-03-02 16:38 Arnd Bergmann
  2017-03-02 16:38 ` [PATCH 01/26] compiler: introduce noinline_for_kasan annotation Arnd Bergmann
                   ` (26 more replies)
  0 siblings, 27 replies; 67+ messages in thread
From: Arnd Bergmann @ 2017-03-02 16:38 UTC (permalink / raw)
  To: kasan-dev
  Cc: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov, netdev,
	linux-kernel, linux-media, linux-wireless, kernel-build-reports,
	David S . Miller

It took a long while to get this done, but I'm finally ready
to send the first half of the KASAN stack size patches that
I did in response to the kernelci.org warnings.

As before, it's worth mentioning that things are generally worse
with gcc-7.0.1 because of the addition of -fsanitize-address-use-after-scope
that are not present on kernelci, so my randconfig testing found
a lot more than kernelci did.

The main areas are:

- READ_ONCE/WRITE_ONCE cause problems in lots of code
- typecheck() causes huge problems in a few places
- I'm introducing "noinline_for_kasan" and use it in a lot
  of places that suffer from inline functions with local variables
  - netlink, as used in various parts of the kernel
  - a number of drivers/media drivers
  - a handful of wireless network drivers
- kmemcheck conflicts with -fsanitize-address-use-after-scope

This series lets us add back a stack frame warning for 3072 bytes
with -fsanitize-address-use-after-scope, or 2048 bytes without it.

I have a follow-up series that further reduces the stack frame
warning limit to 1280 bytes for all 64-bit architectures, and
1536 bytes with basic KASAN support (no -fsanitize-address-use-after-scope).
For now, I'm only posting the first half, in order to keep
it (barely) reviewable.

Both series are tested with many hundred randconfig builds on both
x86 and arm64, which are the only architectures supporting KASAN.

	Arnd 

 [PATCH 01/26] compiler: introduce noinline_for_kasan annotation
 [PATCH 02/26] rewrite READ_ONCE/WRITE_ONCE
 [PATCH 03/26] typecheck.h: avoid local variables in typecheck() macro
 [PATCH 04/26] tty: kbd: reduce stack size with KASAN
 [PATCH 05/26] netlink: mark nla_put_{u8,u16,u32} noinline_for_kasan
 [PATCH 06/26] rocker: mark rocker_tlv_put_* functions as
 [PATCH 07/26] brcmsmac: reduce stack size with KASAN
 [PATCH 08/26] brcmsmac: make some local variables 'static const' to
 [PATCH 09/26] brcmsmac: split up wlc_phy_workarounds_nphy
 [PATCH 10/26] brcmsmac: reindent split functions
 [PATCH 11/26] rtlwifi: reduce stack usage for KASAN
 [PATCH 12/26] wl3501_cs: reduce stack size for KASAN
 [PATCH 13/26] rtl8180: reduce stack size for KASAN
 [PATCH 14/26] [media] dvb-frontends: reduce stack size in i2c access
 [PATCH 15/26] [media] tuners: i2c: reduce stack usage for
 [PATCH 16/26] [media] i2c: adv7604: mark register access as
 [PATCH 17/26] [media] i2c: ks0127: reduce stack frame size for KASAN
 [PATCH 18/26] [media] i2c: cx25840: avoid stack overflow with KASAN
 [PATCH 19/26] [media] r820t: mark register functions as
 [PATCH 20/26] [media] em28xx: split up em28xx_dvb_init to reduce
 [PATCH 21/26] drm/bridge: ps8622: reduce stack size for KASAN
 [PATCH 22/26] drm/i915/gvt: don't overflow the kernel stack with
 [PATCH 23/26] mtd: cfi: reduce stack size with KASAN
 [PATCH 24/26] ocfs2: reduce stack size with KASAN
 [PATCH 25/26] isdn: eicon: mark divascapi incompatible with kasan
 [PATCH 26/26] kasan: rework Kconfig settings

 arch/x86/include/asm/switch_to.h                                 |    2 +-
 drivers/gpu/drm/bridge/parade-ps8622.c                           |    2 +-
 drivers/gpu/drm/i915/gvt/mmio.h                                  |   17 +-
 drivers/isdn/hardware/eicon/Kconfig                              |    1 +
 drivers/media/dvb-frontends/ascot2e.c                            |    3 +-
 drivers/media/dvb-frontends/cxd2841er.c                          |    4 +-
 drivers/media/dvb-frontends/drx39xyj/drxj.c                      |   14 +-
 drivers/media/dvb-frontends/helene.c                             |    4 +-
 drivers/media/dvb-frontends/horus3a.c                            |    2 +-
 drivers/media/dvb-frontends/itd1000.c                            |    2 +-
 drivers/media/dvb-frontends/mt312.c                              |    2 +-
 drivers/media/dvb-frontends/si2165.c                             |   14 +-
 drivers/media/dvb-frontends/stb0899_drv.c                        |    2 +-
 drivers/media/dvb-frontends/stb6100.c                            |    2 +-
 drivers/media/dvb-frontends/stv0367.c                            |    2 +-
 drivers/media/dvb-frontends/stv090x.c                            |    2 +-
 drivers/media/dvb-frontends/stv6110.c                            |    2 +-
 drivers/media/dvb-frontends/stv6110x.c                           |    2 +-
 drivers/media/dvb-frontends/tda8083.c                            |    2 +-
 drivers/media/dvb-frontends/zl10039.c                            |    2 +-
 drivers/media/i2c/adv7604.c                                      |    4 +-
 drivers/media/i2c/cx25840/cx25840-core.c                         |    4 +-
 drivers/media/i2c/ks0127.c                                       |    2 +-
 drivers/media/tuners/r820t.c                                     |    4 +-
 drivers/media/tuners/tuner-i2c.h                                 |   15 +-
 drivers/media/usb/em28xx/em28xx-dvb.c                            |  947 +++++++++++++++++++++------------------
 drivers/mtd/chips/cfi_cmdset_0020.c                              |    8 +-
 drivers/net/ethernet/rocker/rocker_tlv.h                         |   24 +-
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c     | 1860 +++++++++++++++++++++++++++++++++++++----------------------------------------
 drivers/net/wireless/realtek/rtl818x/rtl8180/rtl8225se.c         |    4 +-
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c |   41 +-
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c |   26 +-
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c |   34 +-
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c |   36 +-
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c |   38 +-
 drivers/net/wireless/wl3501_cs.c                                 |   10 +-
 drivers/tty/vt/keyboard.c                                        |    6 +-
 fs/ocfs2/cluster/masklog.c                                       |   10 +-
 fs/ocfs2/cluster/masklog.h                                       |    4 +-
 fs/overlayfs/util.c                                              |    6 +-
 include/linux/compiler.h                                         |   58 ++-
 include/linux/mtd/map.h                                          |    8 +-
 include/linux/typecheck.h                                        |    7 +-
 include/net/netlink.h                                            |   36 +-
 lib/Kconfig.debug                                                |    9 +-
 lib/Kconfig.kasan                                                |   11 +-
 lib/Kconfig.kmemcheck                                            |    1 +
 scripts/Makefile.kasan                                           |    3 +
 48 files changed, 1670 insertions(+), 1629 deletions(-)

^ permalink raw reply	[flat|nested] 67+ messages in thread

end of thread, other threads:[~2017-03-07 10:04 UTC | newest]

Thread overview: 67+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 16:38 [PATCH 00/26] bring back stack frame warning with KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 01/26] compiler: introduce noinline_for_kasan annotation Arnd Bergmann
2017-03-03 13:50   ` Andrey Ryabinin
2017-03-03 13:55     ` Alexander Potapenko
2017-03-03 14:30       ` Arnd Bergmann
2017-03-03 14:33         ` Alexander Potapenko
2017-03-03 14:51           ` Arnd Bergmann
2017-03-03 16:34     ` David Laight
2017-03-02 16:38 ` [PATCH 02/26] rewrite READ_ONCE/WRITE_ONCE Arnd Bergmann
2017-03-02 16:51   ` Christian Borntraeger
2017-03-02 17:55     ` Arnd Bergmann
2017-03-02 19:00       ` Christian Borntraeger
2017-03-02 21:45         ` Arnd Bergmann
2017-03-03  8:26           ` Christian Borntraeger
2017-03-03  9:54             ` Arnd Bergmann
2017-03-03 14:49             ` Peter Zijlstra
2017-03-03 14:57               ` Peter Zijlstra
2017-03-02 16:38 ` [PATCH 03/26] typecheck.h: avoid local variables in typecheck() macro Arnd Bergmann
2017-03-02 16:38 ` [PATCH 04/26] tty: kbd: reduce stack size with KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 05/26] netlink: mark nla_put_{u8,u16,u32} noinline_for_kasan Arnd Bergmann
2017-03-02 16:38 ` [PATCH 06/26] rocker: mark rocker_tlv_put_* functions as noinline_for_kasan Arnd Bergmann
2017-03-02 16:38 ` [PATCH 07/26] brcmsmac: reduce stack size with KASAN Arnd Bergmann
2017-03-06  9:16   ` Arend Van Spriel
2017-03-06 10:38     ` Arnd Bergmann
2017-03-06 11:02       ` Arend Van Spriel
2017-03-06 11:16         ` Arnd Bergmann
2017-03-06 11:18           ` Arnd Bergmann
2017-03-02 16:38 ` [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size Arnd Bergmann
2017-03-06  9:30   ` Arend Van Spriel
2017-03-06 16:19     ` Kalle Valo
2017-03-06 21:34       ` Arnd Bergmann
2017-03-07  9:44         ` Kalle Valo
2017-03-07  9:55           ` Arend Van Spriel
2017-03-02 16:38 ` [PATCH 09/26] brcmsmac: split up wlc_phy_workarounds_nphy Arnd Bergmann
2017-03-06  9:31   ` Arend Van Spriel
2017-03-02 16:38 ` [PATCH 10/26] brcmsmac: reindent split functions Arnd Bergmann
2017-03-06  9:33   ` Arend Van Spriel
2017-03-06 16:24     ` Kalle Valo
2017-03-02 16:38 ` [PATCH 11/26] rtlwifi: reduce stack usage for KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 12/26] wl3501_cs: reduce stack size " Arnd Bergmann
2017-03-02 16:38 ` [PATCH 13/26] rtl8180: " Arnd Bergmann
2017-03-02 16:38 ` [PATCH 14/26] [media] dvb-frontends: reduce stack size in i2c access Arnd Bergmann
2017-03-02 16:38 ` [PATCH 15/26] [media] tuners: i2c: reduce stack usage for tuner_i2c_xfer_* Arnd Bergmann
2017-03-02 16:38 ` [PATCH 16/26] [media] i2c: adv7604: mark register access as noinline_for_kasan Arnd Bergmann
2017-03-02 16:38 ` [PATCH 17/26] [media] i2c: ks0127: reduce stack frame size for KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 18/26] [media] i2c: cx25840: avoid stack overflow with KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 19/26] [media] r820t: mark register functions as noinline_for_kasan Arnd Bergmann
2017-03-02 16:38 ` [PATCH 20/26] [media] em28xx: split up em28xx_dvb_init to reduce stack size Arnd Bergmann
2017-03-02 16:38 ` [PATCH 21/26] drm/bridge: ps8622: reduce stack size for KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 22/26] drm/i915/gvt: don't overflow the kernel stack with KASAN Arnd Bergmann
2017-03-02 16:38 ` [PATCH 23/26] mtd: cfi: reduce stack size " Arnd Bergmann
2017-03-02 16:38 ` [PATCH 24/26] ocfs2: " Arnd Bergmann
2017-03-02 17:46   ` Joe Perches
2017-03-02 22:22     ` Arnd Bergmann
2017-03-02 22:40       ` Joe Perches
2017-03-02 22:59         ` Arnd Bergmann
2017-03-02 23:58           ` Joe Perches
2017-03-02 16:38 ` [PATCH 25/26] isdn: eicon: mark divascapi incompatible with kasan Arnd Bergmann
2017-03-03 14:20   ` Andrey Ryabinin
2017-03-03 14:54     ` Arnd Bergmann
2017-03-03 15:22       ` Andrey Ryabinin
2017-03-03 15:37         ` Arnd Bergmann
2017-03-02 16:38 ` [PATCH 26/26] kasan: rework Kconfig settings Arnd Bergmann
2017-03-03 14:51   ` Andrey Ryabinin
2017-03-03 15:03     ` Arnd Bergmann
2017-03-03 12:25 ` [PATCH 00/26] bring back stack frame warning with KASAN Alexander Potapenko
2017-03-03 12:54   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).