Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Yu, Yu-cheng
On 2/24/2021 11:42 AM, Borislav Petkov wrote: On Wed, Feb 24, 2021 at 11:30:34AM -0800, Andy Lutomirski wrote: On Wed, Feb 24, 2021 at 11:20 AM Borislav Petkov wrote: On Wed, Feb 24, 2021 at 09:56:13AM -0800, Yu, Yu-cheng wrote: No. Maybe I am doing too much. The GP fault sets si_addr to

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Borislav Petkov
On Wed, Feb 24, 2021 at 11:30:34AM -0800, Andy Lutomirski wrote: > On Wed, Feb 24, 2021 at 11:20 AM Borislav Petkov wrote: > > > > On Wed, Feb 24, 2021 at 09:56:13AM -0800, Yu, Yu-cheng wrote: > > > No. Maybe I am doing too much. The GP fault sets si_addr to zero, for > > > example. So maybe

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Andy Lutomirski
On Wed, Feb 24, 2021 at 11:20 AM Borislav Petkov wrote: > > On Wed, Feb 24, 2021 at 09:56:13AM -0800, Yu, Yu-cheng wrote: > > No. Maybe I am doing too much. The GP fault sets si_addr to zero, for > > example. So maybe do the same here? > > No, you're looking at this from the wrong angle. This

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Borislav Petkov
On Wed, Feb 24, 2021 at 09:56:13AM -0800, Yu, Yu-cheng wrote: > No. Maybe I am doing too much. The GP fault sets si_addr to zero, for > example. So maybe do the same here? No, you're looking at this from the wrong angle. This is going to be user-visible and the moment it gets upstream, it is

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Yu, Yu-cheng
On 2/24/2021 8:53 AM, Borislav Petkov wrote: On Wed, Feb 24, 2021 at 08:44:45AM -0800, Yu, Yu-cheng wrote: + force_sig_fault(SIGSEGV, SEGV_CPERR, + (void __user *)uprobe_get_trap_addr(regs)); Why is this calling an uprobes function? I will change it to

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Borislav Petkov
On Wed, Feb 24, 2021 at 08:44:45AM -0800, Yu, Yu-cheng wrote: > > > + force_sig_fault(SIGSEGV, SEGV_CPERR, > > > + (void __user *)uprobe_get_trap_addr(regs)); > > > > Why is this calling an uprobes function? > > > > I will change it to error_get_trap_addr(). "/* * Posix

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Yu, Yu-cheng
On 2/24/2021 8:13 AM, Borislav Petkov wrote: On Wed, Feb 17, 2021 at 02:27:10PM -0800, Yu-cheng Yu wrote: +/* + * When a control protection exception occurs, send a signal to the responsible + * application. Currently, control protection is only enabled for user mode. + * This exception should

Re: [PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-24 Thread Borislav Petkov
On Wed, Feb 17, 2021 at 02:27:10PM -0800, Yu-cheng Yu wrote: > +/* > + * When a control protection exception occurs, send a signal to the > responsible > + * application. Currently, control protection is only enabled for user mode. > + * This exception should not come from kernel mode. > + */ >

[PATCH v21 06/26] x86/cet: Add control-protection fault handler

2021-02-17 Thread Yu-cheng Yu
A control-protection fault is triggered when a control-flow transfer attempt violates Shadow Stack or Indirect Branch Tracking constraints. For example, the return address for a RET instruction differs from the copy on the shadow stack; or an indirect JMP instruction, without the NOTRACK prefix,