[Bug 241258] Error building 12.1-RC1 from 11.3, "jevents" program getting a sigsegv in /usr/src/lib/libpmc/pmu-events

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Oct 15 07:08:06 UTC 2019


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

            Bug ID: 241258
           Summary: Error building 12.1-RC1 from 11.3, "jevents" program
                    getting a sigsegv in /usr/src/lib/libpmc/pmu-events
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: sigsys at gmail.com

buildworld failed like that while trying to build 12.1-RC1 (as of r353451) on a
11.3-RELEASE-p1 system:

--- libpmc_events.c ---
./pmu-events/jevents "x86" /usr/src/lib/libpmc/pmu-events/arch libpmc_events.c
Segmentation fault
*** [libpmc_events.c] Error code 139

make[5]: stopped in /usr/src/lib/libpmc
1 error

With this change it doesn't fail anymore:

Index: lib/libpmc/pmu-events/jevents.c
===================================================================
--- lib/libpmc/pmu-events/jevents.c     (revision 353534)
+++ lib/libpmc/pmu-events/jevents.c     (working copy)
@@ -119,8 +119,7 @@
        char *e = s + strlen(s);

        /* Remove trailing dots that look ugly in perf list */
-       --e;
-       while (e >= s && isspace(*e))
+       while (e > s && isspace(e[-1]))
                --e;
        if (*e == '.')
                *e = 0;

Dunno if the problem happens because of something specific to this system but
this loop is wrong nevertheless (it could access before the string if it was
empty or all spaces).

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


More information about the freebsd-bugs mailing list