From: Aurelien Jarno <aurelien@aurel32.net>
To: gao.rui@zte.com.cn
Cc: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, jiangfeng@kylinos.cn,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: lib: Fix address overflow due to large count values in strnlen ZBB path
Date: Sat, 22 Aug 2026 11:53:15 +0200 [thread overview]
Message-ID: <aolxiwRzSDlJt2t5@aurel32.net> (raw)
In-Reply-To: <20260819161821053fNUWuvdGIo4HUBmxlcNfG@zte.com.cn>
Hi,
On 2026-08-19 16:18, gao.rui@zte.com.cn wrote:
> Hi all,
>
> This patch fixes an issue in the RISC-V ZBB optimized strnlen implementation.
>
> Problem description: When using the ZBB optimized strnlen implementation, passing very large count values (such as SIZE_MAX) can cause address overflow and return incorrect results.
>
> This issue was observed in device-mapper tests:
>
> sh-5.2# dmsetup create testname9 --table "0 8 zero"
> sh-5.2# cat /sys/block/dm-*/dm/name
> testname
> sh-5.2# dmsetup remove testname9
>
> The overflow in strnlen caused failures in string handling during device-mapper operations.
>
> Patch summary:
> - Explicitly introduce the strnlen_generic label.
> - Simplify the generic implementation loop.
This part should be in a separate patch, separated from the bug fix, and
if possible with some benchmark.
> - Add fallback logic in strnlen_zbb to redirect to the generic path when a0 + a1 overflows.
> This ensures correct behavior for large count values and SIZE_MAX cases.
Is there a way to instead to fix the strnlen_zbb to avoid the fallback?
Regards
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
WARNING: multiple messages have this Message-ID (diff)
From: Aurelien Jarno <aurelien@aurel32.net>
To: gao.rui@zte.com.cn
Cc: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
alex@ghiti.fr, jiangfeng@kylinos.cn,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: lib: Fix address overflow due to large count values in strnlen ZBB path
Date: Sat, 22 Aug 2026 11:53:15 +0200 [thread overview]
Message-ID: <aolxiwRzSDlJt2t5@aurel32.net> (raw)
In-Reply-To: <20260819161821053fNUWuvdGIo4HUBmxlcNfG@zte.com.cn>
Hi,
On 2026-08-19 16:18, gao.rui@zte.com.cn wrote:
> Hi all,
>
> This patch fixes an issue in the RISC-V ZBB optimized strnlen implementation.
>
> Problem description: When using the ZBB optimized strnlen implementation, passing very large count values (such as SIZE_MAX) can cause address overflow and return incorrect results.
>
> This issue was observed in device-mapper tests:
>
> sh-5.2# dmsetup create testname9 --table "0 8 zero"
> sh-5.2# cat /sys/block/dm-*/dm/name
> testname
> sh-5.2# dmsetup remove testname9
>
> The overflow in strnlen caused failures in string handling during device-mapper operations.
>
> Patch summary:
> - Explicitly introduce the strnlen_generic label.
> - Simplify the generic implementation loop.
This part should be in a separate patch, separated from the bug fix, and
if possible with some benchmark.
> - Add fallback logic in strnlen_zbb to redirect to the generic path when a0 + a1 overflows.
> This ensures correct behavior for large count values and SIZE_MAX cases.
Is there a way to instead to fix the strnlen_zbb to avoid the fallback?
Regards
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-08-22 9:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 8:18 [PATCH] riscv: lib: Fix address overflow due to large count values in strnlen ZBB path gao.rui
2026-08-19 8:18 ` gao.rui
2026-08-22 9:53 ` Aurelien Jarno [this message]
2026-08-22 9:53 ` Aurelien Jarno
2026-08-24 8:12 ` gao.rui
2026-09-23 20:03 ` Jason Montleon
-- strict thread matches above, loose matches on Subject: below --
2026-08-24 8:20 gao.rui
2026-08-24 8:20 ` gao.rui
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=aolxiwRzSDlJt2t5@aurel32.net \
--to=aurelien@aurel32.net \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=gao.rui@zte.com.cn \
--cc=jiangfeng@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.