2018-08-29 01:48:16

by Nadav Amit

[permalink] [raw]
Subject: Flushing user entries for kernel mappings in x86

Hello Andy,

Is there a reason for __flush_tlb_one_kernel() to flush the PTE not only in
the kernel address space, but also in the user one (as part of
__flush_tlb_one_user)? [ I obviously regard the case when PTI is on ].

Thanks,
Nadav


2018-08-29 03:46:43

by Andy Lutomirski

[permalink] [raw]
Subject: Re: Flushing user entries for kernel mappings in x86

On Tue, Aug 28, 2018 at 6:46 PM, Nadav Amit <[email protected]> wrote:
> Hello Andy,
>
> Is there a reason for __flush_tlb_one_kernel() to flush the PTE not only in
> the kernel address space, but also in the user one (as part of
> __flush_tlb_one_user)? [ I obviously regard the case when PTI is on ].

In most cases, probably not, but it's fairly cheap, I think. And it
makes it so that we're okay if the TLB entry we're flushing is used by
the entry code.

2018-08-29 08:39:32

by Nadav Amit

[permalink] [raw]
Subject: Re: Flushing user entries for kernel mappings in x86

at 8:45 PM, Andy Lutomirski <[email protected]> wrote:

> On Tue, Aug 28, 2018 at 6:46 PM, Nadav Amit <[email protected]> wrote:
>> Hello Andy,
>>
>> Is there a reason for __flush_tlb_one_kernel() to flush the PTE not only in
>> the kernel address space, but also in the user one (as part of
>> __flush_tlb_one_user)? [ I obviously regard the case when PTI is on ].
>
> In most cases, probably not, but it's fairly cheap, I think. And it
> makes it so that we're okay if the TLB entry we're flushing is used by
> the entry code.

Thanks. I assumed that’s the case. I don’t know how cheap they are
(especially if INVPCID is not supported) but I guess they are not that
frequent.