Re: [PATCH v4 37/39] x86: Add PTRACE interface for shadow stack

Edgecombe, Rick P
2022-12-09T17:14:06Z

On Fri, 2022-12-09 at 19:04 +0200, Mike Rapoport wrote:
> > /*
> > * xstateregs_active == regset_fpregs_active. Please refer to the
> > comment
> > diff --git a/arch/x86/kernel/fpu/regset.c
> > b/arch/x86/kernel/fpu/regset.c
> > index 6d056b68f4ed..00f3d5c9b682 100644
> > --- a/arch/x86/kernel/fpu/regset.c
> > +++ b/arch/x86/kernel/fpu/regset.c
> > @@ -8,6 +8,7 @@
> > #include <asm/fpu/api.h>
> > #include <asm/fpu/signal.h>
> > #include <asm/fpu/regset.h>
> > +#include <asm/prctl.h>
> >
> > #include "context.h"
> > #include "internal.h"
> > @@ -174,6 +175,92 @@ int xstateregs_set(struct task_struct *target,
> > const struct user_regset *regset,
> > return ret;
> > }
> >
> > +
> > +#ifdef CONFIG_X86_USER_SHADOW_STACK
> > +int ssp_active(struct task_struct *target, const struct
> > user_regset *regset)
> > +{
> > + if (shstk_enabled())
>
> This is not going to work with ptrace as shstk_enabled() checks
> current
> rather than target.

Oh right, thanks. I can change shstk_enabled() to take a task_struct.