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

2017-05-09 Thread Josh Poimboeuf
On Tue, May 09, 2017 at 10:29:16AM -0700, Kees Cook wrote: > On Tue, May 9, 2017 at 10:08 AM, Josh Poimboeuf wrote: > > On Mon, May 08, 2017 at 08:58:29PM -0500, Josh Poimboeuf wrote: > >> On Mon, May 08, 2017 at 04:31:11PM -0700, Kees Cook wrote: > >> > On Mon, May 8, 2017 at 3:53 PM, Josh Poimbo

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

2017-05-09 Thread Kees Cook
On Tue, May 9, 2017 at 10:08 AM, Josh Poimboeuf wrote: > On Mon, May 08, 2017 at 08:58:29PM -0500, Josh Poimboeuf wrote: >> On Mon, May 08, 2017 at 04:31:11PM -0700, Kees Cook wrote: >> > On Mon, May 8, 2017 at 3:53 PM, Josh Poimboeuf wrote: >> > > On Mon, May 08, 2017 at 12:32:52PM -0700, Kees C

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

2017-05-09 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 08:58:29PM -0500, Josh Poimboeuf wrote: > On Mon, May 08, 2017 at 04:31:11PM -0700, Kees Cook wrote: > > On Mon, May 8, 2017 at 3:53 PM, Josh Poimboeuf wrote: > > > On Mon, May 08, 2017 at 12:32:52PM -0700, Kees Cook wrote: > > >> +#define REFCOUNT_EXCEPTION

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

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 04:31:11PM -0700, Kees Cook wrote: > On Mon, May 8, 2017 at 3:53 PM, Josh Poimboeuf wrote: > > On Mon, May 08, 2017 at 12:32:52PM -0700, Kees Cook wrote: > >> +#define REFCOUNT_EXCEPTION \ > >> + "movl $0x7fff, %[counter]\n\t"

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

2017-05-08 Thread Kees Cook
On Mon, May 8, 2017 at 3:53 PM, Josh Poimboeuf wrote: > On Mon, May 08, 2017 at 12:32:52PM -0700, Kees Cook wrote: >> +#define REFCOUNT_EXCEPTION \ >> + "movl $0x7fff, %[counter]\n\t" \ >> + "int $"__stringify(X86_REFCOUNT_VECTOR)"\n" \ >> +

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

2017-05-08 Thread Josh Poimboeuf
On Mon, May 08, 2017 at 12:32:52PM -0700, Kees Cook wrote: > +#define REFCOUNT_EXCEPTION \ > + "movl $0x7fff, %[counter]\n\t" \ > + "int $"__stringify(X86_REFCOUNT_VECTOR)"\n" \ > + "0:\n\t"\ > +

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

2017-05-08 Thread Kees Cook
This protection is a modified version of the x86 PAX_REFCOUNT implementation from PaX/grsecurity, prior to the use of named text sections. This speeds up the refcount_t API by duplicating the existing atomic_t implementation with a single instruction added to detect if the refcount has wrapped past