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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 04:12:37PM -0700, Kees Cook wrote: > On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > > +#define ASM_UNREACHABLE > > \ > > + "999: .pushsection .discard.unreachable\n\t"

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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 04:12:37PM -0700, Kees Cook wrote: > On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > > +#define ASM_UNREACHABLE > > \ > > + "999: .pushsection .discard.unreachable\n\t"\ > > +

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > +#define ASM_UNREACHABLE > \ > + "999: .pushsection .discard.unreachable\n\t"\ > + ".long 999b - .\n\t"

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > +#define ASM_UNREACHABLE > \ > + "999: .pushsection .discard.unreachable\n\t"\ > + ".long 999b - .\n\t"\ >

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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 03:50:14PM -0700, Kees Cook wrote: > >> > }) > >> > + > >> > +#define ASM_UNREACHABLE > >> >\ > >> > + "999: .pushsection .discard.unreachable\n\t"\ > >> > + ".long 999b - .\n\t"

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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 03:50:14PM -0700, Kees Cook wrote: > >> > }) > >> > + > >> > +#define ASM_UNREACHABLE > >> >\ > >> > + "999: .pushsection .discard.unreachable\n\t"\ > >> > + ".long 999b - .\n\t"

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:52 PM, Josh Poimboeuf wrote: > On Wed, Jul 19, 2017 at 12:45:19PM -0700, Kees Cook wrote: >> > diff --git a/arch/x86/include/asm/refcount.h >> > b/arch/x86/include/asm/refcount.h >> > index 13b91e850a02..e7587db3487c 100644 >> > ---

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:52 PM, Josh Poimboeuf wrote: > On Wed, Jul 19, 2017 at 12:45:19PM -0700, Kees Cook wrote: >> > diff --git a/arch/x86/include/asm/refcount.h >> > b/arch/x86/include/asm/refcount.h >> > index 13b91e850a02..e7587db3487c 100644 >> > --- a/arch/x86/include/asm/refcount.h >>

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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 12:45:19PM -0700, Kees Cook wrote: > > diff --git a/arch/x86/include/asm/refcount.h > > b/arch/x86/include/asm/refcount.h > > index 13b91e850a02..e7587db3487c 100644 > > --- a/arch/x86/include/asm/refcount.h > > +++ b/arch/x86/include/asm/refcount.h > > @@ -15,6 +15,7 @@ >

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

2017-07-19 Thread Josh Poimboeuf
On Wed, Jul 19, 2017 at 12:45:19PM -0700, Kees Cook wrote: > > diff --git a/arch/x86/include/asm/refcount.h > > b/arch/x86/include/asm/refcount.h > > index 13b91e850a02..e7587db3487c 100644 > > --- a/arch/x86/include/asm/refcount.h > > +++ b/arch/x86/include/asm/refcount.h > > @@ -15,6 +15,7 @@ >

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > On Tue, Jul 18, 2017 at 05:03:34PM -0700, Kees Cook wrote: >> +/* >> + * Body of refcount error handling: in .text.unlikely, saved into CX the >> + * address of the refcount that has entered a bad state, and trigger an

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

2017-07-19 Thread Kees Cook
On Wed, Jul 19, 2017 at 12:37 PM, Josh Poimboeuf wrote: > On Tue, Jul 18, 2017 at 05:03:34PM -0700, Kees Cook wrote: >> +/* >> + * Body of refcount error handling: in .text.unlikely, saved into CX the >> + * address of the refcount that has entered a bad state, and trigger an >> + * exception.

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

2017-07-19 Thread Josh Poimboeuf
On Tue, Jul 18, 2017 at 05:03:34PM -0700, Kees Cook wrote: > +/* > + * Body of refcount error handling: in .text.unlikely, saved into CX the > + * address of the refcount that has entered a bad state, and trigger an > + * exception. Fixup address is back in regular execution flow in .text. > + */

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

2017-07-19 Thread Josh Poimboeuf
On Tue, Jul 18, 2017 at 05:03:34PM -0700, Kees Cook wrote: > +/* > + * Body of refcount error handling: in .text.unlikely, saved into CX the > + * address of the refcount that has entered a bad state, and trigger an > + * exception. Fixup address is back in regular execution flow in .text. > + */

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

2017-07-18 Thread Kees Cook
This implements refcount_t overflow protection on x86 without a noticeable performance impact, though without the fuller checking of REFCOUNT_FULL. This is done by duplicating the existing atomic_t refcount implementation but with normally a single instruction added to detect if the refcount has

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

2017-07-18 Thread Kees Cook
This implements refcount_t overflow protection on x86 without a noticeable performance impact, though without the fuller checking of REFCOUNT_FULL. This is done by duplicating the existing atomic_t refcount implementation but with normally a single instruction added to detect if the refcount has