> Date: Mon, 22 Jun 2020 02:06:39 +0300
> From: Paul Irofti <p...@irofti.net>
> 
> În 22 iunie 2020 00:15:59 EEST, Christian Weisgerber <na...@mips.inka.de> a 
> scris:
> >Paul Irofti:
> >
> >[Unrelated, just to mark where we're at]
> >> Right. Just reproduced it here. This moves the check at the top so
> >that
> >> each CPU checks its own skew and disables tc_user if necessary.
> >
> >I tweaked the patch locally to make _timekeep a visible global
> >symbol in libc.
> >
> >Printing its value has revealed two issues:
> >
> >* The timekeep page is mapped to the same address for every process.
> >  It changes across reboots, but once running, it's always the same.
> >  kettenis suggested
> >  - vaddr_t va;
> >  + vaddr_t va = 0;
> >  in exec_timekeep_map(), but that doesn't make a difference.
> 
> The va is set a few lines down the line. No point in
> initialization. This is identical behavior to the emul mapping
> before timekeep.

Well, uvm_map() picks a virtual address based on the value of va that
is passed in.  If it is zero, it picks a random address.  If not, it
uses the value as a hint and tries to pick something nearby.  So
passing in stack garbage is a bad thing.

> 
> >* I'm indeed seeing init(8) with _timekeep == NULL.
> 
> Probably because it is the first process? If you want to follow this
> read the kernel init bits and the syscall exec bits.

Possible.  The way process 1 is created is a bit of a hack.  Anyway,
_timekeep = NULL should not be a problem; the code should fall back on
using system calls in that case.

Reply via email to