Re: [PATCH v5] LoongArch: vDSO: Wire up getrandom() vDSO implementation
From: Jason A. Donenfeld
Date: Thu Aug 29 2024 - 09:33:34 EST
One small question just occurred to me:
> +static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(
> + void)
> +{
> + return (const struct vdso_rng_data *)(
> + get_vdso_data() +
> + VVAR_LOONGARCH_PAGES_START * PAGE_SIZE +
> + offsetof(struct loongarch_vdso_data, rng_data));
> +}
Did you test this in a TIMENS? On x86, I had to deal with the page
offsets switching around depending on whether there was a TIMENS. I
tested this in my test harness with some basic code like:
if (argc == 1) {
if (unshare(CLONE_NEWTIME))
panic("unshare(CLONE_NEWTIME)");
if (!fork()) {
if (execl(argv[0], argv[0], "now-in-timens"))
panic("execl");
}
wait(NULL);
poweroff();
}
Because unlike other namespaces, the time one only becomes active after
fork/exec.
But maybe loongarch is more organized and you don't need any special
handling in __arch_get_vdso...data() functions like I needed on x86.
Just thought I should check.
Jason