Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405487

RE: UBSAN whinge in ihci-hub.c

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: UBSAN whinge in ihci-hub.c
Date 2016-05-23 18:10 +0200
Message-ID <rC0Ax-861-7@gated-at.bofh.it> (permalink)
References (2 earlier) <rA4oW-7vr-31@gated-at.bofh.it> <rA51E-7Zz-23@gated-at.bofh.it> <rA5O1-5S-7@gated-at.bofh.it> <rA6TM-Pd-25@gated-at.bofh.it> <rA8LU-25R-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andrey Ryabinin
> Sent: 18 May 2016 13:21
...
> >> $ 6.5.6.8
> >>    "If both the pointer operand and the result point to elements of
> >> the same array object,
> >>      or one past the last element of the array object, the evaluation
> >> shall not produce an overflow;
> >>      otherwise, the behavior is undefined."
> >
> > But we do not care whether the calculation overflows. We don't use it
> > at all in those cases.
> >
> 
> This doesn't make it defined. Also that pointer is unused only if gcc
> doesn't optimize away '!wIndex' check.
> If it does,  we may actually use it.

The compiler is allowed to generate the pointer and load it into
a 'pointer register'. On a hardware that has fat pointers and where
the hardware validates the bounds (&foo - 1) can fault.

The most recent hardware that does that is probably a vax.
Although I believe amd64 will fault if you load a suitable invalid
value (not a valid pointer) into the fs/gs offset registers.

	David

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

UBSAN whinge in ihci-hub.c Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2016-05-18 00:00 +0200
  Re: UBSAN whinge in ihci-hub.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-18 00:20 +0200
    Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 09:50 +0200
      Re: UBSAN whinge in ihci-hub.c Oliver Neukum <oneukum@suse.com> - 2016-05-18 10:30 +0200
        Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 11:20 +0200
          Re: UBSAN whinge in ihci-hub.c Oliver Neukum <oneukum@suse.com> - 2016-05-18 12:30 +0200
            Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 14:30 +0200
              Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 16:50 +0200
                Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 17:10 +0200
                Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 18:10 +0200
                Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 19:20 +0200
                Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 21:30 +0200
                Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-19 18:30 +0200
                Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-19 22:20 +0200
              RE: UBSAN whinge in ihci-hub.c David Laight <David.Laight@ACULAB.COM> - 2016-05-23 18:10 +0200

csiph-web