From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Yann Droneaud <yann@droneaud.fr>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-api@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Andy Lutomirski <luto@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
Carlos O'Donell <carlos@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
Arnd Bergmann <arnd@arndb.de>, Jann Horn <jannh@google.com>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <dhildenb@redhat.com>
Subject: Re: [PATCH] random: vDSO getrandom() must reject invalid flag
Date: Mon, 26 Aug 2024 08:53:00 +0200 [thread overview]
Message-ID: <ZswmTJf1asZUJ-5Z@zx2c4.com> (raw)
In-Reply-To: <20240825144758.325298-1-yann@droneaud.fr>
Hi Yann,
On Sun, Aug 25, 2024 at 04:47:50PM +0200, Yann Droneaud wrote:
> Like getrandom() syscall, vDSO getrandom() must not let
> unknown flags unnoticed [1].
>
> It could be possible to return -EINVAL from vDSO, but
> in the likely case a new flag is added to getrandom()
> syscall in the future, it would be nicer to get the
> behavior from the syscall, instead of an error until
> the vDSO is extended to support the new flag.
Thanks, that seems right to me.
Currently the @flags only matter if the RNG isn't initialized yet, so we
fallback if it's not initialized. But if it is initialized, all of the
flags behave the same way, so it didn't bother checking them. But that
doesn't account for invalid flags, and you're right to point out that
accepting them silently is an API problem.
I've applied this here, and I'll send it in as a fix soon:
https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=ed9fbbeb29
Thanks for the patch,
Jason
next prev parent reply other threads:[~2024-08-26 6:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 1:40 [PATCH v23 0/4] implement getrandom() in vDSO Jason A. Donenfeld
2024-07-12 1:40 ` [PATCH v23 1/4] mm: add MAP_DROPPABLE for designating always lazily freeable mappings Jason A. Donenfeld
2024-09-12 3:11 ` Miaohe Lin
2024-07-12 1:40 ` [PATCH v23 2/4] random: introduce generic vDSO getrandom() implementation Jason A. Donenfeld
2024-08-25 14:47 ` [PATCH] random: vDSO getrandom() must reject invalid flag Yann Droneaud
2024-08-26 6:53 ` Jason A. Donenfeld [this message]
2024-07-12 1:40 ` [PATCH v23 3/4] x86: vdso: Wire up getrandom() vDSO implementation Jason A. Donenfeld
2024-07-12 1:40 ` [PATCH v23 4/4] selftests/vDSO: add tests for vgetrandom 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=ZswmTJf1asZUJ-5Z@zx2c4.com \
--to=jason@zx2c4.com \
--cc=adhemerval.zanella@linaro.org \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=carlos@redhat.com \
--cc=dhildenb@redhat.com \
--cc=fweimer@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=vincenzo.frascino@arm.com \
--cc=yann@droneaud.fr \
/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
all inboxes | Powered by JetHome®