Bug 293296 - lib/libc/string/strnlen_test:strnlen_size_max test failing on riscv64 in CI
Summary: lib/libc/string/strnlen_test:strnlen_size_max test failing on riscv64 in CI
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: 16.0-CURRENT
Hardware: riscv Any
: --- Affects Only Me
Assignee: Robert Clausecker
URL: https://ci.freebsd.org/view/Test/job/...
Keywords: regression
: 293353 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-02-19 15:29 UTC by Siva Mahadevan
Modified: 2026-06-11 20:14 UTC (History)
3 users (show)

See Also:
linimon: mfc-stable14?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Siva Mahadevan freebsd_committer freebsd_triage 2026-02-19 15:29:24 UTC
The 'lib/libc/string/strnlen_test:strnlen_size_max' test is failing on riscv64 in CI:


lib/libc/string/strnlen_test:strnlen_size_max
Result:     failed: returned incorrect len (SIZE_MAX)
 
Standard error: 
align =  1, maxlen = 18446744073709551615, len = 0

I have reproduced this error using Bricoler to run riscv64 using QEMU:

$ bricoler run freebsd-src-regression-suite --param freebsd-src:url=/usr/src --param freebsd-src:branch= --param freebsd-src-build:machine=riscv/riscv64 --param freebsd-src-regression-suite:hypervisor=qemu --param freebsd-src-regression-suite:memory=4096 --param freebsd-src-regression-suite:ncpus=2 --param freebsd-src-regression-suite:parallelism=1 --param freebsd-src-regression-suite:tests='lib/libc/string/strnlen_test:strnlen_size_max'

strajabot@ added the tests in https://cgit.freebsd.org/src/commit/?id=7bedae81adaff4b4d291ba1f650b5b915ce207bf (lib/libc/tests/string: add test for strnlen()), but there is no Bugzilla account associated with them.

fuz@ since you reviewed and approved the changes in https://reviews.freebsd.org/D46275. Please triage as necessary.

CC += emaste@ as another mentor.
Comment 1 Robert Clausecker freebsd_committer freebsd_triage 2026-02-19 16:06:12 UTC
Thank you for this finding.  I messaged the author and will look into this.
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2026-03-07 22:00:44 UTC
*** Bug 293353 has been marked as a duplicate of this bug. ***
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-03-07 23:13:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2a4e3112c811b9892e14e15cfd23538e7e47329c

commit 2a4e3112c811b9892e14e15cfd23538e7e47329c
Author:     Strahinja Stanišić <strajabot@FreeBSD.org>
AuthorDate: 2026-03-07 21:59:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-03-07 22:11:11 +0000

    libc/riscv64: temporarily disable strnlen() implementation until a fix is developed

    strnlen() doesn't seem to cope well with a length argument such that
    string pointer plus length overflows past the end of the address space.

    Reviewed by:    fuz
    MFC after:      1 week
    PR:             293353, 293296
    Differential Revision:  https://reviews.freebsd.org/D55714

 lib/libc/riscv/string/Makefile.inc | 1 -
 1 file changed, 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-03-07 23:35:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b5514e1c6d9e7ec09b299a983d1ce32852e0d9dc

commit b5514e1c6d9e7ec09b299a983d1ce32852e0d9dc
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2026-03-07 23:14:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-03-07 23:33:53 +0000

    depend-cleanup.sh: rebuild strnlen.o on riscv64 if it came from strnlen.S

    We have to switch back to the previous rule once the temporary
    build fix has been replaced with a permanent fix.

    MFC after:      1 week
    See also:       2a4e3112c811b9892e14e15cfd23538e7e47329c
    PR:             293353, 293296

 tools/build/depend-cleanup.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-03-14 09:30:38 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0536513edabc9ce3447738e986b0c9fff3907e64

commit 0536513edabc9ce3447738e986b0c9fff3907e64
Author:     Strahinja Stanišić <strajabot@FreeBSD.org>
AuthorDate: 2026-03-07 21:59:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-03-14 09:29:21 +0000

    libc/riscv64: temporarily disable strnlen() implementation until a fix is developed

    strnlen() doesn't seem to cope well with a length argument such that
    string pointer plus length overflows past the end of the address space.

    Reviewed by:    fuz
    MFC after:      1 week
    PR:             293353, 293296
    Differential Revision:  https://reviews.freebsd.org/D55714

    (cherry picked from commit 2a4e3112c811b9892e14e15cfd23538e7e47329c)

 lib/libc/riscv/string/Makefile.inc | 1 -
 1 file changed, 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-03-14 09:30:39 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=521519f72d599622a79ed79f93c4f4b208089174

commit 521519f72d599622a79ed79f93c4f4b208089174
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2026-03-07 23:14:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-03-14 09:29:22 +0000

    depend-cleanup.sh: rebuild strnlen.o on riscv64 if it came from strnlen.S

    We have to switch back to the previous rule once the temporary
    build fix has been replaced with a permanent fix.

    MFC after:      1 week
    See also:       2a4e3112c811b9892e14e15cfd23538e7e47329c
    PR:             293353, 293296

    (cherry picked from commit b5514e1c6d9e7ec09b299a983d1ce32852e0d9dc)

 tools/build/depend-cleanup.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)