From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: Re: [Bug 199643] New: UBSAN: Undefined behaviour in ./include/net/route.h:240:2 Date: Thu, 7 Jun 2018 18:02:33 -0700 Message-ID: <20180607180233.1b1c6511@cakuba.netronome.com> References: <20180508.001251.2189714817072679386.davem@davemloft.net> <20180607170623.6e5d56b5@cakuba.netronome.com> <20180607.201142.389815374334636334.davem@davemloft.net> <20180607174923.13a11d08@cakuba.netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: David Ahern , Eric Dumazet , David Miller , stephen@networkplumber.org, netdev@vger.kernel.org To: Andrey Ryabinin Return-path: Received: from mail-pl0-f47.google.com ([209.85.160.47]:39176 "EHLO mail-pl0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752414AbeFHBCg (ORCPT ); Thu, 7 Jun 2018 21:02:36 -0400 Received: by mail-pl0-f47.google.com with SMTP id f1-v6so7210834plt.6 for ; Thu, 07 Jun 2018 18:02:36 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: CC: Andrey On Thu, 7 Jun 2018 17:53:35 -0700, David Ahern wrote: > On 6/7/18 5:49 PM, Jakub Kicinski wrote: > > On Thu, 7 Jun 2018 17:28:59 -0700, Eric Dumazet wrote: > >> On 06/07/2018 05:11 PM, David Miller wrote: > >>> From: Jakub Kicinski > >>> Date: Thu, 7 Jun 2018 17:06:23 -0700 > >>> > >>>> [ 293.213661] ip_send_unicast_reply+0x1b67/0x1d0e > >>> > >>> This calls ip_setup_cork() which can NULL out the 'rt' route > >>> pointer. Hmmm... :-/ > >> > >> UBSAN seems unhappy with dst being NULL in : > >> > >> dst_release(&rt->dst); > >> > >> But the code obviously is ready for dst being NULL, it is even documented :) > > > > Oh, so the code depends on dst being the first member? Would it make > > sense to just cast the pointer instead? > > > > I've been going the other way with 'rt to dst' and 'dst to rt' > transformations. > > Perhaps UBSAN should be updated to understand that NULL + 0 is ok.