2016-04-20 22:22:49

by Martin MOKREJŠ

[permalink] [raw]
Subject: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

Hi,
I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.

# dmesg | grep "UBSAN: Undefined behaviour"
[ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
[ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
[ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
[ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
#

Full dmesg is attached.

Hope this helps,
Martin


Attachments:
dmesg-4.5.1.txt (82.83 kB)

2016-04-21 00:42:29

by Greg KH

[permalink] [raw]
Subject: Re: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

On Thu, Apr 21, 2016 at 12:22:49AM +0200, Martin MOKREJŠ wrote:
> Hi,
> I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.
>
> # dmesg | grep "UBSAN: Undefined behaviour"
> [ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
> [ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
> [ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
> [ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
> #
>
> Full dmesg is attached.
>
> Hope this helps,
> Martin

> [ 0.000000] Linux version 4.5.1-default-pciehp (root@vostro) (gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) ) #1 SMP Thu Apr 14 14:17:48 CEST 2016

Please try 4.6-rc4, a number of UBSAN issues have been fixed there.

thansk,

greg k-h

2016-04-21 09:18:16

by Martin MOKREJŠ

[permalink] [raw]
Subject: Re: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

Hi Greg,

thank you for your answer.

Greg KH wrote:
> On Thu, Apr 21, 2016 at 12:22:49AM +0200, Martin MOKREJŠ wrote:
>> Hi,
>> I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.
>>
>> # dmesg | grep "UBSAN: Undefined behaviour"
>> [ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
>> [ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
>> [ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
>> [ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
>> #
>>
>> Full dmesg is attached.
>>
>> Hope this helps,
>> Martin
>
>> [ 0.000000] Linux version 4.5.1-default-pciehp (root@vostro) (gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) ) #1 SMP Thu Apr 14 14:17:48 CEST 2016
>
> Please try 4.6-rc4, a number of UBSAN issues have been fixed there.

They are still present:

# dmesg | grep "UBSAN: Undefined behaviour"
[ 3.113405] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:877:47
[ 5.678949] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2619:15
[ 18.345599] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1281:11
[ 34.544363] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
#

Updated dmesg is attached.
Martin


Attachments:
dmesg.txt (79.42 kB)

2016-04-21 10:48:00

by Greg KH

[permalink] [raw]
Subject: Re: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

On Thu, Apr 21, 2016 at 11:18:16AM +0200, Martin MOKREJŠ wrote:
> Hi Greg,
>
> thank you for your answer.
>
> Greg KH wrote:
> > On Thu, Apr 21, 2016 at 12:22:49AM +0200, Martin MOKREJŠ wrote:
> > > Hi,
> > > I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.
> > >
> > > # dmesg | grep "UBSAN: Undefined behaviour"
> > > [ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
> > > [ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
> > > [ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
> > > [ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
> > > #
> > >
> > > Full dmesg is attached.
> > >
> > > Hope this helps,
> > > Martin
> >
> > > [ 0.000000] Linux version 4.5.1-default-pciehp (root@vostro) (gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) ) #1 SMP Thu Apr 14 14:17:48 CEST 2016
> >
> > Please try 4.6-rc4, a number of UBSAN issues have been fixed there.
>
> They are still present:
>
> # dmesg | grep "UBSAN: Undefined behaviour"
> [ 3.113405] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:877:47
> [ 5.678949] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2619:15
> [ 18.345599] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1281:11
> [ 34.544363] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

Ah, sorry about that, turns out this is a bug in the tool, not in the
code, see the thread from a few weeks ago in the linux-usb archives with
the subject:
Subject: function ehci_hub_control in ehci-hub.c
for all of the details.

thanks,

greg k-h

2016-04-21 11:17:19

by Martin MOKREJŠ

[permalink] [raw]
Subject: Re: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

Greg KH wrote:
> On Thu, Apr 21, 2016 at 11:18:16AM +0200, Martin MOKREJŠ wrote:
>> Hi Greg,
>>
>> thank you for your answer.
>>
>> Greg KH wrote:
>>> On Thu, Apr 21, 2016 at 12:22:49AM +0200, Martin MOKREJŠ wrote:
>>>> Hi,
>>>> I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.
>>>>
>>>> # dmesg | grep "UBSAN: Undefined behaviour"
>>>> [ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
>>>> [ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
>>>> [ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
>>>> [ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
>>>> #
>>>>
>>>> Full dmesg is attached.
>>>>
>>>> Hope this helps,
>>>> Martin
>>>
>>>> [ 0.000000] Linux version 4.5.1-default-pciehp (root@vostro) (gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) ) #1 SMP Thu Apr 14 14:17:48 CEST 2016
>>>
>>> Please try 4.6-rc4, a number of UBSAN issues have been fixed there.
>>
>> They are still present:
>>
>> # dmesg | grep "UBSAN: Undefined behaviour"
>> [ 3.113405] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:877:47
>> [ 5.678949] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2619:15
>> [ 18.345599] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1281:11
>> [ 34.544363] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
>
> Ah, sorry about that, turns out this is a bug in the tool, not in the
> code, see the thread from a few weeks ago in the linux-usb archives with
> the subject:
> Subject: function ehci_hub_control in ehci-hub.c
> for all of the details.

Thank you. I am not a programmer so I only infer from this thread I should disable
the UBSAN in .config. The kernel code is technically correct but triggers false alarm.
Maybe the UBSAN could have a whitelist of falsely matching locations?

https://www.mail-archive.com/[email protected]/msg72438.html

Did anybody check the ext4 code or is it also just believed the UBSAN complaint is
just broken and code changes are not necessary?
Martin

2016-04-21 12:43:01

by Greg KH

[permalink] [raw]
Subject: Re: 4.5.1: UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9

On Thu, Apr 21, 2016 at 01:17:19PM +0200, Martin MOKREJŠ wrote:
> Greg KH wrote:
> > On Thu, Apr 21, 2016 at 11:18:16AM +0200, Martin MOKREJŠ wrote:
> > > Hi Greg,
> > >
> > > thank you for your answer.
> > >
> > > Greg KH wrote:
> > > > On Thu, Apr 21, 2016 at 12:22:49AM +0200, Martin MOKREJŠ wrote:
> > > > > Hi,
> > > > > I am not certain to to forward this to, so I am trying linux-usb and ext4. Please add relevant people/lists, thank you.
> > > > >
> > > > > # dmesg | grep "UBSAN: Undefined behaviour"
> > > > > [ 2.638843] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:873:47
> > > > > [ 8.553620] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2612:15
> > > > > [ 25.341048] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1274:11
> > > > > [ 41.460542] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
> > > > > #
> > > > >
> > > > > Full dmesg is attached.
> > > > >
> > > > > Hope this helps,
> > > > > Martin
> > > >
> > > > > [ 0.000000] Linux version 4.5.1-default-pciehp (root@vostro) (gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) ) #1 SMP Thu Apr 14 14:17:48 CEST 2016
> > > >
> > > > Please try 4.6-rc4, a number of UBSAN issues have been fixed there.
> > >
> > > They are still present:
> > >
> > > # dmesg | grep "UBSAN: Undefined behaviour"
> > > [ 3.113405] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:877:47
> > > [ 5.678949] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2619:15
> > > [ 18.345599] UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1281:11
> > > [ 34.544363] UBSAN: Undefined behaviour in ./arch/x86/include/asm/atomic.h:156:9
> >
> > Ah, sorry about that, turns out this is a bug in the tool, not in the
> > code, see the thread from a few weeks ago in the linux-usb archives with
> > the subject:
> > Subject: function ehci_hub_control in ehci-hub.c
> > for all of the details.
>
> Thank you. I am not a programmer so I only infer from this thread I should disable
> the UBSAN in .config. The kernel code is technically correct but triggers false alarm.
> Maybe the UBSAN could have a whitelist of falsely matching locations?
>
> https://www.mail-archive.com/[email protected]/msg72438.html

It probably should be fixed to not report false things like this.

> Did anybody check the ext4 code or is it also just believed the UBSAN complaint is
> just broken and code changes are not necessary?

I'm not an ext4 developer, I'll leave that to them :)

thanks,

greg k-h