Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread Peter Zijlstra
On Mon, Jan 16, 2017 at 02:34:43PM +, David Laight wrote: > From: Anton Blanchard > > Sent: 15 January 2017 21:36 > > I was debugging a hang on a ppc64le kernel built with clang, and it > > looks to be undefined behaviour with pointer wrapping in the llist code. > > > > A test case is below.

RE: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread David Laight
From: Anton Blanchard > Sent: 15 January 2017 21:36 > I was debugging a hang on a ppc64le kernel built with clang, and it > looks to be undefined behaviour with pointer wrapping in the llist code. > > A test case is below. llist_for_each_entry() does container_of() on a > NULL pointer, which

Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread Andrey Ryabinin
2017-01-16 15:53 GMT+03:00 Peter Zijlstra : > On Mon, Jan 16, 2017 at 10:42:29PM +1100, Anton Blanchard wrote: >> Hi Peter, >> >> > Last I checked I couldn't build a x86_64 kernel with llvm. So no, not >> > something I've ever ran into. >> > >> > Also, I would argue that this

Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread Peter Zijlstra
On Mon, Jan 16, 2017 at 10:42:29PM +1100, Anton Blanchard wrote: > Hi Peter, > > > Last I checked I couldn't build a x86_64 kernel with llvm. So no, not > > something I've ever ran into. > > > > Also, I would argue that this is broken in llvm, the kernel very much > > relies on things like this

Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread Anton Blanchard
Hi Peter, > Last I checked I couldn't build a x86_64 kernel with llvm. So no, not > something I've ever ran into. > > Also, I would argue that this is broken in llvm, the kernel very much > relies on things like this all over the place. Sure, we're way outside > of what the C language spec says,

Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 Thread Peter Zijlstra
On Mon, Jan 16, 2017 at 08:36:00AM +1100, Anton Blanchard wrote: > Hi, > > I was debugging a hang on a ppc64le kernel built with clang, and it > looks to be undefined behaviour with pointer wrapping in the llist code. > > A test case is below. llist_for_each_entry() does container_of() on a >

llist code relies on undefined behaviour, upsets llvm/clang

2017-01-15 Thread Anton Blanchard
Hi, I was debugging a hang on a ppc64le kernel built with clang, and it looks to be undefined behaviour with pointer wrapping in the llist code. A test case is below. llist_for_each_entry() does container_of() on a NULL pointer, which wraps our pointer negative, then adds the same offset back in