Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Kees Cook
On Sat, Sep 2, 2017 at 3:29 AM, Ingo Molnar wrote: > > * Kees Cook wrote: > >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()), which >> would cause any uses of a

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Kees Cook
On Sat, Sep 2, 2017 at 3:29 AM, Ingo Molnar wrote: > > * Kees Cook wrote: > >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()), which >> would cause any uses of a protected refcount_t function to stay

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Ingo Molnar
* Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with the function, triggering

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Ingo Molnar
* Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with the function, triggering the protection

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Ard Biesheuvel
On 2 September 2017 at 03:58, Kees Cook wrote: > On Fri, Sep 1, 2017 at 2:43 PM, Ard Biesheuvel > wrote: >> On 1 September 2017 at 21:22, Kees Cook wrote: >>> Using .text.unlikely for refcount exceptions isn't safe because

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Ard Biesheuvel
On 2 September 2017 at 03:58, Kees Cook wrote: > On Fri, Sep 1, 2017 at 2:43 PM, Ard Biesheuvel > wrote: >> On 1 September 2017 at 21:22, Kees Cook wrote: >>> Using .text.unlikely for refcount exceptions isn't safe because gcc may >>> move entire functions into .text.unlikely (e.g.

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Kees Cook
On Fri, Sep 1, 2017 at 9:03 PM, Mike Galbraith wrote: > On Fri, 2017-09-01 at 13:22 -0700, Kees Cook wrote: >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()), which >> would cause any uses of

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-02 Thread Kees Cook
On Fri, Sep 1, 2017 at 9:03 PM, Mike Galbraith wrote: > On Fri, 2017-09-01 at 13:22 -0700, Kees Cook wrote: >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()), which >> would cause any uses of a protected

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Mike Galbraith
On Fri, 2017-09-01 at 13:22 -0700, Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with the function,

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Mike Galbraith
On Fri, 2017-09-01 at 13:22 -0700, Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with the function,

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Kees Cook
On Fri, Sep 1, 2017 at 2:43 PM, Ard Biesheuvel wrote: > On 1 September 2017 at 21:22, Kees Cook wrote: >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()),

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Kees Cook
On Fri, Sep 1, 2017 at 2:43 PM, Ard Biesheuvel wrote: > On 1 September 2017 at 21:22, Kees Cook wrote: >> Using .text.unlikely for refcount exceptions isn't safe because gcc may >> move entire functions into .text.unlikely (e.g. in6_dev_get()), which >> would cause any uses of a protected

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Ard Biesheuvel
On 1 September 2017 at 21:22, Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with

Re: [PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Ard Biesheuvel
On 1 September 2017 at 21:22, Kees Cook wrote: > Using .text.unlikely for refcount exceptions isn't safe because gcc may > move entire functions into .text.unlikely (e.g. in6_dev_get()), which > would cause any uses of a protected refcount_t function to stay inline > with the function, triggering

[PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Kees Cook
Using .text.unlikely for refcount exceptions isn't safe because gcc may move entire functions into .text.unlikely (e.g. in6_dev_get()), which would cause any uses of a protected refcount_t function to stay inline with the function, triggering the protection unconditionally: .section

[PATCH] locking/refcounts, x86/asm: Use unique .text section for refcount exceptions

2017-09-01 Thread Kees Cook
Using .text.unlikely for refcount exceptions isn't safe because gcc may move entire functions into .text.unlikely (e.g. in6_dev_get()), which would cause any uses of a protected refcount_t function to stay inline with the function, triggering the protection unconditionally: .section