From: "Ivan Komarov" <Ivan.Komarov@dfyz.info>
To: <linux-riscv@lists.infradead.org>
Subject: An off-by-one error in auxv setup for RISC-V
Date: Tue, 02 Jan 2024 07:04:05 +0100 [thread overview]
Message-ID: <CY3Z02NYV1C4.11BLB9PLVW9G1@fedora> (raw)
Hi,
Currently, the maximum size of the auxiliary vector is bounded (in
include/linux/mm_types.h) by the sum of the maximum size of
architecture-independent entries (AT_VECTOR_SIZE_BASE) and
architecture-specific ones (AT_VECTOR_SIZE_ARCH).
Commit e92f469b0771 added a new RISC-V-specific auxv entry to indicate
the signal frame size to userspace, but unfortunately didn't bump
AT_VECTOR_SIZE_ARCH, which can result in writing past the end of
mm->saved_auxv in create_elf_tables() from fs/binfmt_elf.c.
In practice, this is mostly harmless:
* not all architecture-independent entires are actually used on RISC-V,
so we still have plenty of space left in mm->saved_auxv even with
the off-by-one
* even if the overflow happened, kernels compiled with
CONFIG_HARDENED_USERCOPY would detect it when copying auxv entries
to userspace
Still, it might be good to fix this. My friend had already tried to send a
patch for this
(see https://lore.kernel.org/all/73883406.20231215232720@torrio.net/),
which had some process issues. This time, we're trying to do things properly,
including a Closes: tag that references a bug report (this e-mail).
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
reply other threads:[~2024-01-02 6:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CY3Z02NYV1C4.11BLB9PLVW9G1@fedora \
--to=ivan.komarov@dfyz.info \
--cc=linux-riscv@lists.infradead.org \
/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