From: Yangyu Chen <cyy@cyyself.name>
To: conor.dooley@microchip.com
Cc: ajones@ventanamicro.com, aou@eecs.berkeley.edu, conor@kernel.org,
cyy@cyyself.name, i@zenithal.me, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, palmer@dabbelt.com,
paul.walmsley@sifive.com, soha@lohu.info, twd2.me@gmail.com
Subject: Re: [PATCH 1/2] riscv: allow case-insensitive ISA string parsing
Date: Thu, 27 Apr 2023 17:36:25 +0800 [thread overview]
Message-ID: <tencent_D9A598A810BDC656BE2BC15A6D0FC76C5C07@qq.com> (raw)
In-Reply-To: <20230427-unveiling-kiwi-631e966f77cc@wendy>
Hi, Conor
I have a different opinion about whether the isa string length should be
checked.
On Thu, 27 Apr 2023 10:04:34 +0100, Conor Dooley wrote:
> Preventing the input of absolute rubbish is dt-validate's job & if the dtb
> itself has been corrupted somehow I suspect that we have bigger problems
> than checking for "rv" will solve.
> > also do a strlen(isa) >= 4 check first, though. of_property_read_string()
> > will succeed even when the string is "".
> I don't think that checking that there are at least 4 characters isn't
> even sufficient. Either we should confirm that this is a valid riscv,isa
> to run on (so rv##ima w/ ## matching the kernel) or not bother at all.
What will happen if we have a bootloader in the future which allows
overriding isa string in the DT or ACPI table, the memory corruption could
happen if we didn't check it first.
Although the kernel will not boot in this case, anything about the user
input string should be parse carefuly that you never know what the future
code will be but leave a checker here will remind someone who will change
the parse in the future to check the length carefully.
So I agree with drew, we should do check strlen before check the first
two characters.
On Thu, 27 Apr 2023 10:04:34 +0100, Conor Dooley wrote:
> It's a different issue though, and I'd be inclined to revisit it in the
> future when the ACPI stuff is in, along with perhaps the cleanup parts
> of Heiko's series too.
Agreed.
Thanks,
Yangyu Chen
next prev parent reply other threads:[~2023-04-27 9:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230425120016.187010-1-cyy@cyyself.name>
2023-04-25 12:00 ` Yangyu Chen
2023-04-25 12:45 ` Yangyu Chen
2023-04-26 18:54 ` Conor Dooley
2023-04-27 7:53 ` Andrew Jones
2023-04-27 9:04 ` Conor Dooley
2023-04-27 9:25 ` Andrew Jones
2023-04-27 9:36 ` Yangyu Chen [this message]
2023-04-27 10:00 ` Conor Dooley
2023-04-27 12:47 ` Yangyu Chen
2023-04-27 17:28 ` Conor Dooley
2023-04-25 12:00 ` [PATCH 2/2] docs: dt: allow case-insensitive RISC-V ISA string Yangyu Chen
2023-04-25 13:32 ` Conor Dooley
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=tencent_D9A598A810BDC656BE2BC15A6D0FC76C5C07@qq.com \
--to=cyy@cyyself.name \
--cc=ajones@ventanamicro.com \
--cc=aou@eecs.berkeley.edu \
--cc=conor.dooley@microchip.com \
--cc=conor@kernel.org \
--cc=i@zenithal.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=soha@lohu.info \
--cc=twd2.me@gmail.com \
/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®