[Bug 248420] benchmarks/blogbench: rand()-related crash

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Aug 1 23:23:18 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248420

            Bug ID: 248420
           Summary: benchmarks/blogbench: rand()-related crash
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs at FreeBSD.org
          Reporter: sigsys at gmail.com
                CC: jmohacsi at bsd.hu
             Flags: maintainer-feedback?(jmohacsi at bsd.hu)
                CC: jmohacsi at bsd.hu

blogbench uses rand() from multiple threads which crashes due to PRNG state
corruption.  The previous rand() implementation apparently had a simpler state
which did not cause crashes (but probably was still being corrupted by
concurrent use).

Patch switches it to arc4random(), which is thread-safe (but slower).

Index: benchmarks/blogbench/Makefile
===================================================================
--- benchmarks/blogbench/Makefile       (revision 543925)
+++ benchmarks/blogbench/Makefile       (working copy)
@@ -18,6 +18,10 @@

 OPTIONS_DEFINE=        DOCS

+post-patch:
+       @${REINPLACE_CMD} -Ee 's|[[:<:]]rand\(|arc4random(|g' \
+               "${WRKSRC}"/src/*.[ch]
+
 post-install:
        ${MKDIR} ${STAGEDIR}${DOCSDIR}
        ${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${STAGEDIR}${DOCSDIR}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list