[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202209010012.777DAE2@keescook>
Date: Thu, 1 Sep 2022 00:12:37 -0700
From: Kees Cook <keescook@...omium.org>
To: Jozsef Kadlecsik <kadlec@...filter.org>
Cc: Jakub Kicinski <kuba@...nel.org>,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
syzbot <syzkaller@...glegroups.com>,
netfilter-devel@...r.kernel.org, coreteam@...filter.org,
netdev@...r.kernel.org, Petr Machata <petrm@...dia.com>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
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@...nel.org>
> > Cc: Pablo Neira Ayuso <pablo@...filter.org>
> > Cc: Jozsef Kadlecsik <kadlec@...filter.org>
> > Cc: Florian Westphal <fw@...len.de>
> > Cc: "David S. Miller" <davem@...emloft.net>
> > Cc: Eric Dumazet <edumazet@...gle.com>
> > Cc: Paolo Abeni <pabeni@...hat.com>
> > Cc: syzbot <syzkaller@...glegroups.com>
> > Cc: netfilter-devel@...r.kernel.org
> > Cc: coreteam@...filter.org
> > Cc: netdev@...r.kernel.org
> > Signed-off-by: Kees Cook <keescook@...omium.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
Powered by blists - more mailing lists