On 03.07.23 14:55, Christian Helmuth wrote:
Hey,
On Mon, Jul 03, 2023 at 13:50:44 CEST, Duss Pirmin wrote:
The new code is much less invasive. I'm currently debugging, why do_settimeofday64() accesses address 0x0. Maybe I'm calling it too early but I think, that I will figure this out.
Hm, that's unfortunate...
I already have figured out the problem. I had the call of do_settimeofday64() in the constructor of the Main object of wireguard.
At this point the kernel isn't initialized. The Linux parts can only be started after Main is constructed successfully.
Did you have a look into read_persistent_clock64() (timekeeping.c in Linux)? Maybe this is even less invasive than calling do_settimeofday64() as you may just implement the function that is defined "weak" in timekeeping.c. The related call chain is
timekeeping_init() -> read_persistent_wall_and_boot_offset() -- weak -> read_persistent_clock64 -- weak
I like this even better. The coupling between the two "worlds" is reduced even more.
I'm currently testing and cleaning up the changes. Expect a patch incoming shortly.
Regards, Pirmin