Re: [PATCH RFC 1/4] x86/thread_info: add TIF_NOPTI to disable PTI per task

From: Willy Tarreau
Date: Mon Jan 08 2018 - 12:04:10 EST


On Mon, Jan 08, 2018 at 05:57:11PM +0100, Thomas Gleixner wrote:
> On Mon, 8 Jan 2018, Willy Tarreau wrote:
>
> > This flag indicates that the task will not use isolated page tables.
> >
> > Signed-off-by: Willy Tarreau <w@xxxxxx>
> > ---
> > arch/x86/include/asm/thread_info.h | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
> > index 0022333..2f92cf1 100644
> > --- a/arch/x86/include/asm/thread_info.h
> > +++ b/arch/x86/include/asm/thread_info.h
> > @@ -126,6 +126,14 @@ struct thread_info {
> > #define _TIF_X32 (1 << TIF_X32)
> > #define _TIF_FSCHECK (1 << TIF_FSCHECK)
> >
> > +/* The following flags only exist on x86-64. We can't use the shift anymore
>
> Please do not use this horrible comment syle

You mean, the fact that there is no '/*' alone on the first line or
anything else ?

> And what's wrong with (1UL << 32)?

It fails when inherited in assembly parts. Initially the test was based
on "testq $(_TIF_NOPTI), reg" and 1UL doesn't parse there, which is why
I had to abandon it. In the latest patch I dropped "testq" for "bt" so
I didn't need the mask anymore and it wouldn't be a problem... until
someone wants to use it again.


> > + * due to C using signed ints by default and asm using unsigned longs.
> > + */
> > +#ifdef CONFIG_X86_64
> > +# define TIF_NOPTI 32 /* disable PTI for this task */
>
> No tail comments please.

OK but I did exactly like is done for all other flags above :-/

Thanks,
Willy