From: Eric Dumazet <eric.dumazet@gmail.com>
To: Mark Rutland <mark.rutland@arm.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
"David S . Miller" <davem@davemloft.net>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] ipv4: fib: avoid NULL dereference
Date: Fri, 6 Jul 2018 08:39:11 -0700 [thread overview]
Message-ID: <deb5ea83-120f-9181-089d-8ae64e23dc0d@gmail.com> (raw)
In-Reply-To: <20180706145728.57utqqrjzq7iupnh@lakrids.cambridge.arm.com>
On 07/06/2018 07:57 AM, Mark Rutland wrote:
> On Fri, Jul 06, 2018 at 07:47:04AM -0700, Eric Dumazet wrote:
>>
>>
>> On 07/06/2018 07:28 AM, Mark Rutland wrote:
>>> In tnode_free() we iterate over a callback_head list with a while loop.
>>> At the start of the loop body we generate the next head pointer, and at
>>> the end of the loop body we generate the tn pointer for the next
>>> iteration of the loop by using container_of() on the head pointer to
>>> find the tnode, and deriving the kv pointer from this.
>>>
>>> In the final iteration of the loop, this means that we derive a pointer
>>> from NULL, which is undefined behaviour, which UBSAN detects:
>>
>> There is no dereference, your patch title is misleading.
>>
>> UBSAN might be fooled, not the C compiler.
>
> I'm happy to change the title to "avoid undefined behaviour".
>
Are you planning to change this as well ?
include/linux/stddef.h:19:#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
(And probably dozens of other locations)
next prev parent reply other threads:[~2018-07-06 15:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 14:28 [PATCH] ipv4: fib: avoid NULL dereference Mark Rutland
2018-07-06 14:47 ` Eric Dumazet
2018-07-06 14:57 ` Mark Rutland
2018-07-06 15:39 ` Eric Dumazet [this message]
2018-07-06 15:54 ` Mark Rutland
2018-07-06 16:20 ` Eric Dumazet
2018-07-06 16:33 ` Mark Rutland
2018-07-06 16:39 ` Eric Dumazet
2018-07-06 14:49 ` David Ahern
2018-07-06 14:55 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=deb5ea83-120f-9181-089d-8ae64e23dc0d@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox