Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Yu-cheng Yu
On Fri, 2020-05-22 at 10:36 -0700, Kees Cook wrote: > On Fri, May 22, 2020 at 07:27:11PM +0200, Peter Zijlstra wrote: > > On Fri, May 22, 2020 at 10:22:51AM -0700, Kees Cook wrote: > > > > > But yes, I think getting a copy of asm.h would be nice here. I don't > > > think the WRITE_ONCE() is

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Kees Cook
On Fri, May 22, 2020 at 07:27:11PM +0200, Peter Zijlstra wrote: > On Fri, May 22, 2020 at 10:22:51AM -0700, Kees Cook wrote: > > > But yes, I think getting a copy of asm.h would be nice here. I don't > > think the WRITE_ONCE() is needed in this particular case. Hmm. > > Paranoia on my end

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Peter Zijlstra
On Fri, May 22, 2020 at 10:22:51AM -0700, Kees Cook wrote: > But yes, I think getting a copy of asm.h would be nice here. I don't > think the WRITE_ONCE() is needed in this particular case. Hmm. Paranoia on my end because I had no clue wth he wanted with his -O0 magic gunk.

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Kees Cook
On Fri, May 22, 2020 at 11:28:48AM +0200, Peter Zijlstra wrote: > Get asm/asm.h into userspace and then write something like: Yeah, selftests is going to start suffering from the same "tools/ header duplication" problem. I've also had cases (see the logic in the Makefile in selftests/x86) where

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Yu-cheng Yu
On Fri, 2020-05-22 at 11:28 +0200, Peter Zijlstra wrote: > On Thu, May 21, 2020 at 02:17:20PM -0700, Yu-cheng Yu wrote: > > > +#pragma GCC push_options > > +#pragma GCC optimize ("O0") > > +void ibt_violation(void) > > +{ > > +#ifdef __i386__ > > + asm volatile("lea 1f, %eax"); > > + asm

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-22 Thread Peter Zijlstra
On Thu, May 21, 2020 at 02:17:20PM -0700, Yu-cheng Yu wrote: > +#pragma GCC push_options > +#pragma GCC optimize ("O0") > +void ibt_violation(void) > +{ > +#ifdef __i386__ > + asm volatile("lea 1f, %eax"); > + asm volatile("jmp *%eax"); > +#else > + asm volatile("lea 1f, %rax"); > +

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-21 Thread Yu-cheng Yu
On Thu, 2020-05-21 at 16:02 -0700, Kees Cook wrote: > On Thu, May 21, 2020 at 02:17:20PM -0700, Yu-cheng Yu wrote: > > Introduce a quick test to verify shadow stack and IBT are working. > > Cool! :) > > I'd love to see either more of a commit log or more comments in the test > code itself. I had

Re: [RFC PATCH 5/5] selftest/x86: Add CET quick test

2020-05-21 Thread Kees Cook
On Thu, May 21, 2020 at 02:17:20PM -0700, Yu-cheng Yu wrote: > Introduce a quick test to verify shadow stack and IBT are working. Cool! :) I'd love to see either more of a commit log or more comments in the test code itself. I had to spend a bit of time trying to understand how the test was