Re: [PATCH v6 2/2] x86/refcount: Implement fast refcount overflow protection
From: Josh Poimboeuf
Date: Wed Jul 19 2017 - 19:01:40 EST
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" \
> >> > + ".popsection\n\t"
> >>
> >> Just so I understand, we'll get a single byte added for each exception
> >> case, but it'll get discarded during final link?
> >
> > I think it's four bytes actually, but yeah, the section gets stripped at
> > vmlinux link time.
>
> Right, yes.
>
> BTW, I think this needs compiler.h coverage instead of the #else in
> compiler-gcc.h (since it's different from how annotate_unreachable is
> used only in compiler-gcc.h. I'll adjust.
Ah, right. Sounds good.
> Also, in looking at CONFIG_STACK_VALIDATION, do you want it to just
> warn and skip, or do you want to error out the build if validation
> isn't available but it's in the .config?
I think the current warn and skip behavior is fine. It's usually not a
life-or-death matter, and if it is, you'll be checking the warnings
anyway.
--
Josh