[PATCH v4 13/17] khwasan: add hooks implementation
From: dvyukov@google.com (Dmitry Vyukov)
Date: 2018-07-31 16:03:45
Also in:
linux-doc, linux-kbuild, linux-mm, lkml
On Tue, Jul 31, 2018 at 5:38 PM, Christopher Lameter [off-list ref] wrote:
On Tue, 31 Jul 2018, Dmitry Vyukov wrote:quoted
quoted
Actually you should do this for SLAB_TYPESAFE_BY_RCU slabs. Usually they are with ->ctors but there are few without constructors. We can't reinitialize or even retag them. The latter will definitely cause false-positive use-after-free reports.Somewhat offtopic, but I can't understand how SLAB_TYPESAFE_BY_RCU slabs can be useful without ctors or at least memset(0). Objects in such slabs need to be type-stable, but I can't understand how it's possible to establish type stability without a ctor... Are these bugs? Or I am missing something subtle? What would be a canonical usage of SLAB_TYPESAFE_BY_RCU slab without a ctor?True that sounds fishy. Would someone post a list of SLAB_TYPESAFE_BY_RCU slabs without ctors?
https://elixir.bootlin.com/linux/latest/source/fs/jbd2/journal.c#L2395 https://elixir.bootlin.com/linux/latest/source/fs/kernfs/mount.c#L415 https://elixir.bootlin.com/linux/latest/source/net/netfilter/nf_conntrack_core.c#L2065 https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/i915_gem.c#L5501 https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/i915/selftests/mock_gem_device.c#L212 https://elixir.bootlin.com/linux/latest/source/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c#L1131 Also these in proto structs: https://elixir.bootlin.com/linux/latest/source/net/dccp/ipv4.c#L959 https://elixir.bootlin.com/linux/latest/source/net/dccp/ipv6.c#L1048 https://elixir.bootlin.com/linux/latest/source/net/ipv4/tcp_ipv4.c#L2461 https://elixir.bootlin.com/linux/latest/source/net/ipv6/tcp_ipv6.c#L1980 https://elixir.bootlin.com/linux/latest/source/net/llc/af_llc.c#L145 https://elixir.bootlin.com/linux/latest/source/net/smc/af_smc.c#L105 They later created in net/core/sock.c without ctor.