linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Xi Ruoyao <xry111@xry111.site>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	linux-crypto@vger.kernel.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org, Jinyang He <hejinyang@loongson.cn>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	Arnd Bergmann <arnd@arndb.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Subject: Re: [PATCH v5] LoongArch: vDSO: Wire up getrandom() vDSO implementation
Date: Thu, 29 Aug 2024 15:27:33 +0200	[thread overview]
Message-ID: <ZtB3RczHN00XDO52@zx2c4.com> (raw)
In-Reply-To: <20240829125656.19017-1-xry111@xry111.site>

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

  parent reply	other threads:[~2024-08-29 13:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 12:56 [PATCH v5] LoongArch: vDSO: Wire up getrandom() vDSO implementation Xi Ruoyao
2024-08-29 13:01 ` Xi Ruoyao
2024-08-29 13:05   ` Jason A. Donenfeld
2024-08-29 13:13 ` Jason A. Donenfeld
2024-08-29 13:18 ` Huacai Chen
2024-08-31  6:40   ` Xi Ruoyao
2024-08-31  7:10     ` Huacai Chen
2024-08-31  8:54       ` Christophe Leroy
2024-08-29 13:27 ` Jason A. Donenfeld [this message]
2024-08-29 13:37   ` Jason A. Donenfeld
2024-08-29 14:06     ` Xi Ruoyao
2024-08-29 14:44       ` Jason A. Donenfeld
2024-08-30  9:05         ` Xi Ruoyao
2024-08-30 12:24           ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZtB3RczHN00XDO52@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=arnd@arndb.de \
    --cc=chenhuacai@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=hejinyang@loongson.cn \
    --cc=kernel@xen0n.name \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=xry111@xry111.site \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).