Messages in this thread | | | Date | Thu, 1 Sep 2022 00:12:37 -0700 | From | Kees Cook <> | Subject | Re: [PATCH v2] netlink: Bounds-check struct nlmsgerr creation |
| |
On Thu, Sep 01, 2022 at 09:06:03AM +0200, Jozsef Kadlecsik wrote: > Hi, > > On Wed, 31 Aug 2022, Kees Cook wrote: > > > For 32-bit systems, it might be possible to wrap lnmsgerr content > > lengths beyond SIZE_MAX. Explicitly test for all overflows, and mark the > > memcpy() as being unable to internally diagnose overflows. > > > > This also excludes netlink from the coming runtime bounds check on > > memcpy(), since it's an unusual case of open-coded sizing and > > allocation. Avoid this future run-time warning: > > > > memcpy: detected field-spanning write (size 32) of single field "&errmsg->msg" at net/netlink/af_netlink.c:2447 (size 16) > > > > Cc: Jakub Kicinski <kuba@kernel.org> > > Cc: Pablo Neira Ayuso <pablo@netfilter.org> > > Cc: Jozsef Kadlecsik <kadlec@netfilter.org> > > Cc: Florian Westphal <fw@strlen.de> > > Cc: "David S. Miller" <davem@davemloft.net> > > Cc: Eric Dumazet <edumazet@google.com> > > Cc: Paolo Abeni <pabeni@redhat.com> > > Cc: syzbot <syzkaller@googlegroups.com> > > Cc: netfilter-devel@vger.kernel.org > > Cc: coreteam@netfilter.org > > Cc: netdev@vger.kernel.org > > Signed-off-by: Kees Cook <keescook@chromium.org> > > --- > > v2: Rebased to -next > > v1: https://lore.kernel.org/lkml/20220901030610.1121299-3-keescook@chromium.org > > --- > > net/netlink/af_netlink.c | 81 +++++++++++++++++++++++++--------------- > > 1 file changed, 51 insertions(+), 30 deletions(-) > > Could you add back the net/netfilter/ipset/ip_set_core.c part? Thanks!
*face palm* Yes, thank you. v3 on the way.
-- Kees Cook
| |