Re: [PATCH v4] riscv: lib: Fix ZBB strnlen wrap-around regression on huge counts

shao.mingyin at zte.com.cn shao.mingyin at zte.com.cn
Sun Sep 27 20:35:18 PDT 2026


Hi Paul,

Gentle ping on this one - it has picked up more tags since posting, and
should be ready to be picked up:

  Acked-by:     Michael Neuling <mikey at neuling.org>
  Reviewed-by:  Aurelien Jarno <aurelien at aurel32.net>
  Tested-by:    Troy Mitchell <troy.mitchell at linux.dev>
  Suggested-by: David Laight <david.laight.linux at gmail.com>
  Suggested-by: Qingfang Deng <qingfang.deng at linux.dev>

It stays a minimal fix: only the two boundary-computation instructions
in the ZBB path are replaced (18 insertions, 2 deletions, no new
registers), so the scanning loop itself is unchanged.

This one matters for stable - the regression is in v7.1.10+ and v7.2:
strnlen(s, SIZE_MAX) returns 8 for any 8+-byte aligned string and
truncates names built through FORTIFY strcat/strlcat (device-mapper's
sysfs name "live-base" becomes "live-bas"), which broke blivet/anaconda
installs and LVM on RISC-V systems.  It has since been reproduced
independently on a Fedora 45 riscv64 image with ZBB enabled, where the
fix restores correct behaviour.

Cc: stable is set, and the minimal form should backport cleanly to
7.1.y.  Happy to rebase onto riscv/fixes or adjust anything if needed.

Thanks,
Shao Mingyin



More information about the linux-riscv mailing list