Re: [PATCH v6 2/2] x86/refcount: Implement fast refcount overflow protection

From: Josh Poimboeuf
Date: Wed Jul 19 2017 - 19:30:34 EST


On Wed, Jul 19, 2017 at 04:12:37PM -0700, Kees Cook wrote:
> On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> > +#define ASM_UNREACHABLE \
> > + "999: .pushsection .discard.unreachable\n\t" \
> > + ".long 999b - .\n\t" \
> > + ".popsection\n\t"
>
> Will this end up running into the same bug fixed with
> 3d1e236022cc1426b0834565995ddee2ca231cee and the __LINE__ macro? I
> could tell under which conditions gcc would do this kind of merging...

I hope not, but objtool should complain about it if it does.

We could involve the __LINE__ macro, or some other way to make the
labels unique, but that might complicate the code a bit, so we can delay
doing that unless necessary.

--
Josh