On 28/05/2018 14:23, Scott Lurndal wrote:
> Vir Campestris <vir.cam...@invalid.invalid> writes:
>> On 25/05/2018 22:30, Scott Lurndal wrote:
>>> Vir Campestris <vir.cam...@invalid.invalid> writes:
>> <snip>
>>>> Only trouble is I've only worked on one processor which isn't like that.
>>>> SIMD, multiple threads. And a pipeline (though much shorter) and a cache
>>>> (which apart from anything works because of locality of reference, which
>>>> is nothing to do with single threaded languages).
>>>>
>>>> Thing is though - if you've had an exception trying to access a kernel
>>>> page - why not flush the cache? It won't happen often, and bye-bye all
>>>> that side channel stuff.
>>>
>>> flushing the cache is a side effect of the exception, thus a covert
>>> channel - useful to determine valid kernel addresses, for example.
>>>
>> You get an exception when you access a page that you're not allowed to.
>
> Which, of course, takes longer than an access that doesn't get
> an exception. Covert channel #1.
>
I pick an address that might be a kernel address, and might be an
invalid address. CPU traps out to privileged code, and says to the
kernel "What do I do now?" Privileged code fiddles around for a while,
then passes control to the exception handler in the naughty program.
This will take quite a long time. IF you're really concerned about
security your kernel will make sure it's a _loooooong_ time.
Obviously in either case this will take much longer than accessing an
address to which the program has access. But the times for the two cases
need not be significantly different.
>>
>> System flushes the cache.
>
> Which, of course, changes the timing of the code that executes following
> the flush. Covert channel #2.
>
Yes. But since the app has been given an exception it _knows_ it wasn't
allowed to access the address. And it will soon realise the cache is
empty (if it is that way inclined) because everything will be slow for a
while.
>>
>> There is no way to determine whether this is an illegal address, or a
>> forbidden address - unless of course the system chooses to tell you.
>
> Doesn't matter. It's information that can be used.
>
There is no difference between the exception code nor the timing between
an illegal access fault for an invalid address, and an address which is
merely invalid for that privilege level. There is no information to use.
>>
>> What will you do with the list of valid kernel addresses anyway? It's
>> their contents that are interesting.
>
> What the list of valid kernel addresses provides is information. Useful
> information to those attempting to subvert the kernel; and certainly
> key to the exploits enabled by Spectre/Meltdown. Amongst other things,
> it allows the attacker to subvert KASLR.
>
OK, good point there. I still don't see how you get to differentiate the
two cases.
Andy